diff mbox

PCI: altera: Retrain link in rootport mode only

Message ID 1471250179-24198-1-git-send-email-lftan@altera.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Ley Foon Tan Aug. 15, 2016, 8:36 a.m. UTC
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.

Signed-off-by: Ley Foon Tan <lftan@altera.com>
---
 drivers/pci/host/pcie-altera.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Bjorn Helgaas Aug. 18, 2016, 8:18 p.m. UTC | #1
On Mon, Aug 15, 2016 at 04:36:19PM +0800, Ley Foon Tan wrote:
> 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.
> 
> Signed-off-by: Ley Foon Tan <lftan@altera.com>
> ---
>  drivers/pci/host/pcie-altera.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c
> index 58eef99..6477738 100644
> --- a/drivers/pci/host/pcie-altera.c
> +++ b/drivers/pci/host/pcie-altera.c
> @@ -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"?

>  	if (!altera_pcie_link_is_up(pcie))
>  		return;
>  
> -- 
> 1.8.2.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ley Foon Tan Aug. 19, 2016, 7:54 a.m. UTC | #2
On Fri, Aug 19, 2016 at 4:18 AM, Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> On Mon, Aug 15, 2016 at 04:36:19PM +0800, Ley Foon Tan wrote:
> > 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.
> >
> > Signed-off-by: Ley Foon Tan <lftan@altera.com>
> > ---
> >  drivers/pci/host/pcie-altera.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c
> > index 58eef99..6477738 100644
> > --- a/drivers/pci/host/pcie-altera.c
> > +++ b/drivers/pci/host/pcie-altera.c
> > @@ -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"?
Okay, will change in next version.

>
> >       if (!altera_pcie_link_is_up(pcie))
> >               return;
> >
> > --
> > 1.8.2.1
> >
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c
index 58eef99..6477738 100644
--- a/drivers/pci/host/pcie-altera.c
+++ b/drivers/pci/host/pcie-altera.c
@@ -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;