]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: don't be as insistent about adding dmi-to-pci-bridge or pci-bridge
authorLaine Stump <laine@laine.org>
Tue, 19 Apr 2016 21:37:51 +0000 (17:37 -0400)
committerLaine Stump <laine@laine.org>
Thu, 16 Jun 2016 17:32:11 +0000 (13:32 -0400)
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

index d1f8175259f6da1697dc60f36d88f75776f7a11c..8348460cf09bb937106b1fb56a8a03f05e6d570b 100644 (file)
@@ -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) {