linux/drivers/pci/controller
Niklas Cassel 58fbf08935 PCI: dwc: Fix msg_atu_index assignment
When dw_pcie_iatu_setup() configures outbound address translation for both
type PCIE_ATU_TYPE_MEM and PCIE_ATU_TYPE_IO, the iATU index to use is
incremented before calling dw_pcie_prog_outbound_atu().

However for msg_atu_index, the index is not incremented before use,
causing the iATU index to be the same as the last configured iATU index,
which means that it will incorrectly use the same iATU index that is
already in use, breaking outbound address translation.

In total there are three problems with this code:
-It assigns msg_atu_index the same index that was used for the last
 outbound address translation window, rather than incrementing the index
 before assignment.
-The index should only be incremented (and msg_atu_index assigned) if the
 use_atu_msg feature is actually requested/in use (pp->use_atu_msg is set).
-If the use_atu_msg feature is requested/in use, and there are no outbound
 iATUs available, the code should return an error, as otherwise when this
 this feature is used, it will use an iATU index that is out of bounds.

Fixes: e1a4ec1a95 ("PCI: dwc: Add generic MSG TLP support for sending PME_Turn_Off when system suspend")
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Tested-by: Maciej W. Rozycki <macro@orcam.me.uk>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hans Zhang <zhanghuabing@ecosda.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260127151038.1484881-6-cassel@kernel.org
2026-02-05 18:20:46 +05:30
..
cadence PCI: Add preceding capability position support in PCI_FIND_NEXT_*_CAP macros 2025-12-18 12:46:16 +05:30
dwc PCI: dwc: Fix msg_atu_index assignment 2026-02-05 18:20:46 +05:30
mobiveil PCI: mobiveil: Switch to msi_create_parent_irq_domain() 2025-07-24 16:24:02 -05:00
plda PCI: plda: Remove dev_err_probe() when the errno is -ENOMEM 2025-09-08 15:44:31 +05:30
Kconfig Merge branch 'pci/controller/rzg3s-host' 2025-12-03 14:18:41 -06:00
Makefile PCI: Add Renesas RZ/G3S host controller driver 2025-11-25 12:34:48 -06:00
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: Move bridge allocation outside of pci_host_common_init() 2025-11-25 19:39:42 +05:30
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: Fix warnings for missing export.h header inclusion 2025-07-09 23:46:06 +00:00
pci-hyperv.c PCI: Enable host bridge emulation for PCI_DOMAINS_GENERIC platforms 2025-10-28 12:36:34 -05: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: Convert struct tegra_msi mask_lock into raw spinlock 2025-09-25 18:02:30 -05: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-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: Add support for Airoha AN7583 SoC 2025-10-21 07:29: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: Initialize MSI status bitmap before use 2025-12-09 12:42:48 -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 NULL pointer dereference in xilinx_pcie_intr_handler() 2025-08-12 11:31:24 -05:00
vmd.c pci-v6.19-changes 2025-12-04 17:29:41 -08:00