diff mbox

core/pci.c: Don't reserve PCI slots for non-pluggable slots

Message ID 1494316852-17883-1-git-send-email-alistair@popple.id.au
State Accepted
Headers show

Commit Message

Alistair Popple May 9, 2017, 8 a.m. UTC
If a downstream PCIe link is down we currently reserve a number of
busses for hot pluggable devices. However we do not need to do this
when we know a slot is not hotplug capable.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
---
 core/pci.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Gavin Shan May 9, 2017, 11:28 p.m. UTC | #1
On Tue, May 09, 2017 at 06:00:52PM +1000, Alistair Popple wrote:
>If a downstream PCIe link is down we currently reserve a number of
>busses for hot pluggable devices. However we do not need to do this
>when we know a slot is not hotplug capable.
>
>Signed-off-by: Alistair Popple <alistair@popple.id.au>

Acked-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Stewart Smith May 10, 2017, 5:30 a.m. UTC | #2
Alistair Popple <alistair@popple.id.au> writes:
> If a downstream PCIe link is down we currently reserve a number of
> busses for hot pluggable devices. However we do not need to do this
> when we know a slot is not hotplug capable.
>
> Signed-off-by: Alistair Popple <alistair@popple.id.au>

Thanks, merged to master as of 8b1df791543bd0c390df01463a1601d4b5eb67ea
diff mbox

Patch

diff --git a/core/pci.c b/core/pci.c
index a8b4b69..d69eb28 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -751,13 +751,16 @@  uint8_t pci_scan_bus(struct phb *phb, uint8_t bus, uint8_t max_bus,
 			max_sub = pci_scan_bus(phb, next_bus, max_bus,
 					       &pd->children, pd, true);
 		} else if (!use_max) {
-			/* XXX Empty bridge... we leave room for hotplug
-			 * slots etc.. but we should be smarter at figuring
-			 * out if this is actually a hotpluggable one
+			/* Empty bridge. We leave room for hotplug
+			 * slots if the downstream port is pluggable.
 			 */
-			max_sub = next_bus + 4;
-			if (max_sub > max_bus)
-				max_sub = max_bus;
+			if (pd->slot && !pd->slot->pluggable)
+				max_sub = next_bus;
+			else {
+				max_sub = next_bus + 4;
+				if (max_sub > max_bus)
+					max_sub = max_bus;
+			}
 		}
 
 		/* Update the max subordinate as described previously */