Skip to content

Commit 3e40aa2

Browse files
ij-intelbjorn-helgaas
authored andcommitted
PCI: Wait for Link before restoring Downstream Buses
__pci_reset_bus() calls pci_bridge_secondary_bus_reset() to perform the reset and also waits for the Secondary Bus to become again accessible. __pci_reset_bus() then calls pci_bus_restore_locked() that restores the PCI devices connected to the bus, and if necessary, recursively restores also the subordinate buses and their devices. The logic in pci_bus_restore_locked() does not take into account that after restoring a device on one level, there might be another Link Downstream that can only start to come up after restore has been performed for its Downstream Port device. That is, the Link may require additional wait until it becomes accessible. Similarly, pci_slot_restore_locked() lacks wait. Amend pci_bus_restore_locked() and pci_slot_restore_locked() to wait for the Secondary Bus before recursively performing the restore of that bus. Fixes: 090a3c5 ("PCI: Add pci_reset_slot() and pci_reset_bus()") Link: https://lore.kernel.org/r/20240808121708.2523-1-ilpo.jarvinen@linux.intel.com Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
1 parent 8400291 commit 3e40aa2

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/pci/pci.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5671,8 +5671,10 @@ static void pci_bus_restore_locked(struct pci_bus *bus)
56715671

56725672
list_for_each_entry(dev, &bus->devices, bus_list) {
56735673
pci_dev_restore(dev);
5674-
if (dev->subordinate)
5674+
if (dev->subordinate) {
5675+
pci_bridge_wait_for_secondary_bus(dev, "bus reset");
56755676
pci_bus_restore_locked(dev->subordinate);
5677+
}
56765678
}
56775679
}
56785680

@@ -5706,8 +5708,10 @@ static void pci_slot_restore_locked(struct pci_slot *slot)
57065708
if (!dev->slot || dev->slot != slot)
57075709
continue;
57085710
pci_dev_restore(dev);
5709-
if (dev->subordinate)
5711+
if (dev->subordinate) {
5712+
pci_bridge_wait_for_secondary_bus(dev, "slot reset");
57105713
pci_bus_restore_locked(dev->subordinate);
5714+
}
57115715
}
57125716
}
57135717

0 commit comments

Comments
 (0)