linux/drivers/pci/controller
Niklas Cassel 1f17a94311 PCI: tegra194: Reset BARs when running in PCIe endpoint mode
commit 42f9c66a6d upstream.

Tegra already defines all BARs except BAR0 as BAR_RESERVED.  This is
sufficient for pci-epf-test to not allocate backing memory and to not call
set_bar() for those BARs. However, marking a BAR as BAR_RESERVED does not
mean that the BAR gets disabled.

The host side driver, pci_endpoint_test, simply does an ioremap for all
enabled BARs and will run tests against all enabled BARs, so it will run
tests against the BARs marked as BAR_RESERVED.

After running the BAR tests (which will write to all enabled BARs), the
inbound address translation is broken. This is because the tegra controller
exposes the ATU Port Logic Structure in BAR4, so when BAR4 is written, the
inbound address translation settings get overwritten.

To avoid this, implement the dw_pcie_ep_ops .init() callback and start off
by disabling all BARs (pci-epf-test will later enable/configure BARs that
are not defined as BAR_RESERVED).

This matches the behavior of other PCIe endpoint drivers: dra7xx, imx6,
layerscape-ep, artpec6, dw-rockchip, qcom-ep, rcar-gen4, and uniphier-ep.

With this, the PCI endpoint kselftest test case CONSECUTIVE_BAR_TEST (which
was specifically made to detect address translation issues) passes.

Fixes: c57247f940 ("PCI: tegra: Add support for PCIe endpoint mode in Tegra194")
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20250922140822.519796-7-cassel@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-10-19 16:33:56 +02:00
..
cadence PCI: j721e: Fix programming sequence of "strap" settings 2025-10-19 16:33:55 +02:00
dwc PCI: tegra194: Reset BARs when running in PCIe endpoint mode 2025-10-19 16:33:56 +02:00
mobiveil PCI: mobiveil: Silence 'set affinity failed' warning 2024-07-29 12:46:35 -05:00
plda PCI: Rename PCIE_RESET_CONFIG_DEVICE_WAIT_MS to PCIE_RESET_CONFIG_WAIT_MS 2025-09-04 15:31:55 +02:00
Kconfig PCI: mediatek-gen3: Add Airoha EN7581 support 2024-09-03 13:37:41 +00:00
Makefile PCI: microchip: Move pcie-microchip-host.c to PLDA directory 2024-05-28 11:15:28 -05:00
pci-aardvark.c Merge branch 'pci/controller/affinity' 2024-09-19 14:25:28 -05:00
pci-ftpci100.c PCI: Explicitly include correct DT includes 2023-07-18 14:33:17 -05:00
pci-host-common.c Merge branch 'pci/misc' 2024-07-19 10:10:33 -05:00
pci-host-generic.c PCI: controller: Add missing MODULE_DESCRIPTION() macros 2024-07-08 08:36:14 +00:00
pci-hyperv-intf.c PCI: hv: Add a Hyper-V PCI interface driver for software backchannel interface 2019-08-22 00:25:12 -07:00
pci-hyperv.c PCI: hv: Return zero, not garbage, when reading PCI_INTERRUPT_PIN 2024-07-03 21:11:14 +00:00
pci-ixp4xx.c PCI: Explicitly include correct DT includes 2023-07-18 14:33:17 -05:00
pci-loongson.c PCI: loongson: Enable MSI in LS7A Root Complex 2024-07-19 10:07:01 -05:00
pci-mvebu.c PCI: mvebu: Use FIELD_PREP() with Link Width 2023-10-10 15:00:52 -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-10-19 16:33:54 +02:00
pci-thunder-ecam.c PCI: thunder: Drop error data fabrication when config read fails 2021-11-18 13:39:32 -06:00
pci-thunder-pem.c PCI: thunder: Drop error data fabrication when config read fails 2021-11-18 13:39:32 -06: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: Use devm_platform_get_and_ioremap_resource() 2023-07-13 18:12:36 +00:00
pci-xgene.c PCI: Rename CRS Completion Status to RRS 2024-09-10 19:52:30 -05:00
pcie-altera-msi.c PCI: altera-msi: Silence 'set affinity failed' warning 2024-07-29 12:46:35 -05:00
pcie-altera.c PCI: altera: Replace TLP_REQ_ID() with macro PCI_DEVID() 2024-09-06 06:32:23 +00:00
pcie-apple.c PCI: apple: Set only available ports up 2025-07-06 11:01:37 +02:00
pcie-brcmstb.c PCI: brcmstb: Add a softdep to MIP MSI-X driver 2025-05-29 11:02:34 +02:00
pcie-hisi-error.c PCI: hisi-error: Convert to platform remove callback returning void 2023-06-24 14:12:13 +00: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: Use of_property_read_bool() for boolean properties 2023-07-13 18:09:24 +00:00
pcie-iproc-platform.c PCI: iproc: Fix -Wvoid-pointer-to-enum-cast warning 2024-01-06 08:06:50 +00:00
pcie-iproc.c PCI: Rename CRS Completion Status to RRS 2024-09-10 19:52:30 -05: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 Merge branch 'pci/controller/mediatek-gen3' 2024-09-19 14:25:32 -05:00
pcie-mediatek.c Merge branch 'pci/controller/mediatek' 2024-09-19 14:25:31 -05:00
pcie-mt7621.c PCI: controller: Add missing MODULE_DESCRIPTION() macros 2024-07-08 08:36:14 +00:00
pcie-rcar-ep.c PCI: rcar-ep: Fix incorrect variable used when calling devm_request_mem_region() 2025-02-08 09:57:55 +01:00
pcie-rcar-host.c PCI: rcar-host: Convert struct rcar_msi mask_lock into raw spinlock 2025-10-19 16:33:56 +02:00
pcie-rcar.c PCI: rcar: Fix calculating mask for PCIEPAMR register 2020-05-11 11:29:48 +01:00
pcie-rcar.h PCI: rcar: Avoid defines prefixed with CONFIG 2023-03-10 13:34:27 +01:00
pcie-rockchip-ep.c PCI: rockchip-ep: Fix address translation unit programming 2024-12-09 10:41:09 +01:00
pcie-rockchip-host.c PCI: rockchip: Set Target Link Speed to 5.0 GT/s before retraining 2025-08-28 16:31:07 +02:00
pcie-rockchip.c PCI: rockchip: Use GPIOD_OUT_LOW flag while requesting ep_gpio 2024-07-09 18:28:33 -05:00
pcie-rockchip.h PCI: rockchip: Use standard PCIe definitions 2025-08-28 16:31:07 +02: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: xilinx-cpm: Fix IRQ domain leak in error path of probe 2025-04-10 14:39:16 +02:00
pcie-xilinx-dma-pl.c Merge branch 'pci/controller/xilinx' 2024-09-19 14:25:33 -05:00
pcie-xilinx-nwl.c PCI: xilinx-nwl: Fix ECAM programming 2025-10-19 16:33:54 +02:00
pcie-xilinx.c PCI: xilinx: Silence 'set affinity failed' warning 2024-08-06 12:52:17 -05:00
vmd.c PCI: vmd: Disable MSI remapping bypass under Xen 2025-05-29 11:02:09 +02:00