linux/drivers/pci/controller
Niklas Cassel c22533c66c PCI: dwc: ep: Flush MSI-X write before unmapping its ATU entry
Endpoint drivers use dw_pcie_ep_raise_msix_irq() to raise an MSI-X
interrupt to the host using a writel(), which generates a PCI posted write
transaction.  There's no completion for posted writes, so the writel() may
return before the PCI write completes.  dw_pcie_ep_raise_msix_irq() also
unmaps the outbound ATU entry used for the PCI write, so the write races
with the unmap.

If the PCI write loses the race with the ATU unmap, the write may corrupt
host memory or cause IOMMU errors, e.g., these when running fio with a
larger queue depth against nvmet-pci-epf:

  arm-smmu-v3 fc900000.iommu:      0x0000010000000010
  arm-smmu-v3 fc900000.iommu:      0x0000020000000000
  arm-smmu-v3 fc900000.iommu:      0x000000090000f040
  arm-smmu-v3 fc900000.iommu:      0x0000000000000000
  arm-smmu-v3 fc900000.iommu: event: F_TRANSLATION client: 0000:01:00.0 sid: 0x100 ssid: 0x0 iova: 0x90000f040 ipa: 0x0
  arm-smmu-v3 fc900000.iommu: unpriv data write s1 "Input address caused fault" stag: 0x0

Flush the write by performing a readl() of the same address to ensure that
the write has reached the destination before the ATU entry is unmapped.

The same problem was solved for dw_pcie_ep_raise_msi_irq() in commit
8719c64e76 ("PCI: dwc: ep: Cache MSI outbound iATU mapping"), but there
it was solved by dedicating an outbound iATU only for MSI. We can't do the
same for MSI-X because each vector can have a different msg_addr and the
msg_addr may be changed while the vector is masked.

