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
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-ftpci100.c
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-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-mvebu.c
pci-rcar-gen2.c
pci-tegra.c PCI: tegra: Allow building as a module 2025-12-26 10:57:17 -06:00
pci-thunder-ecam.c
pci-thunder-pem.c
pci-v3-semi.c
pci-versatile.c
pci-xgene-msi.c
pci-xgene.c
pcie-altera-msi.c
pcie-altera.c
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
pcie-iproc-bcma.c
pcie-iproc-msi.c
pcie-iproc-platform.c
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
pcie-mediatek-gen3.c
pcie-mediatek.c PCI: mediatek: Fix IRQ domain leak when MSI allocation fails 2025-12-18 13:36:56 +05:30
pcie-mt7621.c
pcie-rcar-ep.c
pcie-rcar-host.c
pcie-rcar.c
pcie-rcar.h
pcie-rockchip-ep.c
pcie-rockchip-host.c
pcie-rockchip.c
pcie-rockchip.h
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
pcie-xilinx-cpm.c
pcie-xilinx-dma-pl.c
pcie-xilinx-nwl.c
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