43fe83
From b10d4b798bf274abe9cf51b1fe4b8105e9abab7b Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <b10d4b798bf274abe9cf51b1fe4b8105e9abab7b.1377873637.git.jdenemar@redhat.com>
43fe83
From: Laine Stump <laine@laine.org>
43fe83
Date: Tue, 6 Aug 2013 13:23:24 -0600
43fe83
Subject: [PATCH] qemu: fix handling of default/implicit devices for q35
43fe83
43fe83
This patch is part of the resolution to:
43fe83
43fe83
   https://bugzilla.redhat.com/show_bug.cgi?id=819968
43fe83
43fe83
This patch adds in special handling for a few devices that need to be
43fe83
treated differently for q35 domains:
43fe83
43fe83
usb - there is no implicit/default usb controller for the q35
43fe83
machinetype. This is done because normally the default usb controller
43fe83
is added to a domain by just adding "-usb" to the qemu commandline,
43fe83
and it's assumed that this will add a single piix3 usb1 controller at
43fe83
slot 1 function 2. That's not what happens when the machinetype is
43fe83
q35, though. Instead, adding -usb to the commandline adds 3 usb
43fe83
(version 2) controllers to the domain at slot 0x1D.{1,2,7}. Rather
43fe83
than having
43fe83
43fe83
  <controller type='usb' index='0'/>
43fe83
43fe83
translate into 3 separate devices on the PCI bus, it's cleaner to not
43fe83
automatically add a default usb device; one can always be added
43fe83
explicitly if desired. Or we may decide that on q35 machines, 3 usb
43fe83
controllers will be automatically added when none is given. But for
43fe83
this initial commit, at least we aren't locking ourselves into
43fe83
something we later won't want.
43fe83
43fe83
video - qemu always initializes the primary video device immediately
43fe83
after any integrated devices for the machinetype. Unless instructed
43fe83
otherwise (by using "-device vga..." instead of "-vga" which libvirt
43fe83
uses in many cases to work around deficiencies and bugs in various
43fe83
qemu versions) qemu will always pick the first unused slot. In the
43fe83
case of the "pc" machinetype and its derivatives, this is always slot
43fe83
2, but on q35 machinetypes, the first free slot is slot 1 (since the
43fe83
q35's integrated peripheral devices are placed in other slots,
43fe83
e.g. slot 0x1f). In order to make the PCI address of the video device
43fe83
predictable, that slot (1 or 2, depending on machinetype) is reserved
43fe83
even when no video device has been specified.
43fe83
43fe83
sata - a q35 machine always has a sata controller implicitly added at
43fe83
slot 0x1F, function 2. There is no way to avoid this controller, so we
43fe83
always add it. Note that the xml2xml tests for the pcie-root and q35
43fe83
cases were changed to use DO_TEST_DIFFERENT() so that we can check for
43fe83
the sata controller being automatically added. This is especially
43fe83
important because we can't check for it in the xml2argv output (it has
43fe83
no effect on that output since it's an implicit device).
43fe83
43fe83
ide - q35 has no ide controllers.
43fe83
43fe83
isa and smbus controllers - these two are always present in a q35 (at
43fe83
slot 0x1F functions 0 and 3) but we have no way of modelling them in
43fe83
our config. We do need to reserve those functions so that the user
43fe83
doesn't attempt to put anything else there though. (note that the "pc"
43fe83
machine type also has an ISA controller, which we also ignore).
43fe83
(cherry picked from commit c27b0bb171d9bdac10a93492a2a99eaa22746694)
43fe83
---
43fe83
 src/qemu/qemu_command.c                            | 159 ++++++++++++++++++++-
43fe83
 src/qemu/qemu_domain.c                             |   7 +
43fe83
 tests/qemuxml2argvdata/qemuxml2argv-pcie-root.args |   4 +-
43fe83
 tests/qemuxml2argvdata/qemuxml2argv-pcie-root.xml  |   1 -
43fe83
 tests/qemuxml2argvdata/qemuxml2argv-q35.args       |   3 +-
43fe83
 tests/qemuxml2argvtest.c                           |   2 +
43fe83
 .../qemuxml2xmlout-pcie-root.xml                   |   2 +-
43fe83
 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml    |  26 ++++
43fe83
 tests/qemuxml2xmltest.c                            |   2 +-
43fe83
 9 files changed, 198 insertions(+), 8 deletions(-)
43fe83
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml
43fe83
43fe83
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
43fe83
index 50f37ae..3e07360 100644
43fe83
--- a/src/qemu/qemu_command.c
43fe83
+++ b/src/qemu/qemu_command.c
43fe83
@@ -1686,6 +1686,18 @@ qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
43fe83
             break;
