Messages in this thread Patches in this message | | | Date | Wed, 24 Jun 2009 15:53:28 -0700 | Subject | Re: Regression with commit f9cde5f in 2.6.30-gitX | From | Yinghai Lu <> |
| |
On Wed, Jun 24, 2009 at 3:11 PM, Yinghai Lu<yhlu.kernel@gmail.com> wrote: > On Wed, Jun 24, 2009 at 3:04 PM, Larry Finger<Larry.Finger@lwfinger.net> wrote: >> Yinghai Lu wrote: >> node 0 link 0: mmio [a0000, bffff] >> node 0 link 0: mmio [c0000000, dfffffff] >> node 0 link 0: mmio [e0000000, efffffff] >> node 0 link 0: mmio [f0000000, fe0bffff] >> bus: [00,ff] on node 0 link 0 >> bus: 00 index 0 io port: [0, ffff] >> bus: 00 index 1 mmio: [a0000, bffff] >> bus: 00 index 2 mmio: [c0000000, fcffffffff] > > that is read from pci config. > > and only one HT chain is there. so there is no point to use _CRS for them. > > please let me check if we could could have patch to deselect that. >
please try the attached patches.
applying sequence: fix_crs.patch use_pci_crs_early.patch
only_one.patch
YH [PATCH] x86/pci: fix boundary checking
don't touch info->res_num if we are out of space
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
--- arch/x86/pci/acpi.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
Index: linux-2.6/arch/x86/pci/acpi.c =================================================================== --- linux-2.6.orig/arch/x86/pci/acpi.c +++ linux-2.6/arch/x86/pci/acpi.c @@ -68,6 +68,10 @@ setup_resource(struct acpi_resource *acp unsigned long flags; struct resource *root; int max_root_bus_resources = PCI_BUS_NUM_RESOURCES; + u64 start, end; + + if (bus_has_transparent_bridge(info->bus)) + max_root_bus_resources -= 3; status = resource_to_addr(acpi_res, &addr); if (!ACPI_SUCCESS(status)) @@ -84,25 +88,24 @@ setup_resource(struct acpi_resource *acp } else return AE_OK; - res = &info->res[info->res_num]; - res->name = info->name; - res->flags = flags; - res->start = addr.minimum + addr.translation_offset; - res->end = res->start + addr.address_length - 1; - res->child = NULL; - - if (bus_has_transparent_bridge(info->bus)) - max_root_bus_resources -= 3; + start = addr.minimum + addr.translation_offset; + end = start + addr.address_length - 1; if (info->res_num >= max_root_bus_resources) { printk(KERN_WARNING "PCI: Failed to allocate 0x%lx-0x%lx " "from %s for %s due to _CRS returning more than " - "%d resource descriptors\n", (unsigned long) res->start, - (unsigned long) res->end, root->name, info->name, + "%d resource descriptors\n", (unsigned long) start, + (unsigned long) end, root->name, info->name, max_root_bus_resources); - info->res_num++; return AE_OK; } + res = &info->res[info->res_num]; + res->name = info->name; + res->flags = flags; + res->start = start; + res->end = end; + res->child = NULL; + if (insert_resource(root, res)) { printk(KERN_ERR "PCI: Failed to allocate 0x%lx-0x%lx " "from %s for %s\n", (unsigned long) res->start,[PATCH] x86/pci: get root CRS before scan childs -v2
so we could remove adjust_transparent_bridge_resources..
and give x86_pci_root_bus_res_quirks chance when _CRS is not used or not there.
v2: add print out if pci conf reading for res is used for root
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
--- arch/x86/pci/acpi.c | 32 +++++++++----------------------- arch/x86/pci/amd_bus.c | 8 ++++++-- 2 files changed, 15 insertions(+), 25 deletions(-)
Index: linux-2.6/arch/x86/pci/acpi.c =================================================================== --- linux-2.6.orig/arch/x86/pci/acpi.c +++ linux-2.6/arch/x86/pci/acpi.c @@ -118,23 +118,6 @@ setup_resource(struct acpi_resource *acp } static void -adjust_transparent_bridge_resources(struct pci_bus *bus) -{ - struct pci_dev *dev; - - list_for_each_entry(dev, &bus->devices, bus_list) { - int i; - u16 class = dev->class >> 8; - - if (class == PCI_CLASS_BRIDGE_PCI && dev->transparent) { - for(i = 3; i < PCI_BUS_NUM_RESOURCES; i++) - dev->subordinate->resource[i] = - dev->bus->resource[i - 3]; - } - } -} - -static void get_current_resources(struct acpi_device *device, int busnum, int domain, struct pci_bus *bus) { @@ -161,8 +144,6 @@ get_current_resources(struct acpi_device info.res_num = 0; acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource, &info); - if (info.res_num) - adjust_transparent_bridge_resources(bus); return; @@ -225,8 +206,15 @@ struct pci_bus * __devinit pci_acpi_scan */ memcpy(bus->sysdata, sd, sizeof(*sd)); kfree(sd); - } else - bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd); + } else { + bus = pci_create_bus(NULL, busnum, &pci_root_ops, sd); + if (bus) { + if (!(pci_probe & PCI_NO_ROOT_CRS)) + get_current_resources(device, busnum, domain, + bus); + bus->subordinate = pci_scan_child_bus(bus); + } + } if (!bus) kfree(sd); @@ -241,8 +229,6 @@ struct pci_bus * __devinit pci_acpi_scan #endif } - if (bus && !(pci_probe & PCI_NO_ROOT_CRS)) - get_current_resources(device, busnum, domain, bus); return bus; } Index: linux-2.6/arch/x86/pci/amd_bus.c =================================================================== --- linux-2.6.orig/arch/x86/pci/amd_bus.c +++ linux-2.6/arch/x86/pci/amd_bus.c @@ -100,8 +100,9 @@ void x86_pci_root_bus_res_quirks(struct int j; struct pci_root_info *info; - /* don't go for it if _CRS is used */ - if (!(pci_probe & PCI_NO_ROOT_CRS)) + /* don't go for it if _CRS is used already */ + if (b->resource[0] != &ioport_resource || + b->resource[1] != &iomem_resource) return; /* if only one root bus, don't need to anything */ @@ -116,6 +117,9 @@ void x86_pci_root_bus_res_quirks(struct if (i == pci_root_num) return; + printk(KERN_DEBUG "PCI: peer root bus %02x res updated from pci conf\n", + b->number); + info = &pci_root_info[i]; for (j = 0; j < info->res_num; j++) { struct resource *res;[PATCH] x86/pci: don't use crs for root if we only have one root bus
for AMD system, when only one PCI root, just set PCI_NO_ROOT_CRS for it
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
--- arch/x86/pci/amd_bus.c | 4 ++++ 1 file changed, 4 insertions(+)
Index: linux-2.6/arch/x86/pci/amd_bus.c =================================================================== --- linux-2.6.orig/arch/x86/pci/amd_bus.c +++ linux-2.6/arch/x86/pci/amd_bus.c @@ -561,6 +561,10 @@ static int __init early_fill_mp_bus_info } } + /* don't use _CRS if we only have one root */ + if (pci_root_num <= 1) + pci_probe |= PCI_NO_ROOT_CRS; + return 0; } | |