Skip to content

Commit d0c2cb0

Browse files
kishongregkh
authored andcommitted
PCI: keystone: Add link up check to ks_pcie_other_map_bus()
commit 9e9ec8d upstream. 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/[email protected] Signed-off-by: Kishon Vijay Abraham I <[email protected]> Signed-off-by: Siddharth Vadapalli <[email protected]> [kwilczynski: commit log, added tag for stable releases] Signed-off-by: Krzysztof Wilczyński <[email protected]> Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 481a1e8 commit d0c2cb0

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
@@ -465,6 +465,17 @@ static void __iomem *ks_pcie_other_map_bus(struct pci_bus *bus,
465465
struct keystone_pcie *ks_pcie = to_keystone_pcie(pci);
466466
u32 reg;
467467

468+
/*
469+
* Checking whether the link is up here is a last line of defense
470+
* against platforms that forward errors on the system bus as
471+
* SError upon PCI configuration transactions issued when the link
472+
* is down. This check is racy by definition and does not stop
473+
* the system from triggering an SError if the link goes down
474+
* after this check is performed.
475+
*/
476+
if (!dw_pcie_link_up(pci))
477+
return NULL;
478+
468479
reg = CFG_BUS(bus->number) | CFG_DEVICE(PCI_SLOT(devfn)) |
469480
CFG_FUNC(PCI_FUNC(devfn));
470481
if (!pci_is_root_bus(bus->parent))

0 commit comments

Comments
 (0)