[PATCH 1/2] qemu: don't be as insistent about adding dmi-to-pci-bridge or pci-bridge

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Previously there was no way to have a Q35 domain that didn't have
these two controllers. This patch skips their creation as long as
there are some other kinds of pci controllers at index 1 and 2
(e.g. some pcie-root-port controllers).

I'm hoping that soon we won't add them at all, plugging all devices
into auto-added pcie-*-port ports instead, but in the meantime this
makes it easier to experiment with alternative bus hierarchies.
---
 src/qemu/qemu_domain.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d1f8175..8348460 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1951,14 +1951,18 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
                                              VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT)) {
             goto cleanup;
         }
-        if (virDomainDefMaybeAddController(
-               def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 1,
-               VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE) < 0 ||
-            virDomainDefMaybeAddController(
-               def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 2,
-               VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE) < 0) {
+        /* add a dmi-to-pci-bridge and a pci-bridge if there are no pci controllers
+         * other than the pcie-root. This is so that there will be hot-pluggable
+         * PCI slots available
+         */
+        if (virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 1) < 0 &&
+            !virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 1,
+                                      VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE))
+            goto cleanup;
+        if (virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 2) < 0 &&
+            !virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 2,
+                                       VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE))
             goto cleanup;
-        }
     }
 
     if (addDefaultMemballoon && !def->memballoon) {
-- 
2.5.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]