diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 824486e28837..2a5f93415983 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -169,16 +169,21 @@ static void pdev_sort_resources(struct pci_dev *dev, struct list_head *head) resource_size_t r_align; struct list_head *n; - if (r->flags & IORESOURCE_PCI_FIXED) + if (r->flags & IORESOURCE_PCI_FIXED) { + pci_info(dev, "tudor: %s: %s %pR resource skipped due to IORESOURCE_PCI_FIXED\n", __func__, r_name, r); continue; + } - if (!(r->flags) || r->parent) + if (!(r->flags) || r->parent) { + pci_info(dev, "tudor: %s: %s %pR resource skipped due to !(r->flags) || r->parent\n", __func__, r_name, r); continue; + } r_align = pci_resource_alignment(dev, r); if (!r_align) { pci_warn(dev, "%s %pR: alignment must not be zero\n", r_name, r); + pci_info(dev, "tudor: %s: %s %pR resource skipped due to zero alignment\n", __func__, r_name, r); continue; } @@ -206,6 +211,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 +263,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 +283,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 +300,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 +308,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); @@ -318,6 +336,7 @@ static void assign_requested_resources_sorted(struct list_head *head, struct pci_dev_resource *dev_res; struct resource *res; struct pci_dev *dev; + const char *res_name; bool optional_res; int idx; @@ -325,6 +344,7 @@ static void assign_requested_resources_sorted(struct list_head *head, res = dev_res->res; dev = dev_res->dev; idx = pci_resource_num(dev, res); + res_name = pci_resource_name(dev, idx); optional_res = pci_resource_is_optional(dev, idx); if (!resource_size(res)) @@ -335,6 +355,8 @@ static void assign_requested_resources_sorted(struct list_head *head, if (pci_assign_resource(dev, idx)) { if (fail_head) { + pci_info(dev, "tudor: %s: %s %pR: add res to fail_head list\n", + __func__, res_name, res); add_to_list(fail_head, dev, res, 0 /* don't care */, 0 /* don't care */); @@ -1198,11 +1220,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, r->flags = 0x%lx, type = 0x%lx, type2 = 0x%lx, type3 = 0x%lx, mask = 0x%lx\n", + __func__, r_name, r, list_empty(realloc_head), + r->flags, type, type2, type3, mask); + /* 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; } @@ -2497,7 +2525,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); -- 2.49.0.1204.g71687c7c1d-goog