[PATCH] PCI: keystone: Don't enable BAR0 if link is not detected

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since the function dw_pcie_host_init() ignores the absence of link under
the assumption that link can come up later, it is possible that the
pci_host_probe(bridge) function is invoked even when no endpoint device
is connected. In such a situation, the ks_pcie_v3_65_add_bus() function
configures BAR0 when the link is not up, resulting in Completion Timeouts
during the MSI configuration performed later by the PCI Express Port driver
to setup AER, PME and other services. Thus, leave BAR0 disabled if link is
not yet detected when the ks_pcie_v3_65_add_bus() function is invoked.

Signed-off-by: Siddharth Vadapalli <s-vadapalli@xxxxxx>
---

Hello,

This patch is based on linux-next tagged next-20231011.

Regards,
Siddharth.

 drivers/pci/controller/dwc/pci-keystone.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
index 49aea6ce3e87..ac2ad112d616 100644
--- a/drivers/pci/controller/dwc/pci-keystone.c
+++ b/drivers/pci/controller/dwc/pci-keystone.c
@@ -459,7 +459,8 @@ static int ks_pcie_v3_65_add_bus(struct pci_bus *bus)
 	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
 	struct keystone_pcie *ks_pcie = to_keystone_pcie(pci);
 
-	if (!pci_is_root_bus(bus))
+	/* Don't enable BAR0 if link is not yet up at this point */
+	if (!pci_is_root_bus(bus) || !dw_pcie_link_up(pci))
 		return 0;
 
 	/* Configure and set up BAR0 */
-- 
2.34.1




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux