From 96d1bfee3eb5ed1d87901c443131d77b7f2fd10d Mon Sep 17 00:00:00 2001 From: Laine Stump Date: Sun, 24 Aug 2025 23:32:39 -0400 Subject: [PATCH] conf: auto-add a pcie-root-port when needed while plugging in pcie-to-pci-bridge MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This will almost surely never come up during any normal operation[*], which is likely why this wasn't done when pcie-to-pci-bridge support was added back in the before-fore times. It's pretty simple to support though - a pcie-to-pci-bridge plugs into a pcie-root-port just like any other pcie device, and if there isn't an open slot on an existing pcie-root-port, we can just add one. ([*] in real life, a pcie-to-pci-bridge is only auto-added by libvirt itself, while this function is dealing with the followup to *user added* devices. Also each pcie-to-pci-bridge has 32 slots, and it's unlikely a domain with pcie support would be wanting more than 32 conventional PCI (i.e. not PCIe) devices) Signed-off-by: Laine Stump Reviewed-by: Ján Tomko --- src/conf/domain_addr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index ef1b2bd69a..6aa5ac1b9f 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -691,7 +691,8 @@ virDomainPCIAddressSetGrow(virDomainPCIAddressSet *addrs, } } } else if (flags & (VIR_PCI_CONNECT_TYPE_PCIE_DEVICE | - VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT)) { + VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT | + VIR_PCI_CONNECT_TYPE_PCIE_TO_PCI_BRIDGE)) { model = VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT; } else { /* The types of devices that we can't auto-add a controller for: -- 2.47.3