43fe83
         }
43fe83
     }
43fe83
+    /* SATA controllers aren't hot-plugged, and can be put in either a
43fe83
+     * PCI or PCIe slot
43fe83
+     */
43fe83
+    if (device->type == VIR_DOMAIN_DEVICE_CONTROLLER &&
43fe83
+        device->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA)
43fe83
+        flags = QEMU_PCI_CONNECT_TYPE_PCI | QEMU_PCI_CONNECT_TYPE_PCIE;
43fe83
+
43fe83
+    /* video cards aren't hot-plugged, and can be put in either a PCI
43fe83
+     * or PCIe slot
43fe83
+     */
43fe83
+    if (device->type == VIR_DOMAIN_DEVICE_VIDEO)
43fe83
+        flags = QEMU_PCI_CONNECT_TYPE_PCI | QEMU_PCI_CONNECT_TYPE_PCIE;
43fe83
 
43fe83
     /* Ignore implicit controllers on slot 0:0:1.0:
43fe83
      * implicit IDE controller on 0:0:1.1 (no qemu command line)
43fe83
@@ -2258,6 +2270,12 @@ qemuValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
43fe83
     }
43fe83
 
43fe83
     if (def->nvideos > 0) {
43fe83
+        /* Because the PIIX3 integrated IDE/USB controllers are
43fe83
+         * already at slot 1, when qemu looks for the first free slot
43fe83
+         * to place the VGA controller (which is always the first
43fe83
+         * device added after integrated devices), it *always* ends up
43fe83
+         * at slot 2.
43fe83
+         */
43fe83
         virDomainVideoDefPtr primaryVideo = def->videos[0];
43fe83
         if (primaryVideo->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
43fe83
             primaryVideo->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
43fe83
@@ -2318,6 +2336,136 @@ error:
43fe83
 }
43fe83
 
43fe83
 
