From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yinghai Lu Subject: Re: [PATCH v2 06/29] x86/PCI: convert to pci_create_root_bus() and pci_scan_root_bus() Date: Fri, 14 Oct 2011 14:15:35 -0700 Message-ID: <4E98A677.6050507@oracle.com> References: <20111014042142.23504.70417.stgit@bhelgaas.mtv.corp.google.com> <20111014042737.23504.46601.stgit@bhelgaas.mtv.corp.google.com> <4E97C8F0.7030108@oracle.com> <4E989E07.6030404@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-pci-owner@vger.kernel.org To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Jesse Barnes List-Id: linux-arch.vger.kernel.org On 10/14/2011 01:54 PM, Bjorn Helgaas wrote: > On Fri, Oct 14, 2011 at 2:39 PM, Yinghai Lu wrote: >> On 10/14/2011 01:32 PM, Bjorn Helgaas wrote: >> >> >>>>> int node; >>>>> @@ -353,11 +349,18 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root) >>>>> memcpy(bus->sysdata, sd, sizeof(*sd)); >>>>> kfree(sd); >>>>> } else { >>>>> - bus = pci_create_bus(NULL, busnum, &pci_root_ops, sd); >>>>> - if (bus) { >>>>> - get_current_resources(device, busnum, domain, bus); >>>>> - bus->subordinate = pci_scan_child_bus(bus); >>>>> + INIT_LIST_HEAD(&resources); >>>>> + get_current_resources(device, busnum, domain, &resources); >>>>> + if (!pci_use_crs) { >>>>> + pci_free_resource_list(&resources); >>>>> + x86_pci_root_bus_resources(busnum, &resources); >>>>> } >>>> >>>> >>>> You may need to update get_current_resources() to return status about handling _CRS... >>>> and check that status insteaf of !pci_use_crs. >>> >>> Is the current patch broken here? I don't think it will be simpler to >>> have get_current_resources() return a status and check that. But if >>> something's actually broken, I want to fix it, of course. >>> >> >> >> yes. if for some reason, _CRS is not handled right, that root bus resources will not get set to default res. >> >> + status = get_current_resources(device, busnum, domain, &resources); >> + if (status) { >> + pci_free_resource_list(&resources); >> + x86_pci_root_bus_resources(busnum, &resources); >> } >> >> get_current_resources() will not return 0 if _CRS is not really used. > > OK. I think it was that way before, too. We created the bus with > default resources, but the first thing get_current_resources() did was > clear them all out. If there was a problem parsing _CRS, we never > went back and put the defaults back in. that means you broke it when you clean up it last time. > > But I think this will do what you suggest and is nicer than what I had before: > > INIT_LIST_HEAD(&resources); > get_current_resources(device, busnum, domain, &resources); > if (list_empty(&resources)) > x86_pci_root_bus_resources(busnum, &resources); yes, that should work. Yinghai From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from acsinet15.oracle.com ([141.146.126.227]:29221 "EHLO acsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754724Ab1JNVPy (ORCPT ); Fri, 14 Oct 2011 17:15:54 -0400 Message-ID: <4E98A677.6050507@oracle.com> Date: Fri, 14 Oct 2011 14:15:35 -0700 From: Yinghai Lu MIME-Version: 1.0 Subject: Re: [PATCH v2 06/29] x86/PCI: convert to pci_create_root_bus() and pci_scan_root_bus() References: <20111014042142.23504.70417.stgit@bhelgaas.mtv.corp.google.com> <20111014042737.23504.46601.stgit@bhelgaas.mtv.corp.google.com> <4E97C8F0.7030108@oracle.com> <4E989E07.6030404@oracle.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Jesse Barnes Message-ID: <20111014211535.MmS6m5tbg55vnALF_kGHOPtIXsdWOxLZeD81PoJE3D8@z> On 10/14/2011 01:54 PM, Bjorn Helgaas wrote: > On Fri, Oct 14, 2011 at 2:39 PM, Yinghai Lu wrote: >> On 10/14/2011 01:32 PM, Bjorn Helgaas wrote: >> >> >>>>> int node; >>>>> @@ -353,11 +349,18 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root) >>>>> memcpy(bus->sysdata, sd, sizeof(*sd)); >>>>> kfree(sd); >>>>> } else { >>>>> - bus = pci_create_bus(NULL, busnum, &pci_root_ops, sd); >>>>> - if (bus) { >>>>> - get_current_resources(device, busnum, domain, bus); >>>>> - bus->subordinate = pci_scan_child_bus(bus); >>>>> + INIT_LIST_HEAD(&resources); >>>>> + get_current_resources(device, busnum, domain, &resources); >>>>> + if (!pci_use_crs) { >>>>> + pci_free_resource_list(&resources); >>>>> + x86_pci_root_bus_resources(busnum, &resources); >>>>> } >>>> >>>> >>>> You may need to update get_current_resources() to return status about handling _CRS... >>>> and check that status insteaf of !pci_use_crs. >>> >>> Is the current patch broken here? I don't think it will be simpler to >>> have get_current_resources() return a status and check that. But if >>> something's actually broken, I want to fix it, of course. >>> >> >> >> yes. if for some reason, _CRS is not handled right, that root bus resources will not get set to default res. >> >> + status = get_current_resources(device, busnum, domain, &resources); >> + if (status) { >> + pci_free_resource_list(&resources); >> + x86_pci_root_bus_resources(busnum, &resources); >> } >> >> get_current_resources() will not return 0 if _CRS is not really used. > > OK. I think it was that way before, too. We created the bus with > default resources, but the first thing get_current_resources() did was > clear them all out. If there was a problem parsing _CRS, we never > went back and put the defaults back in. that means you broke it when you clean up it last time. > > But I think this will do what you suggest and is nicer than what I had before: > > INIT_LIST_HEAD(&resources); > get_current_resources(device, busnum, domain, &resources); > if (list_empty(&resources)) > x86_pci_root_bus_resources(busnum, &resources); yes, that should work. Yinghai