mirror-linux/drivers/pci/controller/dwc
Koichiro Den 8c746e2209 PCI: dwc: ep: Always clear IB maps on BAR update
dw_pcie_ep_set_bar() currently tears down existing inbound mappings only
when either the previous or the new struct pci_epf_bar uses submaps
(num_submap != 0). If both the old and new mappings are BAR Match Mode,
reprogramming the same ATU index is sufficient, so no explicit teardown
was needed.

However, some callers may reuse the same struct pci_epf_bar instance and
update it in place before calling set_bar() again. In that case
ep_func->epf_bar[bar] and the passed-in epf_bar can point to the same
object, so we cannot reliably distinguish BAR Match Mode -> BAR Match Mode
from Address Match Mode -> BAR Match Mode. As a result, the conditional
teardown based on num_submap becomes unreliable and existing inbound maps
may be left active.

Call dw_pcie_ep_clear_ib_maps() unconditionally before reprogramming the
BAR so that in-place updates are handled correctly.

This introduces a behavioral change in a corner case: if a BAR
reprogramming attempt fails (especially for the long-standing BAR Match
Mode -> BAR Match Mode update case), the previously programmed inbound
mapping will already have been torn down. This should be acceptable, since
the caller observes the error and should not use the BAR for any real
transactions in that case.

While at it, document that the existing update parameter check is
best-effort for in-place updates.

Fixes: cc839bef77 ("PCI: dwc: ep: Support BAR subrange inbound mapping via Address Match Mode iATU")
Signed-off-by: Koichiro Den <den@valinux.co.jp>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20260202145407.503348-3-den@valinux.co.jp
2026-02-19 15:34:19 -06:00
..
Kconfig PCI: dwc: tegra194: Broaden architecture dependency 2026-01-08 09:55:00 +05:30
Makefile Merge branch 'pci/controller/spacemit-k1' 2025-12-03 14:18:44 -06:00
pci-dra7xx.c PCI: dwc: Advertise dynamic inbound mapping support 2026-01-28 19:16:06 +05:30
pci-exynos.c PCI: dwc: Add support for ELBI resource mapping 2025-09-25 18:33:37 +05:30
pci-imx6.c Merge branch 'pci/controller/dwc-imx6' 2026-02-06 17:09:35 -06:00
pci-keystone.c PCI: dwc: Advertise dynamic inbound mapping support 2026-01-28 19:16:06 +05:30
pci-layerscape-ep.c
pci-layerscape.c
pci-meson.c PCI: meson: Report that link is up while in ASPM L0s and L1 states 2026-01-05 11:20:29 -06:00
pcie-al.c PCI: dwc: Support ECAM mechanism by enabling iATU 'CFG Shift Feature' 2025-09-25 18:34:01 +05:30
pcie-amd-mdb.c PCI: amd-mdb: Add support for PCIe RP PERST# signal handling 2025-08-11 16:09:45 +05:30
pcie-armada8k.c
pcie-artpec6.c PCI: dwc: Advertise dynamic inbound mapping support 2026-01-28 19:16:06 +05:30
pcie-bt1.c
pcie-designware-debugfs.c PCI: dwc: Rename and move ltssm_status_string() to pcie-designware.c 2026-01-21 14:45:19 +05:30
pcie-designware-ep.c PCI: dwc: ep: Always clear IB maps on BAR update 2026-02-19 15:34:19 -06:00
pcie-designware-host.c pci-v7.0-changes 2026-02-11 17:20:38 -08:00
pcie-designware-plat.c PCI: dwc: Advertise dynamic inbound mapping support 2026-01-28 19:16:06 +05:30
pcie-designware.c PCI: dwc: Fix missing iATU setup when ECAM is enabled 2026-02-05 18:23:30 +05:30
pcie-designware.h pci-v7.0-changes 2026-02-11 17:20:38 -08:00
pcie-dw-rockchip.c Merge branch 'pci/controller/dwc-rockchip' 2026-02-06 17:09:47 -06:00
pcie-fu740.c
pcie-hisi.c
pcie-histb.c
pcie-intel-gw.c
pcie-keembay.c PCI: dwc: Advertise dynamic inbound mapping support 2026-01-28 19:16:06 +05:30
pcie-kirin.c
pcie-nxp-s32g.c PCI: s32g: Skip Root Port removal during success 2026-02-03 18:26:27 +05:30
pcie-qcom-common.c PCI: qcom: Fix macro typo for CURSOR 2025-09-04 22:25:22 +05:30
pcie-qcom-common.h PCI: qcom: Add equalization settings for 8.0 GT/s and 32.0 GT/s 2025-09-04 22:24:04 +05:30
pcie-qcom-ep.c Merge branch 'pci/controller/dwc-qcom-ep' 2026-02-06 17:09:47 -06:00
pcie-qcom.c pci-v7.0-changes 2026-02-11 17:20:38 -08:00
pcie-rcar-gen4.c PCI: dwc: Advertise dynamic inbound mapping support 2026-01-28 19:16:06 +05:30
pcie-sophgo.c PCI: sophgo: Disable L0s and L1 on Sophgo 2044 PCIe Root Ports 2026-01-13 20:17:43 +05:30
pcie-spacemit-k1.c PCI: spacemit: Add SpacemiT PCIe host driver 2025-11-17 18:59:03 +05:30
pcie-spear13xx.c
pcie-stm32-ep.c PCI: dwc: Advertise dynamic inbound mapping support 2026-01-28 19:16:06 +05:30
pcie-stm32.c PCI: stm32: Don't use 'proxy' headers 2025-11-17 14:38:52 -06:00
pcie-stm32.h PCI: stm32: Don't use 'proxy' headers 2025-11-17 14:38:52 -06:00
pcie-tegra194-acpi.c
pcie-tegra194.c PCI: dwc: Advertise dynamic inbound mapping support 2026-01-28 19:16:06 +05:30
pcie-uniphier-ep.c PCI: dwc: Advertise dynamic inbound mapping support 2026-01-28 19:16:06 +05:30
pcie-uniphier.c pci-v6.16-changes 2025-06-04 11:26:17 -07:00
pcie-visconti.c