43fe83
+static bool
43fe83
+qemuDomainMachineIsQ35(virDomainDefPtr def)
43fe83
+{
43fe83
+    return (STRPREFIX(def->os.machine, "pc-q35") ||
43fe83
+            STREQ(def->os.machine, "q35"));
43fe83
+}
43fe83
+
43fe83
+
43fe83
+static int
43fe83
+qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
43fe83
+                                    virQEMUCapsPtr qemuCaps,
43fe83
+                                    qemuDomainPCIAddressSetPtr addrs)
43fe83
+{
43fe83
+    size_t i;
43fe83
+    virDevicePCIAddress tmp_addr;
43fe83
+    bool qemuDeviceVideoUsable = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
43fe83
+    virDevicePCIAddressPtr addrptr;
43fe83
+    qemuDomainPCIConnectFlags flags = QEMU_PCI_CONNECT_TYPE_PCIE;
43fe83
+
43fe83
+    /* Verify that the first SATA controller is at 00:1F.2 */
43fe83
+    /* the q35 machine type *always* has a SATA controller at this address */
43fe83
+    for (i = 0; i < def->ncontrollers; i++) {
43fe83
+        if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA &&
43fe83
+            def->controllers[i]->idx == 0) {
43fe83
+            if (def->controllers[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
43fe83
+                if (def->controllers[i]->info.addr.pci.domain != 0 ||
43fe83
+                    def->controllers[i]->info.addr.pci.bus != 0 ||
43fe83
+                    def->controllers[i]->info.addr.pci.slot != 0x1F ||
43fe83
+                    def->controllers[i]->info.addr.pci.function != 2) {
43fe83
+                    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
43fe83
+                                   _("Primary SATA controller must have PCI address 0:0:1f.2"));
43fe83
+                    goto error;
43fe83
+                }
43fe83
+            } else {
43fe83
+                def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
43fe83
+                def->controllers[i]->info.addr.pci.domain = 0;
43fe83
+                def->controllers[i]->info.addr.pci.bus = 0;
43fe83
+                def->controllers[i]->info.addr.pci.slot = 0x1F;
43fe83
+                def->controllers[i]->info.addr.pci.function = 2;
43fe83
+            }
43fe83
+        }
43fe83
+    }
43fe83
+
43fe83
+    /* Reserve slot 0x1F function 0 (ISA bridge, not in config model)
43fe83
+     * and function 3 (SMBus, also not (yet) in config model). As with
43fe83
+     * the SATA controller, these devices are always present in a q35
43fe83
+     * machine; there is no way to not have them.
43fe83
+     */
43fe83
+    if (addrs->nbuses) {
43fe83
+        memset(&tmp_addr, 0, sizeof(tmp_addr));
43fe83
+        tmp_addr.slot = 0x1F;
43fe83
+        tmp_addr.function = 0;
43fe83
+        tmp_addr.multi = 1;
43fe83
+        if (qemuDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags,
43fe83
+                                            false, false) < 0)
43fe83
+           goto error;
43fe83
+        tmp_addr.function = 3;
43fe83
+        tmp_addr.multi = 0;
43fe83
+        if (qemuDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags,
43fe83
+                                            false, false) < 0)
43fe83
+           goto error;
43fe83
+    }
43fe83
+
43fe83
+    if (def->nvideos > 0) {
43fe83
+        /* NB: unlike the pc machinetypes, on q35 machinetypes the
43fe83
+         * integrated devices are at slot 0x1f, so when qemu looks for
43fe83
+         * the first free lot for the first VGA, it will always be at
43fe83
+         * slot 1 (which was used up by the integrated PIIX3 devices
43fe83
+         * on pc machinetypes).
43fe83
+         */
43fe83
+        virDomainVideoDefPtr primaryVideo = def->videos[0];
43fe83
+        if (primaryVideo->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
43fe83
+            primaryVideo->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
43fe83
+            primaryVideo->info.addr.pci.domain = 0;
43fe83
+            primaryVideo->info.addr.pci.bus = 0;
43fe83
+            primaryVideo->info.addr.pci.slot = 1;
43fe83
+            primaryVideo->info.addr.pci.function = 0;
43fe83
+            addrptr = &primaryVideo->info.addr.pci;
43fe83
+
43fe83
+            if (!qemuDomainPCIAddressValidate(addrs, addrptr, flags))
43fe83
+                goto error;
43fe83
+
43fe83
+            if (qemuDomainPCIAddressSlotInUse(addrs, addrptr)) {
43fe83
+                if (qemuDeviceVideoUsable) {
43fe83
+                    virResetLastError();
43fe83
+                    if (qemuDomainPCIAddressReserveNextSlot(addrs,
43fe83
+                                                            &primaryVideo->info,
43fe83
+                                                            flags) < 0)
43fe83
+                        goto error;
43fe83
+                } else {
43fe83
+                    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
43fe83
+                                   _("PCI address 0:0:1.0 is in use, "
43fe83
+                                     "QEMU needs it for primary video"));
43fe83
+                    goto error;
43fe83
+                }
43fe83
+            } else if (qemuDomainPCIAddressReserveSlot(addrs, addrptr, flags) < 0) {
43fe83
+                goto error;
43fe83
+            }
43fe83
+        } else if (!qemuDeviceVideoUsable) {
43fe83
+            if (primaryVideo->info.addr.pci.domain != 0 ||
43fe83
+                primaryVideo->info.addr.pci.bus != 0 ||
43fe83
+                primaryVideo->info.addr.pci.slot != 1 ||
43fe83
+                primaryVideo->info.addr.pci.function != 0) {
43fe83
+                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
43fe83
+                               _("Primary video card must have PCI address 0:0:1.0"));
43fe83
+                goto error;
43fe83
+            }
43fe83
+            /* If TYPE==PCI, then qemuCollectPCIAddress() function
43fe83
+             * has already reserved the address, so we must skip */
43fe83
+        }
43fe83
+    } else if (addrs->nbuses && !qemuDeviceVideoUsable) {
43fe83
+        memset(&tmp_addr, 0, sizeof(tmp_addr));
43fe83
+        tmp_addr.slot = 1;
43fe83
+
43fe83
+        if (qemuDomainPCIAddressSlotInUse(addrs, &tmp_addr)) {
43fe83
+            VIR_DEBUG("PCI address 0:0:1.0 in use, future addition of a video"
43fe83
+                      " device will not be possible without manual"
43fe83
+                      " intervention");
43fe83
+            virResetLastError();
43fe83
+        } else if (qemuDomainPCIAddressReserveSlot(addrs, &tmp_addr, flags) < 0) {
43fe83
+            goto error;
43fe83
+        }
43fe83
+    }
43fe83
+    return 0;
43fe83
+
43fe83
+error:
43fe83
+    return -1;
43fe83
+}
43fe83
+
43fe83
+
43fe83
 /*
43fe83
  * This assigns static PCI slots to all configured devices.
43fe83
  * The ordering here is chosen to match the ordering used
43fe83
@@ -2368,6 +2516,11 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
43fe83
         goto error;
43fe83
     }
43fe83
 
43fe83
+    if (qemuDomainMachineIsQ35(def) &&
43fe83
+        qemuDomainValidateDevicePCISlotsQ35(def, qemuCaps, addrs) < 0) {
43fe83
+        goto error;
43fe83
+    }
43fe83
+
43fe83
     /* PCI controllers */
