linux-stable/arch/s390/pci
Niklas Schnelle f058599e22 s390/pci: Fix s390_mmio_read/write with MIO
The s390_mmio_read/write syscalls are currently broken when running with
MIO.

The new pcistb_mio/pcstg_mio/pcilg_mio instructions are executed
similiarly to normal load/store instructions and do address translation
in the current address space. That means inside the kernel they are
aware of mappings into kernel address space while outside the kernel
they use user space mappings (usually created through mmap'ing a PCI
device file).

Now when existing user space applications use the s390_pci_mmio_write
and s390_pci_mmio_read syscalls, they pass I/O addresses that are mapped
into user space so as to be usable with the new instructions without
needing a syscall. Accessing these addresses with the old instructions
as done currently leads to a kernel panic.

Also, for such a user space mapping there may not exist an equivalent
kernel space mapping which means we can't just use the new instructions
in kernel space.

Instead of replicating user mappings in the kernel which then might
collide with other mappings, we can conceptually execute the new
instructions as if executed by the user space application using the
secondary address space. This even allows us to directly store to the
user pointer without the need for copy_to/from_user().

Cc: stable@vger.kernel.org
Fixes: 71ba41c9b1 ("s390/pci: provide support for MIO instructions")
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2020-05-14 23:21:37 +02:00
..
Makefile s390/pci: move everything irq related to pci_irq.c 2019-04-29 10:47:01 +02:00
pci.c s390 updates for the 5.7 merge window 2020-04-04 09:45:50 -07:00
pci_clp.c s390/pci: Improve handling of unset UID 2020-03-23 13:41:55 +01:00
pci_debug.c locking/atomic, s390/pci: Remove redundant casts 2019-06-03 12:32:57 +02:00
pci_dma.c dma-mapping updates for 5.4: 2019-09-19 13:27:23 -07:00
pci_event.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci_insn.c s390/pci: provide support for MIO instructions 2019-04-29 10:47:01 +02:00
pci_irq.c s390/pci: do not set affinity for floating irqs 2020-04-22 16:20:55 +02:00
pci_mmio.c s390/pci: Fix s390_mmio_read/write with MIO 2020-05-14 23:21:37 +02:00
pci_sysfs.c s390/pci: Fix possible deadlock in recover_store() 2020-01-22 13:05:34 +01:00