Message ID | 4A42DA6F.2030305@kernel.org (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
On Wed, 24 Jun 2009 19:01:19 -0700 Yinghai Lu <yinghai@kernel.org> wrote: > > don't touch info->res_num if we are out of space > > Signed-off-by: Yinghai Lu <yinghai@kernel.org> Gary, any comments on these? Thanks,
On Mon, Jun 29, 2009 at 06:16:03PM -0700, Jesse Barnes wrote: > On Wed, 24 Jun 2009 19:01:19 -0700 > Yinghai Lu <yinghai@kernel.org> wrote: > > > > > don't touch info->res_num if we are out of space > > > > Signed-off-by: Yinghai Lu <yinghai@kernel.org> > > Gary, any comments on these? Jesse, "[PATCH 1/3] x86/pci: fix boundary checking when using root CRS" which convinced that my code was incorrect and "[PATCH 2/3] x86/pci: get root CRS before scan childs -v3" look good to me from both code review and functional [1] standpoints. Acked-by: <garyhade@us.ibm.com> Tested-by: <garyhade@us.ibm.com> [1] Successful boot of patched 2.6.31-rc1 with pci=use_crs followed by successful hot-add and hot-remove of PCI-X and PCIe cards on an IBM x3850. Thanks Yinghai. Gary
On Tue, 30 Jun 2009 11:04:49 -0700 Gary Hade <garyhade@us.ibm.com> wrote: > On Mon, Jun 29, 2009 at 06:16:03PM -0700, Jesse Barnes wrote: > > On Wed, 24 Jun 2009 19:01:19 -0700 > > Yinghai Lu <yinghai@kernel.org> wrote: > > > > > > > > don't touch info->res_num if we are out of space > > > > > > Signed-off-by: Yinghai Lu <yinghai@kernel.org> > > > > Gary, any comments on these? > > Jesse, > "[PATCH 1/3] x86/pci: fix boundary checking when using root CRS" > which convinced that my code was incorrect and > "[PATCH 2/3] x86/pci: get root CRS before scan childs -v3" > look good to me from both code review and functional [1] standpoints. > Acked-by: <garyhade@us.ibm.com> > Tested-by: <garyhade@us.ibm.com> > > [1] Successful boot of patched 2.6.31-rc1 with pci=use_crs > followed by successful hot-add and hot-remove of PCI-X > and PCIe cards on an IBM x3850. > > Thanks Yinghai. Thanks guys, I've applied these to my for-linus branch for a pull later this week.
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,
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(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html