* [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port()
@ 2017-08-17 2:25 ` Ding Tianhong
0 siblings, 0 replies; 27+ messages in thread
From: Ding Tianhong @ 2017-08-17 2:25 UTC (permalink / raw)
To: leedom, ashok.raj, bhelgaas, helgaas, werner, ganeshgr,
asit.k.mallick, patrick.j.cramer, Suravee.Suthikulpanit, Bob.Shaw,
l.stach, amira, gabriele.paoloni, David.Laight, jeffrey.t.kirsher,
catalin.marinas, will.deacon, mark.rutland, robin.murphy, davem,
alexander.duyck, eric.dumazet, linux-arm-kernel, netdev,
linux-pci, linux-kernel, linuxarm
Cc: Ding Tianhong, Thierry Reding
The pci_find_pcie_root_port() would return NULL if the given
dev is already a Root Port, it looks like unfriendly to the
PCIe Root Port device, Thierry and Bjorn suggest to let this
function return the given dev under this circumstances.
Fixes: 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device")
Suggested-by: Thierry Reding <thierry.reding@gmail.com>
Suggested-by: Bjorn Helgaas <helgaas@kernel.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
drivers/pci/pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 7e2022f..352bb53 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -514,7 +514,7 @@ struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res)
*/
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)) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 27+ messages in thread* [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port() @ 2017-08-17 2:25 ` Ding Tianhong 0 siblings, 0 replies; 27+ messages in thread From: Ding Tianhong @ 2017-08-17 2:25 UTC (permalink / raw) To: linux-arm-kernel The pci_find_pcie_root_port() would return NULL if the given dev is already a Root Port, it looks like unfriendly to the PCIe Root Port device, Thierry and Bjorn suggest to let this function return the given dev under this circumstances. Fixes: 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device") Suggested-by: Thierry Reding <thierry.reding@gmail.com> Suggested-by: Bjorn Helgaas <helgaas@kernel.org> Signed-off-by: Thierry Reding <thierry.reding@gmail.com> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> --- drivers/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 7e2022f..352bb53 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -514,7 +514,7 @@ struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res) */ 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)) { -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port() 2017-08-17 2:25 ` Ding Tianhong @ 2017-08-17 2:42 ` David Miller -1 siblings, 0 replies; 27+ messages in thread From: David Miller @ 2017-08-17 2:42 UTC (permalink / raw) To: dingtianhong Cc: leedom, ashok.raj, bhelgaas, helgaas, werner, ganeshgr, asit.k.mallick, patrick.j.cramer, Suravee.Suthikulpanit, Bob.Shaw, l.stach, amira, gabriele.paoloni, David.Laight, jeffrey.t.kirsher, catalin.marinas, will.deacon, mark.rutland, robin.murphy, alexander.duyck, eric.dumazet, linux-arm-kernel, netdev, linux-pci, linux-kernel, linuxarm, thierry.reding From: Ding Tianhong <dingtianhong@huawei.com> Date: Thu, 17 Aug 2017 10:25:30 +0800 > The pci_find_pcie_root_port() would return NULL if the given > dev is already a Root Port, it looks like unfriendly to the > PCIe Root Port device, Thierry and Bjorn suggest to let this > function return the given dev under this circumstances. > > Fixes: 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device") > Suggested-by: Thierry Reding <thierry.reding@gmail.com> > Suggested-by: Bjorn Helgaas <helgaas@kernel.org> > Signed-off-by: Thierry Reding <thierry.reding@gmail.com> > Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> Bjorn, please review and ACK so Linus doesn't rip my head off again :-) Thanks. ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port() @ 2017-08-17 2:42 ` David Miller 0 siblings, 0 replies; 27+ messages in thread From: David Miller @ 2017-08-17 2:42 UTC (permalink / raw) To: linux-arm-kernel From: Ding Tianhong <dingtianhong@huawei.com> Date: Thu, 17 Aug 2017 10:25:30 +0800 > The pci_find_pcie_root_port() would return NULL if the given > dev is already a Root Port, it looks like unfriendly to the > PCIe Root Port device, Thierry and Bjorn suggest to let this > function return the given dev under this circumstances. > > Fixes: 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device") > Suggested-by: Thierry Reding <thierry.reding@gmail.com> > Suggested-by: Bjorn Helgaas <helgaas@kernel.org> > Signed-off-by: Thierry Reding <thierry.reding@gmail.com> > Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> Bjorn, please review and ACK so Linus doesn't rip my head off again :-) Thanks. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port() 2017-08-17 2:25 ` Ding Tianhong @ 2017-08-17 10:51 ` Thierry Reding -1 siblings, 0 replies; 27+ messages in thread From: Thierry Reding @ 2017-08-17 10:51 UTC (permalink / raw) To: Ding Tianhong Cc: leedom, ashok.raj, bhelgaas, helgaas, werner, ganeshgr, asit.k.mallick, patrick.j.cramer, Suravee.Suthikulpanit, Bob.Shaw, l.stach, amira, gabriele.paoloni, David.Laight, jeffrey.t.kirsher, catalin.marinas, will.deacon, mark.rutland, robin.murphy, davem, alexander.duyck, eric.dumazet, linux-arm-kernel, netdev, linux-pci, linux-kernel, linuxarm [-- Attachment #1: Type: text/plain, Size: 1589 bytes --] On Thu, Aug 17, 2017 at 10:25:30AM +0800, Ding Tianhong wrote: > The pci_find_pcie_root_port() would return NULL if the given > dev is already a Root Port, it looks like unfriendly to the > PCIe Root Port device, Thierry and Bjorn suggest to let this > function return the given dev under this circumstances. > > Fixes: 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device") > Suggested-by: Thierry Reding <thierry.reding@gmail.com> > Suggested-by: Bjorn Helgaas <helgaas@kernel.org> > Signed-off-by: Thierry Reding <thierry.reding@gmail.com> > Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> > --- > drivers/pci/pci.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index 7e2022f..352bb53 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -514,7 +514,7 @@ struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res) > */ > 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)) { I think this should actually be this change on top of a revert of commit 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device"). After the above change, the previous fix will have a redundant check because highest_pcie_bridge will never be NULL. Let me send out that version to clarify what I mean. Thierry [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port() @ 2017-08-17 10:51 ` Thierry Reding 0 siblings, 0 replies; 27+ messages in thread From: Thierry Reding @ 2017-08-17 10:51 UTC (permalink / raw) To: linux-arm-kernel On Thu, Aug 17, 2017 at 10:25:30AM +0800, Ding Tianhong wrote: > The pci_find_pcie_root_port() would return NULL if the given > dev is already a Root Port, it looks like unfriendly to the > PCIe Root Port device, Thierry and Bjorn suggest to let this > function return the given dev under this circumstances. > > Fixes: 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device") > Suggested-by: Thierry Reding <thierry.reding@gmail.com> > Suggested-by: Bjorn Helgaas <helgaas@kernel.org> > Signed-off-by: Thierry Reding <thierry.reding@gmail.com> > Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> > --- > drivers/pci/pci.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index 7e2022f..352bb53 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -514,7 +514,7 @@ struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res) > */ > 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)) { I think this should actually be this change on top of a revert of commit 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device"). After the above change, the previous fix will have a redundant check because highest_pcie_bridge will never be NULL. Let me send out that version to clarify what I mean. Thierry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170817/f8503237/attachment.sig> ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port() 2017-08-17 10:51 ` Thierry Reding @ 2017-08-17 12:40 ` Ding Tianhong -1 siblings, 0 replies; 27+ messages in thread From: Ding Tianhong @ 2017-08-17 12:40 UTC (permalink / raw) To: Thierry Reding Cc: leedom, ashok.raj, bhelgaas, helgaas, werner, ganeshgr, asit.k.mallick, patrick.j.cramer, Suravee.Suthikulpanit, Bob.Shaw, l.stach, amira, gabriele.paoloni, David.Laight, jeffrey.t.kirsher, catalin.marinas, will.deacon, mark.rutland, robin.murphy, davem, alexander.duyck, eric.dumazet, linux-arm-kernel, netdev, linux-pci, linux-kernel, linuxarm On 2017/8/17 18:51, Thierry Reding wrote: > On Thu, Aug 17, 2017 at 10:25:30AM +0800, Ding Tianhong wrote: >> The pci_find_pcie_root_port() would return NULL if the given >> dev is already a Root Port, it looks like unfriendly to the >> PCIe Root Port device, Thierry and Bjorn suggest to let this >> function return the given dev under this circumstances. >> >> Fixes: 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device") >> Suggested-by: Thierry Reding <thierry.reding@gmail.com> >> Suggested-by: Bjorn Helgaas <helgaas@kernel.org> >> Signed-off-by: Thierry Reding <thierry.reding@gmail.com> >> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> >> --- >> drivers/pci/pci.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c >> index 7e2022f..352bb53 100644 >> --- a/drivers/pci/pci.c >> +++ b/drivers/pci/pci.c >> @@ -514,7 +514,7 @@ struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res) >> */ >> 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)) { > > I think this should actually be this change on top of a revert of commit > 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI > device"). After the above change, the previous fix will have a redundant > check because highest_pcie_bridge will never be NULL. > > Let me send out that version to clarify what I mean. > Hi Thierry: The patch ("PCI: fix oops when try to find Root Port for a PCI device") has been merge to the linus mainline tree before you found this deficiencies.... Regards Tianhong > Thierry > ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port() @ 2017-08-17 12:40 ` Ding Tianhong 0 siblings, 0 replies; 27+ messages in thread From: Ding Tianhong @ 2017-08-17 12:40 UTC (permalink / raw) To: linux-arm-kernel On 2017/8/17 18:51, Thierry Reding wrote: > On Thu, Aug 17, 2017 at 10:25:30AM +0800, Ding Tianhong wrote: >> The pci_find_pcie_root_port() would return NULL if the given >> dev is already a Root Port, it looks like unfriendly to the >> PCIe Root Port device, Thierry and Bjorn suggest to let this >> function return the given dev under this circumstances. >> >> Fixes: 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device") >> Suggested-by: Thierry Reding <thierry.reding@gmail.com> >> Suggested-by: Bjorn Helgaas <helgaas@kernel.org> >> Signed-off-by: Thierry Reding <thierry.reding@gmail.com> >> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> >> --- >> drivers/pci/pci.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c >> index 7e2022f..352bb53 100644 >> --- a/drivers/pci/pci.c >> +++ b/drivers/pci/pci.c >> @@ -514,7 +514,7 @@ struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res) >> */ >> 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)) { > > I think this should actually be this change on top of a revert of commit > 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI > device"). After the above change, the previous fix will have a redundant > check because highest_pcie_bridge will never be NULL. > > Let me send out that version to clarify what I mean. > Hi Thierry: The patch ("PCI: fix oops when try to find Root Port for a PCI device") has been merge to the linus mainline tree before you found this deficiencies.... Regards Tianhong > Thierry > ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port() 2017-08-17 12:40 ` Ding Tianhong @ 2017-08-17 13:30 ` Thierry Reding -1 siblings, 0 replies; 27+ messages in thread From: Thierry Reding @ 2017-08-17 13:30 UTC (permalink / raw) To: Ding Tianhong Cc: leedom, ashok.raj, bhelgaas, helgaas, werner, ganeshgr, asit.k.mallick, patrick.j.cramer, Suravee.Suthikulpanit, Bob.Shaw, l.stach, amira, gabriele.paoloni, David.Laight, jeffrey.t.kirsher, catalin.marinas, will.deacon, mark.rutland, robin.murphy, davem, alexander.duyck, eric.dumazet, linux-arm-kernel, netdev, linux-pci, linux-kernel, linuxarm [-- Attachment #1: Type: text/plain, Size: 2188 bytes --] On Thu, Aug 17, 2017 at 08:40:16PM +0800, Ding Tianhong wrote: > > > On 2017/8/17 18:51, Thierry Reding wrote: > > On Thu, Aug 17, 2017 at 10:25:30AM +0800, Ding Tianhong wrote: > >> The pci_find_pcie_root_port() would return NULL if the given > >> dev is already a Root Port, it looks like unfriendly to the > >> PCIe Root Port device, Thierry and Bjorn suggest to let this > >> function return the given dev under this circumstances. > >> > >> Fixes: 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device") > >> Suggested-by: Thierry Reding <thierry.reding@gmail.com> > >> Suggested-by: Bjorn Helgaas <helgaas@kernel.org> > >> Signed-off-by: Thierry Reding <thierry.reding@gmail.com> > >> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> > >> --- > >> drivers/pci/pci.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > >> index 7e2022f..352bb53 100644 > >> --- a/drivers/pci/pci.c > >> +++ b/drivers/pci/pci.c > >> @@ -514,7 +514,7 @@ struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res) > >> */ > >> 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)) { > > > > I think this should actually be this change on top of a revert of commit > > 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI > > device"). After the above change, the previous fix will have a redundant > > check because highest_pcie_bridge will never be NULL. > > > > Let me send out that version to clarify what I mean. > > > > Hi Thierry: > > The patch ("PCI: fix oops when try to find Root Port for a PCI device") > has been merge to the linus mainline tree before you found this deficiencies.... I understand that. I'm just saying that there's no point keeping that change around because it no longer makes sense after we initialize the highest_pcie_bridge variable to dev. Thierry [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port() @ 2017-08-17 13:30 ` Thierry Reding 0 siblings, 0 replies; 27+ messages in thread From: Thierry Reding @ 2017-08-17 13:30 UTC (permalink / raw) To: linux-arm-kernel On Thu, Aug 17, 2017 at 08:40:16PM +0800, Ding Tianhong wrote: > > > On 2017/8/17 18:51, Thierry Reding wrote: > > On Thu, Aug 17, 2017 at 10:25:30AM +0800, Ding Tianhong wrote: > >> The pci_find_pcie_root_port() would return NULL if the given > >> dev is already a Root Port, it looks like unfriendly to the > >> PCIe Root Port device, Thierry and Bjorn suggest to let this > >> function return the given dev under this circumstances. > >> > >> Fixes: 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device") > >> Suggested-by: Thierry Reding <thierry.reding@gmail.com> > >> Suggested-by: Bjorn Helgaas <helgaas@kernel.org> > >> Signed-off-by: Thierry Reding <thierry.reding@gmail.com> > >> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> > >> --- > >> drivers/pci/pci.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > >> index 7e2022f..352bb53 100644 > >> --- a/drivers/pci/pci.c > >> +++ b/drivers/pci/pci.c > >> @@ -514,7 +514,7 @@ struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res) > >> */ > >> 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)) { > > > > I think this should actually be this change on top of a revert of commit > > 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI > > device"). After the above change, the previous fix will have a redundant > > check because highest_pcie_bridge will never be NULL. > > > > Let me send out that version to clarify what I mean. > > > > Hi Thierry: > > The patch ("PCI: fix oops when try to find Root Port for a PCI device") > has been merge to the linus mainline tree before you found this deficiencies.... I understand that. I'm just saying that there's no point keeping that change around because it no longer makes sense after we initialize the highest_pcie_bridge variable to dev. Thierry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170817/46f7dea2/attachment-0001.sig> ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port() 2017-08-17 13:30 ` Thierry Reding (?) @ 2017-08-17 13:38 ` Ding Tianhong -1 siblings, 0 replies; 27+ messages in thread From: Ding Tianhong @ 2017-08-17 13:38 UTC (permalink / raw) To: Thierry Reding Cc: leedom, ashok.raj, bhelgaas, helgaas, werner, ganeshgr, asit.k.mallick, patrick.j.cramer, Suravee.Suthikulpanit, Bob.Shaw, l.stach, amira, gabriele.paoloni, David.Laight, jeffrey.t.kirsher, catalin.marinas, will.deacon, mark.rutland, robin.murphy, davem, alexander.duyck, eric.dumazet, linux-arm-kernel, netdev, linux-pci, linux-kernel, linuxarm On 2017/8/17 21:30, Thierry Reding wrote: > On Thu, Aug 17, 2017 at 08:40:16PM +0800, Ding Tianhong wrote: >> >> >> On 2017/8/17 18:51, Thierry Reding wrote: >>> On Thu, Aug 17, 2017 at 10:25:30AM +0800, Ding Tianhong wrote: >>>> The pci_find_pcie_root_port() would return NULL if the given >>>> dev is already a Root Port, it looks like unfriendly to the >>>> PCIe Root Port device, Thierry and Bjorn suggest to let this >>>> function return the given dev under this circumstances. >>>> >>>> Fixes: 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device") >>>> Suggested-by: Thierry Reding <thierry.reding@gmail.com> >>>> Suggested-by: Bjorn Helgaas <helgaas@kernel.org> >>>> Signed-off-by: Thierry Reding <thierry.reding@gmail.com> >>>> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> >>>> --- >>>> drivers/pci/pci.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c >>>> index 7e2022f..352bb53 100644 >>>> --- a/drivers/pci/pci.c >>>> +++ b/drivers/pci/pci.c >>>> @@ -514,7 +514,7 @@ struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res) >>>> */ >>>> 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)) { >>> >>> I think this should actually be this change on top of a revert of commit >>> 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI >>> device"). After the above change, the previous fix will have a redundant >>> check because highest_pcie_bridge will never be NULL. >>> >>> Let me send out that version to clarify what I mean. >>> >> >> Hi Thierry: >> >> The patch ("PCI: fix oops when try to find Root Port for a PCI device") >> has been merge to the linus mainline tree before you found this deficiencies.... > > I understand that. I'm just saying that there's no point keeping that > change around because it no longer makes sense after we initialize the > highest_pcie_bridge variable to dev. > Ok, NO problem.:) > Thierry > ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port() @ 2017-08-17 13:38 ` Ding Tianhong 0 siblings, 0 replies; 27+ messages in thread From: Ding Tianhong @ 2017-08-17 13:38 UTC (permalink / raw) To: Thierry Reding Cc: mark.rutland, gabriele.paoloni, asit.k.mallick, catalin.marinas, will.deacon, linuxarm, alexander.duyck, ashok.raj, eric.dumazet, helgaas, jeffrey.t.kirsher, linux-pci, ganeshgr, Bob.Shaw, leedom, patrick.j.cramer, bhelgaas, werner, linux-arm-kernel, amira, netdev, linux-kernel, David.Laight, Suravee.Suthikulpanit, robin.murphy, davem, l.stach On 2017/8/17 21:30, Thierry Reding wrote: > On Thu, Aug 17, 2017 at 08:40:16PM +0800, Ding Tianhong wrote: >> >> >> On 2017/8/17 18:51, Thierry Reding wrote: >>> On Thu, Aug 17, 2017 at 10:25:30AM +0800, Ding Tianhong wrote: >>>> The pci_find_pcie_root_port() would return NULL if the given >>>> dev is already a Root Port, it looks like unfriendly to the >>>> PCIe Root Port device, Thierry and Bjorn suggest to let this >>>> function return the given dev under this circumstances. >>>> >>>> Fixes: 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device") >>>> Suggested-by: Thierry Reding <thierry.reding@gmail.com> >>>> Suggested-by: Bjorn Helgaas <helgaas@kernel.org> >>>> Signed-off-by: Thierry Reding <thierry.reding@gmail.com> >>>> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> >>>> --- >>>> drivers/pci/pci.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c >>>> index 7e2022f..352bb53 100644 >>>> --- a/drivers/pci/pci.c >>>> +++ b/drivers/pci/pci.c >>>> @@ -514,7 +514,7 @@ struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res) >>>> */ >>>> 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)) { >>> >>> I think this should actually be this change on top of a revert of commit >>> 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI >>> device"). After the above change, the previous fix will have a redundant >>> check because highest_pcie_bridge will never be NULL. >>> >>> Let me send out that version to clarify what I mean. >>> >> >> Hi Thierry: >> >> The patch ("PCI: fix oops when try to find Root Port for a PCI device") >> has been merge to the linus mainline tree before you found this deficiencies.... > > I understand that. I'm just saying that there's no point keeping that > change around because it no longer makes sense after we initialize the > highest_pcie_bridge variable to dev. > Ok, NO problem.:) > Thierry > ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port() @ 2017-08-17 13:38 ` Ding Tianhong 0 siblings, 0 replies; 27+ messages in thread From: Ding Tianhong @ 2017-08-17 13:38 UTC (permalink / raw) To: linux-arm-kernel On 2017/8/17 21:30, Thierry Reding wrote: > On Thu, Aug 17, 2017 at 08:40:16PM +0800, Ding Tianhong wrote: >> >> >> On 2017/8/17 18:51, Thierry Reding wrote: >>> On Thu, Aug 17, 2017 at 10:25:30AM +0800, Ding Tianhong wrote: >>>> The pci_find_pcie_root_port() would return NULL if the given >>>> dev is already a Root Port, it looks like unfriendly to the >>>> PCIe Root Port device, Thierry and Bjorn suggest to let this >>>> function return the given dev under this circumstances. >>>> >>>> Fixes: 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device") >>>> Suggested-by: Thierry Reding <thierry.reding@gmail.com> >>>> Suggested-by: Bjorn Helgaas <helgaas@kernel.org> >>>> Signed-off-by: Thierry Reding <thierry.reding@gmail.com> >>>> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> >>>> --- >>>> drivers/pci/pci.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c >>>> index 7e2022f..352bb53 100644 >>>> --- a/drivers/pci/pci.c >>>> +++ b/drivers/pci/pci.c >>>> @@ -514,7 +514,7 @@ struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res) >>>> */ >>>> 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)) { >>> >>> I think this should actually be this change on top of a revert of commit >>> 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI >>> device"). After the above change, the previous fix will have a redundant >>> check because highest_pcie_bridge will never be NULL. >>> >>> Let me send out that version to clarify what I mean. >>> >> >> Hi Thierry: >> >> The patch ("PCI: fix oops when try to find Root Port for a PCI device") >> has been merge to the linus mainline tree before you found this deficiencies.... > > I understand that. I'm just saying that there's no point keeping that > change around because it no longer makes sense after we initialize the > highest_pcie_bridge variable to dev. > Ok, NO problem.:) > Thierry > ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH] PCI: Allow PCI express root ports to find themselves 2017-08-17 2:25 ` Ding Tianhong (?) @ 2017-08-17 11:06 ` Thierry Reding -1 siblings, 0 replies; 27+ messages in thread From: Thierry Reding @ 2017-08-17 11:06 UTC (permalink / raw) To: David Miller, Bjorn Helgaas, Ding Tianhong, Michael Ellerman Cc: mark.rutland, gabriele.paoloni, asit.k.mallick, catalin.marinas, will.deacon, linuxarm, alexander.duyck, ashok.raj, eric.dumazet, jeffrey.t.kirsher, linux-pci, ganeshgr, Bob.Shaw, leedom, patrick.j.cramer, werner, linux-arm-kernel, amira, netdev, linux-kernel, David.Laight, Suravee.Suthikulpanit, robin.murphy, l.stach From: Thierry Reding <treding@nvidia.com> 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 <treding@nvidia.com> --- 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-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH] PCI: Allow PCI express root ports to find themselves @ 2017-08-17 11:06 ` Thierry Reding 0 siblings, 0 replies; 27+ messages in thread From: Thierry Reding @ 2017-08-17 11:06 UTC (permalink / raw) To: David Miller, Bjorn Helgaas, Ding Tianhong, Michael Ellerman Cc: leedom, ashok.raj, werner, ganeshgr, asit.k.mallick, patrick.j.cramer, Suravee.Suthikulpanit, Bob.Shaw, l.stach, amira, gabriele.paoloni, David.Laight, jeffrey.t.kirsher, catalin.marinas, will.deacon, mark.rutland, robin.murphy, alexander.duyck, eric.dumazet, linux-arm-kernel, netdev, linux-pci, linux-kernel, linuxarm From: Thierry Reding <treding@nvidia.com> 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 <treding@nvidia.com> --- 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 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH] PCI: Allow PCI express root ports to find themselves @ 2017-08-17 11:06 ` Thierry Reding 0 siblings, 0 replies; 27+ messages in thread From: Thierry Reding @ 2017-08-17 11:06 UTC (permalink / raw) To: linux-arm-kernel From: Thierry Reding <treding@nvidia.com> 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 <treding@nvidia.com> --- 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 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH] PCI: Allow PCI express root ports to find themselves 2017-08-17 11:06 ` Thierry Reding @ 2017-08-17 16:58 ` Bjorn Helgaas -1 siblings, 0 replies; 27+ messages in thread From: Bjorn Helgaas @ 2017-08-17 16:58 UTC (permalink / raw) To: Thierry Reding Cc: David Miller, Bjorn Helgaas, Ding Tianhong, Michael Ellerman, mark.rutland, gabriele.paoloni, asit.k.mallick, catalin.marinas, will.deacon, linuxarm, alexander.duyck, ashok.raj, eric.dumazet, jeffrey.t.kirsher, linux-pci, ganeshgr, Bob.Shaw, leedom, patrick.j.cramer, werner, linux-arm-kernel, amira, netdev, linux-kernel, David.Laight, Suravee.Suthikulpanit, robin.murphy, l.stach On Thu, Aug 17, 2017 at 01:06:14PM +0200, Thierry Reding wrote: > From: Thierry Reding <treding@nvidia.com> > > 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 <treding@nvidia.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> 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-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH] PCI: Allow PCI express root ports to find themselves @ 2017-08-17 16:58 ` Bjorn Helgaas 0 siblings, 0 replies; 27+ messages in thread From: Bjorn Helgaas @ 2017-08-17 16:58 UTC (permalink / raw) To: linux-arm-kernel On Thu, Aug 17, 2017 at 01:06:14PM +0200, Thierry Reding wrote: > From: Thierry Reding <treding@nvidia.com> > > 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 <treding@nvidia.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> 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-kernel at lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] PCI: Allow PCI express root ports to find themselves 2017-08-17 11:06 ` Thierry Reding (?) @ 2017-08-18 1:29 ` Shawn Lin -1 siblings, 0 replies; 27+ messages in thread From: Shawn Lin @ 2017-08-18 1:29 UTC (permalink / raw) To: Thierry Reding, David Miller, Bjorn Helgaas, Ding Tianhong, Michael Ellerman Cc: mark.rutland, gabriele.paoloni, asit.k.mallick, catalin.marinas, shawn.lin, will.deacon, linuxarm, alexander.duyck, ashok.raj, eric.dumazet, jeffrey.t.kirsher, linux-pci, ganeshgr, Bob.Shaw, leedom, patrick.j.cramer, werner, linux-arm-kernel, amira, netdev, linux-kernel, David.Laight, Suravee.Suthikulpanit, robin.murphy, l.stach Hi On 2017/8/17 19:06, Thierry Reding wrote: > From: Thierry Reding <treding@nvidia.com> > > 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 <treding@nvidia.com> Tested-by: Shawn Lin <shawn.lin@rock-chips.com> > --- > 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); > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] PCI: Allow PCI express root ports to find themselves @ 2017-08-18 1:29 ` Shawn Lin 0 siblings, 0 replies; 27+ messages in thread From: Shawn Lin @ 2017-08-18 1:29 UTC (permalink / raw) To: Thierry Reding, David Miller, Bjorn Helgaas, Ding Tianhong, Michael Ellerman Cc: shawn.lin, leedom, ashok.raj, werner, ganeshgr, asit.k.mallick, patrick.j.cramer, Suravee.Suthikulpanit, Bob.Shaw, l.stach, amira, gabriele.paoloni, David.Laight, jeffrey.t.kirsher, catalin.marinas, will.deacon, mark.rutland, robin.murphy, alexander.duyck, eric.dumazet, linux-arm-kernel, netdev, linux-pci, linux-kernel, linuxarm Hi On 2017/8/17 19:06, Thierry Reding wrote: > From: Thierry Reding <treding@nvidia.com> > > 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 <treding@nvidia.com> Tested-by: Shawn Lin <shawn.lin@rock-chips.com> > --- > 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); > > ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH] PCI: Allow PCI express root ports to find themselves @ 2017-08-18 1:29 ` Shawn Lin 0 siblings, 0 replies; 27+ messages in thread From: Shawn Lin @ 2017-08-18 1:29 UTC (permalink / raw) To: linux-arm-kernel Hi On 2017/8/17 19:06, Thierry Reding wrote: > From: Thierry Reding <treding@nvidia.com> > > 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 <treding@nvidia.com> Tested-by: Shawn Lin <shawn.lin@rock-chips.com> > --- > 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); > > ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] PCI: Allow PCI express root ports to find themselves 2017-08-17 11:06 ` Thierry Reding (?) @ 2017-08-18 4:32 ` Michael Ellerman -1 siblings, 0 replies; 27+ messages in thread From: Michael Ellerman @ 2017-08-18 4:32 UTC (permalink / raw) To: Thierry Reding, David Miller, Bjorn Helgaas, Ding Tianhong Cc: mark.rutland, gabriele.paoloni, asit.k.mallick, catalin.marinas, will.deacon, linuxarm, alexander.duyck, ashok.raj, eric.dumazet, jeffrey.t.kirsher, linux-pci, ganeshgr, Bob.Shaw, leedom, patrick.j.cramer, werner, linux-arm-kernel, amira, netdev, linux-kernel, David.Laight, Suravee.Suthikulpanit, robin.murphy, l.stach Thierry Reding <thierry.reding@gmail.com> writes: > From: Thierry Reding <treding@nvidia.com> > > 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 <treding@nvidia.com> > --- > 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] PCI: Allow PCI express root ports to find themselves @ 2017-08-18 4:32 ` Michael Ellerman 0 siblings, 0 replies; 27+ messages in thread From: Michael Ellerman @ 2017-08-18 4:32 UTC (permalink / raw) To: Thierry Reding, David Miller, Bjorn Helgaas, Ding Tianhong Cc: leedom, ashok.raj, werner, ganeshgr, asit.k.mallick, patrick.j.cramer, Suravee.Suthikulpanit, Bob.Shaw, l.stach, amira, gabriele.paoloni, David.Laight, jeffrey.t.kirsher, catalin.marinas, will.deacon, mark.rutland, robin.murphy, alexander.duyck, eric.dumazet, linux-arm-kernel, netdev, linux-pci, linux-kernel, linuxarm Thierry Reding <thierry.reding@gmail.com> writes: > From: Thierry Reding <treding@nvidia.com> > > 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 <treding@nvidia.com> > --- > 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 ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH] PCI: Allow PCI express root ports to find themselves @ 2017-08-18 4:32 ` Michael Ellerman 0 siblings, 0 replies; 27+ messages in thread From: Michael Ellerman @ 2017-08-18 4:32 UTC (permalink / raw) To: linux-arm-kernel Thierry Reding <thierry.reding@gmail.com> writes: > From: Thierry Reding <treding@nvidia.com> > > 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 <treding@nvidia.com> > --- > 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 ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] PCI: Allow PCI express root ports to find themselves 2017-08-17 11:06 ` Thierry Reding (?) @ 2017-08-18 23:14 ` David Miller -1 siblings, 0 replies; 27+ messages in thread From: David Miller @ 2017-08-18 23:14 UTC (permalink / raw) To: thierry.reding Cc: mark.rutland, gabriele.paoloni, asit.k.mallick, catalin.marinas, will.deacon, linuxarm, alexander.duyck, ashok.raj, eric.dumazet, mpe, jeffrey.t.kirsher, dingtianhong, ganeshgr, Bob.Shaw, leedom, patrick.j.cramer, bhelgaas, werner, linux-arm-kernel, amira, linux-pci, netdev, linux-kernel, David.Laight, Suravee.Suthikulpanit, robin.murphy, l.stach From: Thierry Reding <thierry.reding@gmail.com> Date: Thu, 17 Aug 2017 13:06:14 +0200 > From: Thierry Reding <treding@nvidia.com> > > 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 <treding@nvidia.com> > --- > 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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH] PCI: Allow PCI express root ports to find themselves @ 2017-08-18 23:14 ` David Miller 0 siblings, 0 replies; 27+ messages in thread From: David Miller @ 2017-08-18 23:14 UTC (permalink / raw) To: thierry.reding Cc: bhelgaas, dingtianhong, mpe, leedom, ashok.raj, werner, ganeshgr, asit.k.mallick, patrick.j.cramer, Suravee.Suthikulpanit, Bob.Shaw, l.stach, amira, gabriele.paoloni, David.Laight, jeffrey.t.kirsher, catalin.marinas, will.deacon, mark.rutland, robin.murphy, alexander.duyck, eric.dumazet, linux-arm-kernel, netdev, linux-pci, linux-kernel, linuxarm From: Thierry Reding <thierry.reding@gmail.com> Date: Thu, 17 Aug 2017 13:06:14 +0200 > From: Thierry Reding <treding@nvidia.com> > > 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 <treding@nvidia.com> > --- > 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. ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH] PCI: Allow PCI express root ports to find themselves @ 2017-08-18 23:14 ` David Miller 0 siblings, 0 replies; 27+ messages in thread From: David Miller @ 2017-08-18 23:14 UTC (permalink / raw) To: linux-arm-kernel From: Thierry Reding <thierry.reding@gmail.com> Date: Thu, 17 Aug 2017 13:06:14 +0200 > From: Thierry Reding <treding@nvidia.com> > > 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 <treding@nvidia.com> > --- > 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. ^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~2017-08-18 23:14 UTC | newest] Thread overview: 27+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-08-17 2:25 [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port() Ding Tianhong 2017-08-17 2:25 ` Ding Tianhong 2017-08-17 2:42 ` David Miller 2017-08-17 2:42 ` David Miller 2017-08-17 10:51 ` Thierry Reding 2017-08-17 10:51 ` Thierry Reding 2017-08-17 12:40 ` Ding Tianhong 2017-08-17 12:40 ` Ding Tianhong 2017-08-17 13:30 ` Thierry Reding 2017-08-17 13:30 ` Thierry Reding 2017-08-17 13:38 ` Ding Tianhong 2017-08-17 13:38 ` Ding Tianhong 2017-08-17 13:38 ` Ding Tianhong 2017-08-17 11:06 ` [PATCH] PCI: Allow PCI express root ports to find themselves Thierry Reding 2017-08-17 11:06 ` Thierry Reding 2017-08-17 11:06 ` Thierry Reding 2017-08-17 16:58 ` Bjorn Helgaas 2017-08-17 16:58 ` Bjorn Helgaas 2017-08-18 1:29 ` Shawn Lin 2017-08-18 1:29 ` Shawn Lin 2017-08-18 1:29 ` Shawn Lin 2017-08-18 4:32 ` Michael Ellerman 2017-08-18 4:32 ` Michael Ellerman 2017-08-18 4:32 ` Michael Ellerman 2017-08-18 23:14 ` David Miller 2017-08-18 23:14 ` David Miller 2017-08-18 23:14 ` David Miller
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.