Re: [PATCH] PCI: Allow PCI express root ports to find themselves
From: Thierry Reding Date: Thu, 17 Aug 2017 13:06:14 +0200 > From: Thierry Reding > > If the pci_find_pcie_root_port() function is called on a root port > itself, return the root port rather than NULL. > > This effectively reverts commit 0e405232871d6 ("PCI: fix oops when > try to find Root Port for a PCI device") which added an extra check > that would now be redundant. > > Fixes: a99b646afa8a ("PCI: Disable PCIe Relaxed Ordering if unsupported") > Fixes: c56d4450eb68 ("PCI: Turn off Request Attributes to avoid Chelsio T5 > Completion erratum") > Signed-off-by: Thierry Reding > --- > This applies on top of and was tested on next-20170817. > > Michael, it'd be great if you could test this one again to clarify > whether or not the fix that's already in Linus' tree is still needed, or > whether it's indeed obsoleted by this patch. Applied, thanks everyone.
Re: [PATCH] PCI: Allow PCI express root ports to find themselves
Thierry Reding writes: > From: Thierry Reding > > If the pci_find_pcie_root_port() function is called on a root port > itself, return the root port rather than NULL. > > This effectively reverts commit 0e405232871d6 ("PCI: fix oops when > try to find Root Port for a PCI device") which added an extra check > that would now be redundant. > > Fixes: a99b646afa8a ("PCI: Disable PCIe Relaxed Ordering if unsupported") > Fixes: c56d4450eb68 ("PCI: Turn off Request Attributes to avoid Chelsio T5 > Completion erratum") > Signed-off-by: Thierry Reding > --- > This applies on top of and was tested on next-20170817. > > Michael, it'd be great if you could test this one again to clarify > whether or not the fix that's already in Linus' tree is still needed, or > whether it's indeed obsoleted by this patch. This works fine for me, applied on top of Linus' tree (d33a2a914319). cheers
Re: [PATCH] PCI: Allow PCI express root ports to find themselves
Hi On 2017/8/17 19:06, Thierry Reding wrote: From: Thierry Reding If the pci_find_pcie_root_port() function is called on a root port itself, return the root port rather than NULL. This effectively reverts commit 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device") which added an extra check that would now be redundant. Fixes: a99b646afa8a ("PCI: Disable PCIe Relaxed Ordering if unsupported") Fixes: c56d4450eb68 ("PCI: Turn off Request Attributes to avoid Chelsio T5 Completion erratum") Signed-off-by: Thierry Reding Tested-by: Shawn Lin --- This applies on top of and was tested on next-20170817. Michael, it'd be great if you could test this one again to clarify whether or not the fix that's already in Linus' tree is still needed, or whether it's indeed obsoleted by this patch. drivers/pci/pci.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index b05c587e335a..dd56c1c05614 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -514,7 +514,7 @@ EXPORT_SYMBOL(pci_find_resource); */ struct pci_dev *pci_find_pcie_root_port(struct pci_dev *dev) { - struct pci_dev *bridge, *highest_pcie_bridge = NULL; + struct pci_dev *bridge, *highest_pcie_bridge = dev; bridge = pci_upstream_bridge(dev); while (bridge && pci_is_pcie(bridge)) { @@ -522,11 +522,10 @@ struct pci_dev *pci_find_pcie_root_port(struct pci_dev *dev) bridge = pci_upstream_bridge(bridge); } - if (highest_pcie_bridge && - pci_pcie_type(highest_pcie_bridge) == PCI_EXP_TYPE_ROOT_PORT) - return highest_pcie_bridge; + if (pci_pcie_type(highest_pcie_bridge) != PCI_EXP_TYPE_ROOT_PORT) + return NULL; - return NULL; + return highest_pcie_bridge; } EXPORT_SYMBOL(pci_find_pcie_root_port);
Re: [PATCH] PCI: Allow PCI express root ports to find themselves
On Thu, Aug 17, 2017 at 01:06:14PM +0200, Thierry Reding wrote: > From: Thierry Reding > > If the pci_find_pcie_root_port() function is called on a root port > itself, return the root port rather than NULL. > > This effectively reverts commit 0e405232871d6 ("PCI: fix oops when > try to find Root Port for a PCI device") which added an extra check > that would now be redundant. > > Fixes: a99b646afa8a ("PCI: Disable PCIe Relaxed Ordering if unsupported") > Fixes: c56d4450eb68 ("PCI: Turn off Request Attributes to avoid Chelsio T5 > Completion erratum") > Signed-off-by: Thierry Reding Acked-by: Bjorn Helgaas I *think* this should work for everybody, but I can't test it personally. > --- > This applies on top of and was tested on next-20170817. > > Michael, it'd be great if you could test this one again to clarify > whether or not the fix that's already in Linus' tree is still needed, or > whether it's indeed obsoleted by this patch. > > drivers/pci/pci.c | 9 - > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index b05c587e335a..dd56c1c05614 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -514,7 +514,7 @@ EXPORT_SYMBOL(pci_find_resource); > */ > struct pci_dev *pci_find_pcie_root_port(struct pci_dev *dev) > { > - struct pci_dev *bridge, *highest_pcie_bridge = NULL; > + struct pci_dev *bridge, *highest_pcie_bridge = dev; > > bridge = pci_upstream_bridge(dev); > while (bridge && pci_is_pcie(bridge)) { > @@ -522,11 +522,10 @@ struct pci_dev *pci_find_pcie_root_port(struct pci_dev > *dev) > bridge = pci_upstream_bridge(bridge); > } > > - if (highest_pcie_bridge && > - pci_pcie_type(highest_pcie_bridge) == PCI_EXP_TYPE_ROOT_PORT) > - return highest_pcie_bridge; > + if (pci_pcie_type(highest_pcie_bridge) != PCI_EXP_TYPE_ROOT_PORT) > + return NULL; > > - return NULL; > + return highest_pcie_bridge; > } > EXPORT_SYMBOL(pci_find_pcie_root_port); > > -- > 2.13.3 > > > ___ > linux-arm-kernel mailing list > linux-arm-ker...@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
[PATCH] PCI: Allow PCI express root ports to find themselves
From: Thierry Reding If the pci_find_pcie_root_port() function is called on a root port itself, return the root port rather than NULL. This effectively reverts commit 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device") which added an extra check that would now be redundant. Fixes: a99b646afa8a ("PCI: Disable PCIe Relaxed Ordering if unsupported") Fixes: c56d4450eb68 ("PCI: Turn off Request Attributes to avoid Chelsio T5 Completion erratum") Signed-off-by: Thierry Reding --- This applies on top of and was tested on next-20170817. Michael, it'd be great if you could test this one again to clarify whether or not the fix that's already in Linus' tree is still needed, or whether it's indeed obsoleted by this patch. drivers/pci/pci.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index b05c587e335a..dd56c1c05614 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -514,7 +514,7 @@ EXPORT_SYMBOL(pci_find_resource); */ struct pci_dev *pci_find_pcie_root_port(struct pci_dev *dev) { - struct pci_dev *bridge, *highest_pcie_bridge = NULL; + struct pci_dev *bridge, *highest_pcie_bridge = dev; bridge = pci_upstream_bridge(dev); while (bridge && pci_is_pcie(bridge)) { @@ -522,11 +522,10 @@ struct pci_dev *pci_find_pcie_root_port(struct pci_dev *dev) bridge = pci_upstream_bridge(bridge); } - if (highest_pcie_bridge && - pci_pcie_type(highest_pcie_bridge) == PCI_EXP_TYPE_ROOT_PORT) - return highest_pcie_bridge; + if (pci_pcie_type(highest_pcie_bridge) != PCI_EXP_TYPE_ROOT_PORT) + return NULL; - return NULL; + return highest_pcie_bridge; } EXPORT_SYMBOL(pci_find_pcie_root_port); -- 2.13.3