diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index e994c546422c..5247370010aa 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_name, r); } } @@ -256,14 +258,18 @@ 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 failed the earlier assignment and is * not optional as it would just fail again. */ if (!res->parent && resource_size(res) && - !pci_resource_is_optional(dev, idx)) + !pci_resource_is_optional(dev, idx)) { + pci_info(dev, "tudor: %s: %s %pR: skipped resource that failed the earlier assignment and is not optional as it would just fail again\n", + __func__, res_name, res); goto out; + } /* Skip this resource if not found in head list */ list_for_each_entry(dev_res, head, list) { @@ -272,12 +278,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; + } - 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, resource_size(res) + add_size); @@ -286,6 +295,7 @@ static void reassign_resources_sorted(struct list_head *realloc_head, "%s %pR: ignoring failure in optional allocation\n", res_name, res); } + pci_info(dev, "tudor: %s: %s %pR: resource assigned\n", __func__, res_name, res); } else if (add_size > 0) { res->flags |= add_res->flags & (IORESOURCE_STARTALIGN|IORESOURCE_SIZEALIGN); @@ -293,6 +303,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); + } else { + pci_info(dev, "tudor: %s: %s %pR: resource reassigned add_size zero or negative\n", __func__, res_name, res); } out: list_del(&add_res->list); @@ -1197,11 +1210,16 @@ 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_optional(dev, i)) { add_align = max(pci_resource_alignment(dev, r), add_align); add_to_list(realloc_head, dev, r, 0, 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; } @@ -2496,7 +2514,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);