Recent pci_bus_size change will use add_size for minimum resource size for pcie hotplug bridge. But it does not pass children back to parent bridge. that will have problem on some setup like: hot add one chassis with more hot plug slots. for example: if the chassis have 8 slots, we should allocate 8x2M instead of one 1x2M for parent bus. So try to get child add_size and compare the sum with parent bus bridge... Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx> --- drivers/pci/setup-bus.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) Index: linux-2.6/drivers/pci/setup-bus.c =================================================================== --- linux-2.6.orig/drivers/pci/setup-bus.c +++ linux-2.6/drivers/pci/setup-bus.c @@ -537,6 +537,20 @@ static resource_size_t calculate_memsize return size; } +static resource_size_t get_res_add_size(struct resource_list_x *add_head, + struct resource *res) +{ + struct resource_list_x *list; + + /* check if it is in add_head list */ + for (list = add_head->next; list && list->res != res; + list = list->next); + if (list) + return list->add_size; + + return 0; +} + /** * pbus_size_io() - size the io window of a given bus * @@ -556,6 +570,7 @@ static void pbus_size_io(struct pci_bus struct pci_dev *dev; struct resource *b_res = find_free_bus_resource(bus, IORESOURCE_IO); unsigned long size = 0, size0 = 0, size1 = 0; + resource_size_t children_add_size = 0; if (!b_res) return; @@ -576,10 +591,15 @@ static void pbus_size_io(struct pci_bus size += r_size; else size1 += r_size; + + if (add_head) + children_add_size += get_res_add_size(add_head, r); } } size0 = calculate_iosize(size, min_size, size1, resource_size(b_res), 4096); + if (children_add_size > add_size) + add_size = children_add_size; size1 = !add_size? size0: calculate_iosize(size, min_size+add_size, size1, resource_size(b_res), 4096); @@ -621,6 +641,7 @@ static int pbus_size_mem(struct pci_bus int order, max_order; struct resource *b_res = find_free_bus_resource(bus, type); unsigned int mem64_mask = 0; + resource_size_t children_add_size = 0; if (!b_res) return 0; @@ -662,6 +683,9 @@ static int pbus_size_mem(struct pci_bus if (order > max_order) max_order = order; mem64_mask &= r->flags & IORESOURCE_MEM_64; + + if (add_head) + children_add_size += get_res_add_size(add_head, r); } } align = 0; @@ -678,6 +702,8 @@ static int pbus_size_mem(struct pci_bus align += aligns[order]; } size0 = calculate_memsize(size, min_size, 0, resource_size(b_res), min_align); + if (children_add_size > add_size) + add_size = children_add_size; size1 = !add_size ? size : calculate_memsize(size, min_size+add_size, 0, resource_size(b_res), min_align); -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html