]> git.baikalelectronics.ru Git - kernel.git/commit
cxl: Fix issues when unmapping contexts
authorIan Munsie <imunsie@au1.ibm.com>
Wed, 7 Jan 2015 05:33:04 +0000 (16:33 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 12 Jan 2015 05:40:02 +0000 (16:40 +1100)
commit36a9f3da77ef596dc824caa4a05bf3ef918be119
tree21268708a21b85d54a9752c27575d473f78c3329
parent00f584c3384d12666369566d7e168ba383d0c121
cxl: Fix issues when unmapping contexts

An issue was introduced with "cxl: Unmap MMIO regions when detaching a
context" (bb997d4dcbe9ecbabdae74768b13d492346676ff) where closing a
context normally could also unmap the problem state area of other
contexts currently using the AFU.

It was also discovered that after a context's MMIO space had been
unmapped it would read 0s when accessing it, whereas the expected
behaviour was for the access to fail altogether.

In order to address these issues, this patch does two things:

- Forced mmap unmapping is only done when we are forcefully detaching
  all contexts, and not in the normal detach path. Since the normal
  context close path is tied to the file release any mmaps must have
  already been released so we don't need to worry in that case.

- The mmap path now uses a vm_operations_struct with a fault handler.
  The fault handler ensures that the context is in started state,
  otherwise it fails the access attempt with a SIGBUS.

Fixes: bb997d4dcbe9 ("cxl: Unmap MMIO regions when detaching a context")
Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
drivers/misc/cxl/context.c
drivers/misc/cxl/file.c