linux-stable/drivers/pci
Thomas Gleixner 77e89afc25 PCI/MSI: Protect msi_desc::masked for multi-MSI
Multi-MSI uses a single MSI descriptor and there is a single mask register
when the device supports per vector masking. To avoid reading back the mask
register the value is cached in the MSI descriptor and updates are done by
clearing and setting bits in the cache and writing it to the device.

But nothing protects msi_desc::masked and the mask register from being
modified concurrently on two different CPUs for two different Linux
interrupts which belong to the same multi-MSI descriptor.

Add a lock to struct device and protect any operation on the mask and the
mask register with it.

This makes the update of msi_desc::masked unconditional, but there is no
place which requires a modification of the hardware register without
updating the masked cache.

msi_mask_irq() is now an empty wrapper which will be cleaned up in follow
up changes.

The problem goes way back to the initial support of multi-MSI, but picking
the commit which introduced the mask cache is a valid cut off point
(2.6.30).

Fixes: f2440d9acb ("PCI MSI: Refactor interrupt masking code")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20210729222542.726833414@linutronix.de
2021-08-10 10:59:20 +02:00
..
controller ARM: SoC changes for 5.14 2021-07-10 09:22:44 -07:00
endpoint Merge branch 'remotes/lorenzo/pci/endpoint' 2021-05-04 10:43:27 -05:00
hotplug Merge branch 'pci/kernel-doc' 2021-07-06 10:56:29 -05:00
pcie Merge branch 'pci/sysfs' 2021-07-06 10:56:25 -05:00
switch PCI/sysfs: Use sysfs_emit() and sysfs_emit_at() in "show" functions 2021-06-03 22:14:47 -05:00
access.c
ats.c PCI: Fix kernel-doc errors 2021-03-11 17:37:20 -06:00
bus.c
ecam.c PCI: Dynamically map ECAM regions 2021-06-16 17:20:40 -05:00
host-bridge.c
iov.c Merge branch 'pci/virtualization' 2021-07-06 10:56:26 -05:00
irq.c
Kconfig
Makefile
mmap.c
msi.c PCI/MSI: Protect msi_desc::masked for multi-MSI 2021-08-10 10:59:20 +02:00
of.c pci-v5.13-fixes-2 2021-06-18 13:54:11 -07:00
p2pdma.c Merge branch 'pci/sysfs' 2021-07-06 10:56:25 -05:00
pci-acpi.c PCI/ACPI: Fix acpi_pci_set_power_state() debug message 2021-04-01 14:54:43 -05:00
pci-bridge-emul.c
pci-bridge-emul.h
pci-driver.c PCI: Add support for dev_groups to struct pci_driver 2021-05-19 23:50:27 -04:00
pci-label.c PCI/sysfs: Use sysfs_emit() and sysfs_emit_at() in "show" functions 2021-06-03 22:14:47 -05:00
pci-mid.c
pci-pf-stub.c
pci-stub.c
pci-sysfs.c PCI/sysfs: Add 'devspec' newline 2021-06-04 09:21:07 -05:00
pci.c pci-v5.14-changes 2021-07-08 12:06:20 -07:00
pci.h Merge branch 'pci/kernel-doc' 2021-07-06 10:56:29 -05:00
probe.c Revert "PCI: Coalesce host bridge contiguous apertures" 2021-07-09 18:51:46 -05:00
proc.c PCI: Fix fall-through warning for Clang 2021-07-13 13:59:12 -05:00
quirks.c pci-v5.14-changes 2021-07-08 12:06:20 -07:00
remove.c PCI/sysfs: Convert "reset" to static attribute 2021-04-27 17:53:20 -05:00
rom.c
search.c
setup-bus.c
setup-irq.c
setup-res.c
slot.c PCI/sysfs: Use sysfs_emit() and sysfs_emit_at() in "show" functions 2021-06-03 22:14:47 -05:00
syscall.c
vc.c
vpd.c Merge branch 'pci/sysfs' 2021-05-04 10:43:23 -05:00
xen-pcifront.c swiotlb: remove swiotlb_nr_tbl 2021-03-19 04:58:25 +00:00