Skip to content

Commit 9e9ec8d

Browse files
kishonkwilczynski
authored andcommitted
PCI: keystone: Add link up check to ks_pcie_other_map_bus()
K2G forwards the error triggered by a link-down state (e.g., no connected endpoint device) on the system bus for PCI configuration transactions; these errors are reported as an SError at system level, which is fatal and hangs the system. So, apply fix similar to how it was done in the DesignWare Core driver commit 15b2390 ("PCI: dwc: Add link up check in dw_child_pcie_ops.map_bus()"). Fixes: 10a797c ("PCI: dwc: keystone: Use pci_ops for config space accessors") Link: https://lore.kernel.org/r/20240524105714.191642-3-s-vadapalli@ti.com Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com> [kwilczynski: commit log, added tag for stable releases] Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org> Cc: stable@vger.kernel.org
1 parent 5a938ed commit 9e9ec8d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/pci/controller/dwc/pci-keystone.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,17 @@ static void __iomem *ks_pcie_other_map_bus(struct pci_bus *bus,
455455
struct keystone_pcie *ks_pcie = to_keystone_pcie(pci);
456456
u32 reg;
457457

458+
/*
459+
* Checking whether the link is up here is a last line of defense
460+
* against platforms that forward errors on the system bus as
461+
* SError upon PCI configuration transactions issued when the link
462+
* is down. This check is racy by definition and does not stop
463+
* the system from triggering an SError if the link goes down
464+
* after this check is performed.
465+
*/
466+
if (!dw_pcie_link_up(pci))
467+
return NULL;
468+
458469
reg = CFG_BUS(bus->number) | CFG_DEVICE(PCI_SLOT(devfn)) |
459470
CFG_FUNC(PCI_FUNC(devfn));
460471
if (!pci_is_root_bus(bus->parent))

0 commit comments

Comments
 (0)