Fixes: beb4641a78 ("PCI: dwc: Add MSI-X callbacks handler")
Signed-off-by: Niklas Cassel <cassel@kernel.org>
[bhelgaas: commit log]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260211175540.105677-2-cassel@kernel.org
2026-02-25 15:44:20 -06:00
..
cadence Merge branch 'pci/controller/dwc' 2026-02-06 17:09:34 -06:00
dwc PCI: dwc: ep: Flush MSI-X write before unmapping its ATU entry 2026-02-25 15:44:20 -06:00
mobiveil PCI: mobiveil: Switch to msi_create_parent_irq_domain() 2025-07-24 16:24:02 -05:00
plda PCI: starfive: Use regulator APIs to control the 3v3 power supply of PCIe slots 2026-01-13 19:35:34 +05:30
Kconfig Merge branch 'pci/controller/misc' 2026-02-06 17:09:52 -06:00
Makefile PCI: aspeed: Add ASPEED PCIe RC driver 2025-12-23 21:25:20 +05:30
pci-aardvark.c PCI: aardvark: Switch to msi_create_parent_irq_domain() 2025-07-24 16:24:15 -05:00
pci-ftpci100.c PCI: Switch to irq_domain_create_linear() 2025-05-16 21:06:10 +02:00
pci-host-common.c PCI: host-generic: Avoid reporting incorrect 'missing reg property' error 2026-02-06 16:44:00 -06:00
pci-host-common.h PCI: host-generic: Move bridge allocation outside of pci_host_common_init() 2025-11-25 19:39:42 +05:30
pci-host-generic.c PCI: host-common: Convert to library for host controller drivers 2025-05-30 12:21:57 -05:00
pci-hyperv-intf.c PCI: hv: remove unnecessary module_init/exit functions 2026-02-04 06:20:51 +00:00
pci-hyperv.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
pci-ixp4xx.c PCI: ixp4xx: Guard ARM32-specific hook_fault_code() 2025-10-19 13:08:19 +05:30
pci-loongson.c PCI: loongson: Enable MSI in LS7A Root Complex 2024-07-19 10:07:01 -05:00
pci-mvebu.c PCI: mvebu: Fix use of for_each_of_range() iterator 2025-09-08 14:40:27 -05:00
pci-rcar-gen2.c PCI: rcar-gen2: Use devm_platform_get_and_ioremap_resource() 2023-07-13 18:12:35 +00:00
pci-tegra.c PCI: tegra: Allow building as a module 2025-12-26 10:57:17 -06:00
pci-thunder-ecam.c PCI: host-common: Convert to library for host controller drivers 2025-05-30 12:21:57 -05:00
pci-thunder-pem.c PCI: host-common: Convert to library for host controller drivers 2025-05-30 12:21:57 -05:00
pci-v3-semi.c Merge branch 'pci/misc' 2023-08-29 11:03:57 -05:00
pci-versatile.c PCI: Remove MODULE_LICENSE so boolean drivers don't look like modules 2023-02-17 08:47:58 -06:00
pci-xgene-msi.c PCI: xgene-msi: Return negative -EINVAL in xgene_msi_handler_setup() 2025-08-11 16:30:43 +05:30
pci-xgene.c PCI: xgene: Drop XGENE_PCIE_IP_VER_UNKN 2025-07-22 15:33:16 -05:00
pcie-altera-msi.c PCI: altera-msi: Switch to msi_create_parent_irq_domain() 2025-07-24 16:24:15 -05:00
pcie-altera.c PCI: controller: Use dev_fwnode() instead of of_fwnode_handle() 2025-07-24 16:00:47 -05:00
pcie-apple.c PCI: host-generic: Move bridge allocation outside of pci_host_common_init() 2025-11-25 19:39:42 +05:30
pcie-aspeed.c PCI: aspeed: Add ASPEED PCIe RC driver 2025-12-23 21:25:20 +05:30
pcie-brcmstb.c PCI: brcmstb: Add panic/die handler to driver 2025-11-13 10:47:16 -06:00
pcie-hisi-error.c PCI: controller: Switch back to struct platform_driver::remove() 2024-10-03 16:44:49 -05:00
pcie-iproc-bcma.c PCI: Add defines for normal and subtractive PCI bridges 2022-02-17 15:29:35 -06:00
pcie-iproc-msi.c PCI: iproc: Switch to msi_create_parent_irq_domain() 2025-07-24 16:24:16 -05:00
pcie-iproc-platform.c PCI: controller: Switch back to struct platform_driver::remove() 2024-10-03 16:44:49 -05:00
pcie-iproc.c PCI: iproc: Implement MSI controller node detection with of_msi_xlate() 2025-11-22 17:09:03 +01:00
pcie-iproc.h PCI: iproc: Convert to platform remove callback returning void 2023-06-24 14:12:36 +00:00
pcie-mediatek-gen3.c PCI: mediatek-gen3: Add support for MediaTek MT8196 SoC 2025-08-19 20:05:57 +05:30
pcie-mediatek.c PCI: mediatek: Fix IRQ domain leak when MSI allocation fails 2025-12-18 13:36:56 +05:30
pcie-mt7621.c PCI: mt7621: Use helper function for_each_available_child_of_node_scoped() 2025-03-06 09:31:45 +00:00
pcie-rcar-ep.c PCI: endpoint: Drop superfluous pci_epc_features initialization 2025-08-14 10:42:42 -05:00
pcie-rcar-host.c PCI: rcar-host: Convert struct rcar_msi mask_lock into raw spinlock 2025-09-25 18:05:12 -05:00
pcie-rcar.c
pcie-rcar.h PCI: rcar: Avoid defines prefixed with CONFIG 2023-03-10 13:34:27 +01:00
pcie-rockchip-ep.c PCI: endpoint: Drop superfluous pci_epc_features initialization 2025-08-14 10:42:42 -05:00
pcie-rockchip-host.c Merge branch 'pci/controller/rockchip-host' 2025-07-31 16:12:17 -05:00
pcie-rockchip.c PCI: rockchip: Refactor rockchip_pcie_disable_clocks() signature 2025-01-15 18:24:12 +00:00
pcie-rockchip.h PCI: rockchip: Switch to FIELD_PREP_WM16* macros 2025-09-02 20:06:47 -04:00
pcie-rzg3s-host.c PCI: rzg3s-host: Fix device node reference leak in rzg3s_pcie_host_parse_port() 2026-02-06 16:04:01 -06:00
pcie-xilinx-common.h PCI: xilinx-xdma: Add Xilinx XDMA Root Port driver 2023-10-26 15:02:02 +00:00
pcie-xilinx-cpm.c PCI: Switch to irq_domain_create_linear() 2025-05-16 21:06:10 +02:00
pcie-xilinx-dma-pl.c PCI: xilinx-xdma: Switch to msi_create_parent_irq_domain() 2025-07-24 16:24:16 -05:00
pcie-xilinx-nwl.c PCI: xilinx-nwl: Fix ECAM programming 2025-09-29 16:37:23 -05:00
pcie-xilinx.c PCI: xilinx: Fix INTx IRQ domain leak in error paths 2025-12-23 17:57:47 +05:30
vmd.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00