diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 138d5337a1d8..18ca23334bc8 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -206,6 +206,8 @@ static void pdev_sort_resources(struct pci_dev *dev, struct list_head *head ) } /* Insert it just before n */ list_add_tail(&tmp->list, n); + + pci_info(dev, "tudor: %s: %s %pR resource added in head list\n", __func__, r_na me, r); } } @@ -255,10 +257,15 @@ static void reassign_resources_sorted(struct list_head *realloc_head, res = add_res->res; dev = add_res->dev; + idx = pci_resource_num(dev, res); + res_name = pci_resource_name(dev, idx); /* Skip resource that has been reset */ - if (!res->flags) + if (!res->flags) { + pci_info(dev, "tudor: %s: %s %pR: skipped resource that has been reset\ n", + __func__, res_name, res); goto out; + } /* Skip this resource if not found in head list */ list_for_each_entry(dev_res, head, list) { @@ -267,13 +274,15 @@ static void reassign_resources_sorted(struct list_head *realloc_head, break; } } - if (!found_match) /* Just skip */ + if (!found_match) { /* Just skip */ + pci_info(dev, "tudor: %s: %s %pR: skipped resource not found in head list\n", + __func__, res_name, res); continue; + } - idx = pci_resource_num(dev, res); - res_name = pci_resource_name(dev, idx); add_size = add_res->add_size; align = add_res->min_align; + if (!res->parent) { resource_set_range(res, align, add_size); if (pci_assign_resource(dev, idx)) { @@ -282,6 +291,7 @@ static void reassign_resources_sorted(struct list_head *realloc_head, res_name, res); reset_resource(res); } + pci_info(dev, "tudor: %s: %s %pR: resource assigned\n", __func__, res_name, res); } else { res->flags |= add_res->flags & (IORESOURCE_STARTALIGN|IORESOURCE_SIZEALIGN); @@ -289,7 +299,9 @@ static void reassign_resources_sorted(struct list_head *realloc_head, pci_info(dev, "%s %pR: failed to add optional %llx\n", res_name, res, (unsigned long long) add_size); + pci_info(dev, "tudor: %s: %s %pR: resource reassigned\n", __func__, res_name, res); } + out: list_del(&add_res->list); kfree(add_res); @@ -1146,12 +1158,17 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, continue; r_size = resource_size(r); + pci_info(dev, "tudor: 1: %s: %s %pR list empty? %d\n", + __func__, r_name, r, list_empty(realloc_head)); + /* Put SRIOV requested res to the optional list */ if (realloc_head && pci_resource_is_iov(i)) { add_align = max(pci_resource_alignment(dev, r), add_align); resource_set_size(r, 0); add_to_list(realloc_head, dev, r, r_size, 0 /* Don't care */); children_add_size += r_size; + pci_info(dev, "tudor: 2: %s: %s %pR list empty? %d\n", + __func__, r_name, r, list_empty(realloc_head)); continue; } @@ -2446,7 +2463,11 @@ void pci_assign_unassigned_bus_resources(struct pci_bus *bus) if (pci_has_subordinate(dev)) __pci_bus_size_bridges(dev->subordinate, &add_list); up_read(&pci_bus_sem); + pr_err("tudor : %s: before __pci_bus_assign_resources -> list empty? %d\n", + __func__, list_empty(&add_list)); __pci_bus_assign_resources(bus, &add_list, NULL); + pr_err("tudor : %s: after __pci_bus_assign_resources -> list empty? %d\n", + __func__, list_empty(&add_list)); BUG_ON(!list_empty(&add_list)); } EXPORT_SYMBOL_GPL(pci_assign_unassigned_bus_resources);