]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: fix qemuDomainSupportsPCI() for ARM machines of "virt" machinetype
authorLaine Stump <laine@laine.org>
Tue, 11 Aug 2015 18:56:21 +0000 (14:56 -0400)
committerLaine Stump <laine@laine.org>
Tue, 11 Aug 2015 20:11:05 +0000 (16:11 -0400)
Commit e8d5517 updated the domain post-parse to automatically add
pcie-root et al for certain ARM "virt" machinetypes, but didn't update
the function qemuDomainSupportsPCI() which is called later on when we
are auto-assigning PCI addresses and default settings for the PCI
controller <model> and <target> attributes. The result was that PCI
addresses weren't assigned, and the controllers didn't have their
attribute default values set, leading to an error when the domain was
started, e.g.:

  internal error: autogenerated dmi-to-pci-bridge options not set

This patch adds the same check made in the earlier patch to
qemuDomainSupportsPCI(), so that PCI address auto-assignment and
target/model default values will be set.

src/qemu/qemu_command.c
src/qemu/qemu_domain.c

index ae0361840afa753bd5592b059079edcee6303fb6..84cbfe1b4def25e62092bdc8a74fb4a66f3499f9 100644 (file)
@@ -1742,7 +1742,7 @@ qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
 }
 
 static bool
-qemuDomainSupportsPCI(virDomainDefPtr def)
+qemuDomainSupportsPCI(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
 {
     if ((def->os.arch != VIR_ARCH_ARMV7L) && (def->os.arch != VIR_ARCH_AARCH64))
         return true;
@@ -1750,6 +1750,11 @@ qemuDomainSupportsPCI(virDomainDefPtr def)
     if (STREQ(def->os.machine, "versatilepb"))
         return true;
 
+    if ((STREQ(def->os.machine, "virt") ||
+         STRPREFIX(def->os.machine, "virt-")) &&
+        virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_GPEX))
+        return true;
+
     return false;
 }
 
@@ -2267,7 +2272,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
         if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, false)))
             goto cleanup;
 
-        if (qemuDomainSupportsPCI(def)) {
+        if (qemuDomainSupportsPCI(def, qemuCaps)) {
             if (qemuValidateDevicePCISlotsChipsets(def, qemuCaps, addrs) < 0)
                 goto cleanup;
 
index ad9a8ac1aaec4513ddf1551ff9dd2d5409ebc9be..abf52c9c38fa10ac9a61abb9dfe2d44e012755ee 100644 (file)
@@ -1093,6 +1093,9 @@ qemuDomainDefPostParse(virDomainDefPtr def,
             def, VIR_DOMAIN_CONTROLLER_TYPE_SATA, 0, -1) < 0)
         goto cleanup;
 
+    /* NB: any machine that sets addPCIRoot to true must also return
+     * true from the function qemuDomainSupportsPCI().
+     */
     if (addPCIRoot &&
         virDomainDefMaybeAddController(
             def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0,
@@ -1102,6 +1105,9 @@ qemuDomainDefPostParse(virDomainDefPtr def,
     /* When a machine has a pcie-root, make sure that there is always
      * a dmi-to-pci-bridge controller added as bus 1, and a pci-bridge
      * as bus 2, so that standard PCI devices can be connected
+     *
+     * NB: any machine that sets addPCIeRoot to true must also return
+     * true from the function qemuDomainSupportsPCI().
      */
     if (addPCIeRoot) {
         if (virDomainDefMaybeAddController(