From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suravee Suthikulpanit Subject: Re: [PATCH v10 09/10] PCI: Assign unassigned bus resources in pci_scan_root_bus() Date: Fri, 12 Sep 2014 05:13:51 -0500 Message-ID: <5412C75F.30207@amd.com> References: <1410184472-17630-1-git-send-email-Liviu.Dudau@arm.com> <1410184472-17630-10-git-send-email-Liviu.Dudau@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1410184472-17630-10-git-send-email-Liviu.Dudau@arm.com> Sender: linux-pci-owner@vger.kernel.org To: Liviu Dudau , Bjorn Helgaas , Arnd Bergmann , Rob Herring , Jason Gunthorpe , Benjamin Herrenschmidt , Catalin Marinas , Will Deacon , Russell King , linux-pci , Linus Walleij Cc: Tanmay Inamdar , Grant Likely , Sinan Kaya , Jingoo Han , Kukjin Kim , linux-arch , LKML , Device Tree ML , LAKML List-Id: linux-arch.vger.kernel.org On 9/8/2014 8:54 AM, Liviu Dudau wrote: > If the firmware has not assigned all the bus resources and > we are not just probing the PCIe busses, it makes sense to > assign the unassigned resources in pci_scan_root_bus(). > > Cc: Bjorn Helgaas > Cc: Arnd Bergmann > Cc: Jason Gunthorpe > Cc: Rob Herring > Signed-off-by: Liviu Dudau > --- > drivers/pci/probe.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c > index ef891d2..508cf61 100644 > --- a/drivers/pci/probe.c > +++ b/drivers/pci/probe.c > @@ -1953,6 +1953,9 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, > if (!found) > pci_bus_update_busn_res_end(b, max); > > + if (!pci_has_flag(PCI_PROBE_ONLY)) > + pci_assign_unassigned_bus_resources(b); > + > pci_bus_add_devices(b); > return b; > } > Liviu, Besides the check for PCI_PROBE_ONLY here, I think we also need to avoid calling "pci_enable_resources()" in the "driver/pci/pci.c: pcibios_enable_device()" for PCI_PROBE_ONLY mode since the resource is not assigned by Linux. Otherwise, the "drivers/pci/setup-res.c: pci_enable_resource()" would fail w/ error: can't enable device: BAR ..... not assigned Actually, in "arch/arm/kernel/bios32.c:", the weak "pcibios_enable_device()" function also has the check for PCI_PROBE_ONLY mode before calling pci_enable_resources(). Thanks, Suravee From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-by2on0142.outbound.protection.outlook.com ([207.46.100.142]:35968 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751091AbaILKOX (ORCPT ); Fri, 12 Sep 2014 06:14:23 -0400 Message-ID: <5412C75F.30207@amd.com> Date: Fri, 12 Sep 2014 05:13:51 -0500 From: Suravee Suthikulpanit MIME-Version: 1.0 Subject: Re: [PATCH v10 09/10] PCI: Assign unassigned bus resources in pci_scan_root_bus() References: <1410184472-17630-1-git-send-email-Liviu.Dudau@arm.com> <1410184472-17630-10-git-send-email-Liviu.Dudau@arm.com> In-Reply-To: <1410184472-17630-10-git-send-email-Liviu.Dudau@arm.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Liviu Dudau , Bjorn Helgaas , Arnd Bergmann , Rob Herring , Jason Gunthorpe , Benjamin Herrenschmidt , Catalin Marinas , Will Deacon , Russell King , linux-pci , Linus Walleij Cc: Tanmay Inamdar , Grant Likely , Sinan Kaya , Jingoo Han , Kukjin Kim , linux-arch , LKML , Device Tree ML , LAKML Message-ID: <20140912101351.Pe2j8fzvf3cEyCNZaaObIIviHGfb1X7w0sbN-o1iT1I@z> On 9/8/2014 8:54 AM, Liviu Dudau wrote: > If the firmware has not assigned all the bus resources and > we are not just probing the PCIe busses, it makes sense to > assign the unassigned resources in pci_scan_root_bus(). > > Cc: Bjorn Helgaas > Cc: Arnd Bergmann > Cc: Jason Gunthorpe > Cc: Rob Herring > Signed-off-by: Liviu Dudau > --- > drivers/pci/probe.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c > index ef891d2..508cf61 100644 > --- a/drivers/pci/probe.c > +++ b/drivers/pci/probe.c > @@ -1953,6 +1953,9 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, > if (!found) > pci_bus_update_busn_res_end(b, max); > > + if (!pci_has_flag(PCI_PROBE_ONLY)) > + pci_assign_unassigned_bus_resources(b); > + > pci_bus_add_devices(b); > return b; > } > Liviu, Besides the check for PCI_PROBE_ONLY here, I think we also need to avoid calling "pci_enable_resources()" in the "driver/pci/pci.c: pcibios_enable_device()" for PCI_PROBE_ONLY mode since the resource is not assigned by Linux. Otherwise, the "drivers/pci/setup-res.c: pci_enable_resource()" would fail w/ error: can't enable device: BAR ..... not assigned Actually, in "arch/arm/kernel/bios32.c:", the weak "pcibios_enable_device()" function also has the check for PCI_PROBE_ONLY mode before calling pci_enable_resources(). Thanks, Suravee