@@ -297,7 +297,9 @@ static void assign_requested_resources_sorted(struct list_head *head,
0 /* don't care */,
0 /* don't care */);
}
- reset_resource(res);
+ if (!pci_can_move_bars ||
+ idx >= PCI_BRIDGE_RESOURCES)
+ reset_resource(res);
}
}
}
@@ -1616,8 +1618,8 @@ static void pci_bridge_release_resources(struct pci_bus *bus,
type = old_flags = r->flags & PCI_RES_TYPE_MASK;
pci_info(dev, "resource %d %pR released\n",
PCI_BRIDGE_RESOURCES + idx, r);
- /* Keep the old size */
- r->end = resource_size(r) - 1;
+ /* Don't keep the old size if the bridge will be recalculated */
+ r->end = pci_can_move_bars ? 0 : (resource_size(r) - 1);
r->start = 0;
r->flags = 0;
Bridge windows are temporarily released during a PCI rescan, and their old sizes are not relevant anymore as they will be recreated in pbus_size_*() from scratch. So don't keep it, but instead set to zero after release. If BAR assignment fails after a PCI hotplug event, the kernel will retry with a fall-back reduced configuration, so don't apply reset_resource() for non-window BARs to keep them valid for the next attempt. Signed-off-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com> --- drivers/pci/setup-bus.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)