WSL2-Linux-Kernel/drivers/misc/cxl
Ian Munsie 0712dc7e73 cxl: Fix issues when unmapping contexts
An issue was introduced with "cxl: Unmap MMIO regions when detaching a
context" (b123429e6a) 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: b123429e6a ("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>
2015-01-12 16:40:02 +11:00
..
Kconfig cxl: Add driver to Kbuild and Makefiles 2014-10-08 20:15:58 +11:00
Makefile cxl: Add driver to Kbuild and Makefiles 2014-10-08 20:15:58 +11:00
base.c cxl: Add base builtin support 2014-10-08 20:15:56 +11:00
context.c cxl: Fix issues when unmapping contexts 2015-01-12 16:40:02 +11:00
cxl.h cxl: Unmap MMIO regions when detaching a context 2014-12-12 13:06:48 +11:00
debugfs.c cxl: Driver code for powernv PCIe based cards for userspace access 2014-10-08 20:15:57 +11:00
fault.c powerpc/mm: don't do tlbie for updatepp request with NO HPTE fault 2014-12-05 16:26:15 +11:00
file.c cxl: Fix issues when unmapping contexts 2015-01-12 16:40:02 +11:00
irq.c cxl: Name interrupts in /proc/interrupt 2014-11-18 13:01:39 +11:00
main.c cxl: Driver code for powernv PCIe based cards for userspace access 2014-10-08 20:15:57 +11:00
native.c cxl: Add timeout to process element commands 2014-12-12 13:06:47 +11:00
pci.c cxl: Change contexts_lock to a mutex to fix sleep while atomic bug 2014-12-12 13:06:47 +11:00
sysfs.c cxl: Change contexts_lock to a mutex to fix sleep while atomic bug 2014-12-12 13:06:47 +11:00