diff mbox series

[RFC,08/11] PCI: Allow expanding the bridges

Message ID 20191024172157.878735-9-s.miroshnichenko@yadro.com (mailing list archive)
State Not Applicable
Headers show
Series PCI: hotplug: Movable bus numbers | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/merge (6b450d0404ca83dc131dadffd40c5aa6f7a603af)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/next (612ee81b9461475b5a5612c2e8d71559dd3c7920)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linus/master (f116b96685a046a89c25d4a6ba2da489145c8888)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/fixes (d10f60ae27d26d811e2a1bb39ded47df96d7499f)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linux-next (12d61c6996999e6562cbbed5f270d572248a11c5)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Sergei Miroshnichenko Oct. 24, 2019, 5:21 p.m. UTC
When hotplugging a bridge, the parent bus may not have [enough] reserved
bus numbers. So before rescanning the bus, set its subordinate number to
the maximum possible value: it is 255 when there is only one root bridge
in the domain.

During the PCI rescan, the subordinate bus number of every bus will be
contracted to the actual value.

Signed-off-by: Sergey Miroshnichenko <s.miroshnichenko@yadro.com>
---
 drivers/pci/probe.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 539f5d39bb6d..3494b5d265d5 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -3195,20 +3195,22 @@  static unsigned int pci_dev_count_res_mask(struct pci_dev *dev)
 	return res_mask;
 }
 
-static void pci_bus_rescan_prepare(struct pci_bus *bus)
+static void pci_bus_rescan_prepare(struct pci_bus *bus, int last_bus_number)
 {
 	struct pci_dev *dev;
 
 	if (bus->self)
 		pci_config_pm_runtime_get(bus->self);
 
+	bus->busn_res.end = last_bus_number;
+
 	list_for_each_entry(dev, &bus->devices, bus_list) {
 		struct pci_bus *child = dev->subordinate;
 
 		dev->res_mask = pci_dev_count_res_mask(dev);
 
 		if (child)
-			pci_bus_rescan_prepare(child);
+			pci_bus_rescan_prepare(child, last_bus_number);
 
 		if (dev->driver &&
 		    dev->driver->rescan_prepare)
@@ -3439,7 +3441,7 @@  unsigned int pci_rescan_bus(struct pci_bus *bus)
 
 	if (pci_can_move_bars) {
 		pcibios_root_bus_rescan_prepare(root);
-		pci_bus_rescan_prepare(root);
+		pci_bus_rescan_prepare(root, root->busn_res.end);
 		pci_bus_update_immovable_range(root);
 		pci_bus_release_root_bridge_resources(root);