[PATCH 3/3] conf: auto-add a pcie-root-port when needed while plugging in pcie-to-pci-bridge

Laine Stump via Devel posted 3 patches 1 week, 4 days ago
[PATCH 3/3] conf: auto-add a pcie-root-port when needed while plugging in pcie-to-pci-bridge
Posted by Laine Stump via Devel 1 week, 4 days ago
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 <laine@redhat.com>
---
 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.51.0