[PATCH -v11 30/30] PCI: Don't shrink too much for hotplug bridge

From: Yinghai Lu
Date: Mon Mar 19 2012 - 01:47:11 EST


Otherwise may have problem later if we plug pcie cards with bridges.

Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>
---
drivers/pci/probe.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 01ba48e..38e0448 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -782,6 +782,7 @@ static int __devinit pci_bridge_check_busn_broken(struct pci_bus *bus,

static unsigned int __devinit __pci_scan_child_bus(struct pci_bus *bus,
int pass);
+#define HOTPLUG_BRIDGE_RESERVE_BUSNR 8
/*
* If it's a bridge, configure it and scan the bus behind it.
* For CardBus bridges, we don't scan behind as the devices will
@@ -993,6 +994,11 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
/*
* Set the subordinate bus number to its real value.
*/
+ if (dev->is_hotplug_bridge && child->subordinate > max &&
+ (max - child->secondary) < HOTPLUG_BRIDGE_RESERVE_BUSNR)
+ max = min_t(int, child->secondary +
+ HOTPLUG_BRIDGE_RESERVE_BUSNR,
+ child->subordinate);
shrink_size = child->subordinate - max;
child->subordinate = max;
pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max);
--
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/