Skip to contentSkip to conversation

PCI: altera: Retrain link in rootport mode only

PATCH Superseded Ley Foon Tan 2 participants 3 messages Aug 15, 2016 – Aug 19, 2016 PCI

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: altera: Retrain link in rootport mode only

Altera PCIe IP can be configured as rootport or device and they might have same vendor ID. It will cause the system hang issue if Altera PCIe is in endpoint mode and work with other PCIe rootport that from other vendors. So, add the rootport mode checking in link retrain fixup function.

---
 drivers/pci/host/pcie-altera.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/pci/host/pcie-altera.c +3 -0
index 58eef99..6477738 100644
@@ -139,6 +139,9 @@ static void altera_pcie_retrain(struct pci_dev *dev)
 	u16 linkcap, linkstat;
 	struct altera_pcie *pcie = dev->bus->sysdata;
 
+	if (!pci_is_root_bus(dev->bus))
+		return;
+
 	if (!altera_pcie_link_is_up(pcie))
 		return;
 
Signature · 1 line
1.8.2.1
#1 lore raw
Quoted 15 lines · Ley Foon Tan

Altera PCIe IP can be configured as rootport or device and they might have same vendor ID. It will cause the system hang issue if Altera PCIe is in endpoint mode and work with other PCIe rootport that from other vendors. So, add the rootport mode checking in link retrain fixup function.

---
 drivers/pci/host/pcie-altera.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/pci/host/pcie-altera.c +0 -0
index 58eef99..6477738 100644

drivers/pci/host/pcie-altera.c static void altera_pcie_retrain(struct pci_dev *dev) · line 143

Quoted 5 lines
drivers/pci/host/pcie-altera.c +2 -0
@@ -139,6 +139,9 @@ static void altera_pcie_retrain(struct pci_dev *dev)
 	u16 linkcap, linkstat;
 	struct altera_pcie *pcie = dev->bus->sysdata;
 
+	if (!pci_is_root_bus(dev->bus))
+		return;

It seems like it would be more direct to check for "pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT"?

Quoted 6 lines
drivers/pci/host/pcie-altera.c +0 -0
 	if (!altera_pcie_link_is_up(pcie))
 		return;
 
Signature · 1 line
1.8.2.1
#2 lore raw
Quoted 20 lines · Bjorn Helgaas
Quoted 18 lines · Ley Foon Tan

Altera PCIe IP can be configured as rootport or device and they might have same vendor ID. It will cause the system hang issue if Altera PCIe is in endpoint mode and work with other PCIe rootport that from other vendors. So, add the rootport mode checking in link retrain fixup function.

---
 drivers/pci/host/pcie-altera.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/pci/host/pcie-altera.c +0 -0
index 58eef99..6477738 100644
@@ -139,6 +139,9 @@ static void altera_pcie_retrain(struct pci_dev *dev)
      u16 linkcap, linkstat;
      struct altera_pcie *pcie = dev->bus->sysdata;
 
Quoted 5 lines

drivers/pci/host/pcie-altera.c static void altera_pcie_retrain(struct pci_dev *dev) · line 143

Quoted 2 lines
drivers/pci/host/pcie-altera.c +2 -0
+     if (!pci_is_root_bus(dev->bus))
+             return;

It seems like it would be more direct to check for "pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT"?

Okay, will change in next version.

Quoted 7 lines
Quoted 7 lines
drivers/pci/host/pcie-altera.c +0 -1
      if (!altera_pcie_link_is_up(pcie))
              return;
 
--

1.8.2.1