43fe83
     for (i = 0; i < def->ncontrollers; i++) {
43fe83
         if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) {
43fe83
@@ -7679,6 +7832,9 @@ qemuBuildCommandLine(virConnectPtr conn,
43fe83
                                        _("SATA is not supported with this "
43fe83
                                          "QEMU binary"));
43fe83
                         goto error;
43fe83
+                    } else if (cont->idx == 0 && qemuDomainMachineIsQ35(def)) {
43fe83
+                        /* first SATA controller on Q35 machines is implicit */
43fe83
+                        continue;
43fe83
                     } else {
43fe83
                         char *devstr;
43fe83
 
43fe83
@@ -7692,6 +7848,7 @@ qemuBuildCommandLine(virConnectPtr conn,
43fe83
                     }
43fe83
                 } else if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
43fe83
                            cont->model == -1 &&
43fe83
+                           !qemuDomainMachineIsQ35(def) &&
43fe83
                            (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI) ||
43fe83
                             def->os.arch == VIR_ARCH_PPC64)) {
43fe83
                     if (usblegacy) {
43fe83
@@ -7716,7 +7873,7 @@ qemuBuildCommandLine(virConnectPtr conn,
43fe83
         }
43fe83
     }
43fe83
 
43fe83
-    if (usbcontroller == 0)
43fe83
+    if (usbcontroller == 0 && !qemuDomainMachineIsQ35(def))
43fe83
         virCommandAddArg(cmd, "-usb");
43fe83
 
43fe83
     for (i = 0; i < def->nhubs; i++) {
43fe83
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
43fe83
index bdbe5a9..dc72722 100644
43fe83
--- a/src/qemu/qemu_domain.c
43fe83
+++ b/src/qemu/qemu_domain.c
43fe83
@@ -700,6 +700,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
43fe83
                        void *opaque ATTRIBUTE_UNUSED)
43fe83
 {
43fe83
     bool addDefaultUSB = true;
43fe83
+    bool addImplicitSATA = false;
43fe83
     bool addPCIRoot = false;
43fe83
     bool addPCIeRoot = false;
43fe83
 
43fe83
@@ -722,6 +723,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
43fe83
             STREQ(def->os.machine, "q35")) {
43fe83
            addPCIeRoot = true;
43fe83
            addDefaultUSB = false;
43fe83
+           addImplicitSATA = true;
43fe83
            break;
43fe83
         }
43fe83
         if (!STRPREFIX(def->os.machine, "pc-0.") &&
43fe83
@@ -754,6 +756,11 @@ qemuDomainDefPostParse(virDomainDefPtr def,
43fe83
             def, VIR_DOMAIN_CONTROLLER_TYPE_USB, 0, -1) < 0)
43fe83
         return -1;
43fe83
 
43fe83
+    if (addImplicitSATA &&
43fe83
+        virDomainDefMaybeAddController(
43fe83
+            def, VIR_DOMAIN_CONTROLLER_TYPE_SATA, 0, -1) < 0)
43fe83
+        return -1;
43fe83
+
43fe83
     if (addPCIRoot &&
43fe83
         virDomainDefMaybeAddController(
43fe83
             def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0,
43fe83
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root.args b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root.args
43fe83
index 23db85c..cecef7b 100644
43fe83
--- a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root.args
43fe83
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root.args
43fe83
@@ -1,5 +1,5 @@
43fe83
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/libexec/qemu-kvm \
43fe83
 -S -M q35 -m 2048 -smp 2 -nographic -nodefaults \
43fe83
 -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
43fe83
--device i82801b11-bridge,id=pci.1,bus=pci.0,addr=0x1 \
43fe83
--device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 -usb
43fe83
+-device i82801b11-bridge,id=pci.1,bus=pci.0,addr=0x2 \
43fe83
+-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1
43fe83
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root.xml b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root.xml
43fe83
index 1aa5455..d7fb90c 100644
43fe83
--- a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root.xml
43fe83
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root.xml
43fe83
@@ -15,7 +15,6 @@
43fe83
   <devices>
43fe83
     <emulator>/usr/libexec/qemu-kvm</emulator>
43fe83
     <controller type='pci' index='0' model='pcie-root'/>
43fe83
-    <controller type='usb' index='0'/>
43fe83
     <memballoon model='none'/>
43fe83
   </devices>
43fe83
 </domain>
43fe83
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35.args b/tests/qemuxml2argvdata/qemuxml2argv-q35.args
43fe83
index ddff6f0..6c24407 100644
43fe83
--- a/tests/qemuxml2argvdata/qemuxml2argv-q35.args
43fe83
+++ b/tests/qemuxml2argvdata/qemuxml2argv-q35.args
43fe83
@@ -1,7 +1,6 @@
43fe83
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
43fe83
 /usr/libexec/qemu-kvm -S -M q35 -m 2048 -smp 2 -nographic -nodefaults \
43fe83
 -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
43fe83
--device i82801b11-bridge,id=pci.1,bus=pci.0,addr=0x1 \
43fe83
+-device i82801b11-bridge,id=pci.1,bus=pci.0,addr=0x2 \
43fe83
 -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \
43fe83
--usb \
43fe83
 -vga qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368
43fe83
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
43fe83
index aba0f88..0068d27 100644
43fe83
--- a/tests/qemuxml2argvtest.c
43fe83
+++ b/tests/qemuxml2argvtest.c
43fe83
@@ -995,11 +995,13 @@ mymain(void)
43fe83
     DO_TEST("pci-bridge-many-disks",
43fe83
             QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_PCI_BRIDGE);
43fe83
     DO_TEST("pcie-root",
43fe83
+            QEMU_CAPS_ICH9_AHCI,
43fe83
             QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
43fe83
             QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE);
43fe83
     DO_TEST("q35",
43fe83
             QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
43fe83
             QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
43fe83
+            QEMU_CAPS_ICH9_AHCI,
43fe83
             QEMU_CAPS_VGA, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
43fe83
             QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
43fe83
 
43fe83
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root.xml
43fe83
index 25c77f1..f10e85b 100644
43fe83
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root.xml
43fe83
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root.xml
43fe83
@@ -15,7 +15,7 @@
43fe83
   <devices>
43fe83
     <emulator>/usr/libexec/qemu-kvm</emulator>
43fe83
     <controller type='pci' index='0' model='pcie-root'/>
43fe83
-    <controller type='usb' index='0'/>
43fe83
+    <controller type='sata' index='0'/>
43fe83
     <controller type='pci' index='1' model='dmi-to-pci-bridge'/>
43fe83
     <controller type='pci' index='2' model='pci-bridge'/>
43fe83
     <memballoon model='none'/>
43fe83
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml
43fe83
new file mode 100644
43fe83
index 0000000..2a86e61
43fe83
--- /dev/null
43fe83
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml
43fe83
@@ -0,0 +1,26 @@
43fe83
+<domain type='qemu'>
43fe83
+  <name>q35-test</name>
43fe83
+  <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
43fe83
+  <memory unit='KiB'>2097152</memory>
43fe83
+  <currentMemory unit='KiB'>2097152</currentMemory>
43fe83
+  <vcpu placement='static' cpuset='0-1'>2</vcpu>
43fe83
+  <os>
43fe83
+    <type arch='x86_64' machine='q35'>hvm</type>
43fe83
+    <boot dev='hd'/>
43fe83
+  </os>
43fe83
+  <clock offset='utc'/>
43fe83
+  <on_poweroff>destroy</on_poweroff>
43fe83
+  <on_reboot>restart</on_reboot>
43fe83
+  <on_crash>destroy</on_crash>
43fe83
+  <devices>
43fe83
+    <emulator>/usr/libexec/qemu-kvm</emulator>
43fe83
+    <controller type='pci' index='0' model='pcie-root'/>
43fe83
+    <controller type='pci' index='1' model='dmi-to-pci-bridge'/>
43fe83
+    <controller type='pci' index='2' model='pci-bridge'/>
43fe83
+    <controller type='sata' index='0'/>
43fe83
+    <video>
43fe83
+      <model type='qxl' ram='65536' vram='18432' heads='1'/>
43fe83
+    </video>
43fe83
+    <memballoon model='none'/>
43fe83
+  </devices>
43fe83
+</domain>
43fe83
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
43fe83
index 8b4590a..5c6730d 100644
43fe83
--- a/tests/qemuxml2xmltest.c
43fe83
+++ b/tests/qemuxml2xmltest.c
43fe83
@@ -295,7 +295,7 @@ mymain(void)
43fe83
     DO_TEST_DIFFERENT("pci-autoadd-addr");
43fe83
     DO_TEST_DIFFERENT("pci-autoadd-idx");
43fe83
     DO_TEST_DIFFERENT("pcie-root");
43fe83
-    DO_TEST("q35");
43fe83
+    DO_TEST_DIFFERENT("q35");
43fe83
 
43fe83
     DO_TEST("hostdev-scsi-lsi");
43fe83
     DO_TEST("hostdev-scsi-virtio-scsi");
43fe83
-- 
43fe83
1.8.3.2
43fe83