diff options
author | Sergei Miroshnichenko <s.miroshnichenko@yadro.com> | 2020-12-18 16:43:15 +0300 |
---|---|---|
committer | Sergei Miroshnichenko <s.miroshnichenko@yadro.com> | 2021-01-13 15:19:46 +0300 |
commit | 0afad7b54c5a22d47e56ead5083bfb92ed04176b (patch) | |
tree | 3791d4b3384125601d4f296bc87113a876908e33 | |
parent | bf7d73b44ca229cfc787a4ccaea325d2fd8d7027 (diff) |
PCI: hotplug: Fix reassigning the released BARs
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>
-rw-r--r-- | drivers/pci/setup-bus.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index bc342eaa98e8..a956f0179064 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -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; |