43fe83
From d026ab3f17ab1d8b2b0e41c543dc09a3204319b3 Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <d026ab3f17ab1d8b2b0e41c543dc09a3204319b3.1377873637.git.jdenemar@redhat.com>
43fe83
From: Laine Stump <laine@laine.org>
43fe83
Date: Tue, 6 Aug 2013 13:23:23 -0600
43fe83
Subject: [PATCH] qemu: add dmi-to-pci-bridge controller
43fe83
43fe83
This patch is part of the resolution to:
43fe83
43fe83
   https://bugzilla.redhat.com/show_bug.cgi?id=819968
43fe83
43fe83
This PCI controller, named "dmi-to-pci-bridge" in the libvirt config,
43fe83
and implemented with qemu's "i82801b11-bridge" device, connects to a
43fe83
PCI Express slot (e.g. one of the slots provided by the pcie-root
43fe83
controller, aka "pcie.0" on the qemu commandline), and provides 31
43fe83
*non-hot-pluggable* PCI (*not* PCIe) slots, numbered 1-31.
43fe83
43fe83
Any time a machine is defined which has a pcie-root controller
43fe83
(i.e. any q35-based machinetype), libvirt will automatically add a
43fe83
dmi-to-pci-bridge controller if one doesn't exist, and also add a
43fe83
pci-bridge controller. The reasoning here is that any useful domain
43fe83
will have either an immediate (startup time) or eventual (subsequent
43fe83
hot-plug) need for a standard PCI slot; since the pcie-root controller
43fe83
only provides PCIe slots, we need to connect a dmi-to-pci-bridge
43fe83
controller to it in order to get a non-hot-plug PCI slot that we can
43fe83
then use to connect a pci-bridge - the slots provided by the
43fe83
pci-bridge will be both standard PCI and hot-pluggable.
43fe83
43fe83
Since pci-bridge devices themselves can not be hot-plugged into a
43fe83
running system (although you can hot-plug other devices into a
43fe83
pci-bridge's slots), any new pci-bridge controller that is added can
43fe83
(and will) be plugged into the dmi-to-pci-bridge as long as it has
43fe83
empty slots available.
43fe83
43fe83
This patch is also changing the qemuxml2xml-pcie test from a "DO_TEST"
43fe83
to a "DO_DIFFERENT_TEST". This is so that the "before" xml can omit
43fe83
the automatically added dmi-to-pci-bridge and pci-bridge devices, and
43fe83
the "after" xml can include it - this way we are testing if libvirt is
43fe83
properly adding these devices.
43fe83
(cherry picked from commit 62ac6b43541e46605d62a569d6480c3de9805b98)
43fe83
---
43fe83
 docs/formatdomain.html.in                          | 26 +++++++++++++++--
43fe83
 docs/schemas/domaincommon.rng                      |  1 +
43fe83
 src/conf/domain_conf.c                             |  3 +-
43fe83
 src/conf/domain_conf.h                             |  1 +
43fe83
 src/qemu/qemu_capabilities.c                       |  2 ++
43fe83
 src/qemu/qemu_capabilities.h                       |  1 +
43fe83
 src/qemu/qemu_command.c                            | 33 ++++++++++++++++++++++
43fe83
 src/qemu/qemu_domain.c                             | 21 ++++++++++----
43fe83
 tests/qemuxml2argvdata/qemuxml2argv-pcie-root.args |  3 +-
43fe83
 tests/qemuxml2argvdata/qemuxml2argv-q35.args       |  7 +++++
43fe83
 tests/qemuxml2argvdata/qemuxml2argv-q35.xml        | 25 ++++++++++++++++
43fe83
 tests/qemuxml2argvtest.c                           |  8 +++++-
43fe83
 .../qemuxml2xmlout-pcie-root.xml                   | 23 +++++++++++++++
43fe83
 tests/qemuxml2xmltest.c                            |  3 +-
43fe83
 14 files changed, 145 insertions(+), 12 deletions(-)
43fe83
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35.args
43fe83
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35.xml
43fe83
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root.xml
43fe83
43fe83
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
43fe83
index 55a6e71..562d991 100644
43fe83
--- a/docs/formatdomain.html.in
43fe83
+++ b/docs/formatdomain.html.in
43fe83
@@ -2338,11 +2338,14 @@
43fe83
 
43fe83
     

43fe83
       PCI controllers have an optional model attribute with
43fe83
-      possible values pci-root, pcie-root
43fe83
-      or pci-bridge.
43fe83
+      possible values pci-root, pcie-root,
43fe83
+      pci-bridge, or dmi-to-pci-bridge.
43fe83
       For machine types which provide an implicit PCI bus, the pci-root
43fe83
       controller with index=0 is auto-added and required to use PCI devices.
43fe83
       pci-root has no address.
43fe83
+      PCI bridges are auto-added if there are too many devices to fit on
43fe83
+      the one bus provided by pci-root, or a PCI bus number greater than zero
43fe83
+      was specified.
43fe83
       PCI bridges can also be specified manually, but their addresses should
43fe83
       only refer to PCI buses provided by already specified PCI controllers.
43fe83
       Leaving gaps in the PCI controller indexes might lead to an invalid
43fe83
@@ -2365,12 +2368,29 @@
43fe83
       the pcie-root controller with index=0 is auto-added to the
43fe83
       domain's configuration. pcie-root has also no address, provides
43fe83
       31 slots (numbered 1-31) and can only be used to attach PCIe
43fe83
-      devices.  (since 1.1.2).
43fe83
+      devices. In order to connect standard PCI devices on a system
43fe83
+      which has a pcie-root controller, a pci controller
43fe83
+      with model='dmi-to-pci-bridge' is automatically
43fe83
+      added. A dmi-to-pci-bridge controller plugs into a PCIe slot (as
43fe83
+      provided by pcie-root), and itself provides 31 standard PCI
43fe83
+      slots (which are not hot-pluggable). In order to have
43fe83
+      hot-pluggable PCI slots in the guest system, a pci-bridge
43fe83
+      controller will also be automatically created and connected to
43fe83
+      one of the slots of the auto-created dmi-to-pci-bridge
43fe83
+      controller; all guest devices with PCI addresses that are
43fe83
+      auto-determined by libvirt will be placed on this pci-bridge
43fe83
+      device.  (since 1.1.2).
43fe83
     

43fe83
 
43fe83
   ...
43fe83
   <devices>
43fe83
     <controller type='pci' index='0' model='pcie-root'/>
43fe83
+    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
43fe83
+      <address type='pci' domain='0' bus='0' slot='0xe' function='0'/>
43fe83
+    </controller>
43fe83
+    <controller type='pci' index='2' model='pci-bridge'>
43fe83
+      <address type='pci' domain='0' bus='1' slot='1' function='0'/>
43fe83
+    </controller>
43fe83
   </devices>
43fe83
   ...
43fe83
 
43fe83
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
43fe83
index e04be12..173359c 100644
43fe83
--- a/docs/schemas/domaincommon.rng
43fe83
+++ b/docs/schemas/domaincommon.rng
43fe83
@@ -1540,6 +1540,7 @@
43fe83
                 <value>pci-root</value>
43fe83
                 <value>pcie-root</value>
43fe83
                 <value>pci-bridge</value>
43fe83
+                <value>dmi-to-pci-bridge</value>
43fe83
               </choice>
43fe83
             </attribute>
43fe83
           </group>
43fe83
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
43fe83
index 02f1cf6..f46b17e 100644
43fe83
--- a/src/conf/domain_conf.c
43fe83
+++ b/src/conf/domain_conf.c
43fe83
@@ -311,7 +311,8 @@ VIR_ENUM_IMPL(virDomainController, VIR_DOMAIN_CONTROLLER_TYPE_LAST,
43fe83
 VIR_ENUM_IMPL(virDomainControllerModelPCI, VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST,
43fe83
               "pci-root",
43fe83
               "pcie-root",
43fe83
-              "pci-bridge")
43fe83
+              "pci-bridge",
43fe83
+              "dmi-to-pci-bridge")
43fe83
 
43fe83
 VIR_ENUM_IMPL(virDomainControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
43fe83
               "auto",
43fe83
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
43fe83
index 68f36fd..536fc96 100644
43fe83
--- a/src/conf/domain_conf.h
43fe83
+++ b/src/conf/domain_conf.h
43fe83
@@ -770,6 +770,7 @@ typedef enum {
43fe83
     VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT,
43fe83
     VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT,
43fe83
     VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE,
43fe83
+    VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE,
43fe83
 
43fe83
     VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST
43fe83
 } virDomainControllerModelPCI;
43fe83
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
43fe83
index 08406b8..47cc07a 100644
43fe83
--- a/src/qemu/qemu_capabilities.c
43fe83
+++ b/src/qemu/qemu_capabilities.c
43fe83
@@ -234,6 +234,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
43fe83
 
43fe83
               "vnc-share-policy", /* 150 */
43fe83
               "device-del-event",
43fe83
+              "dmi-to-pci-bridge",
43fe83
     );
43fe83
 
43fe83
 struct _virQEMUCaps {
43fe83
@@ -1381,6 +1382,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
43fe83
     { "pci-bridge", QEMU_CAPS_DEVICE_PCI_BRIDGE },
43fe83
     { "vfio-pci", QEMU_CAPS_DEVICE_VFIO_PCI },
43fe83
     { "scsi-generic", QEMU_CAPS_DEVICE_SCSI_GENERIC },
43fe83
+    { "i82801b11-bridge", QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE },
43fe83
 };
43fe83
 
43fe83
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
43fe83
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
43fe83
index f5f685d..074e55d 100644
43fe83
--- a/src/qemu/qemu_capabilities.h
43fe83
+++ b/src/qemu/qemu_capabilities.h
43fe83
@@ -190,6 +190,7 @@ enum virQEMUCapsFlags {
43fe83
     QEMU_CAPS_MLOCK              = 149, /* -realtime mlock=on|off */
43fe83
     QEMU_CAPS_VNC_SHARE_POLICY   = 150, /* set display sharing policy */
43fe83
     QEMU_CAPS_DEVICE_DEL_EVENT   = 151, /* DEVICE_DELETED event */
43fe83
+    QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE  = 152, /* -device i82801b11-bridge */
43fe83
 
43fe83
     QEMU_CAPS_LAST,                   /* this must always be the last item */
43fe83
 };
43fe83
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
43fe83
index 8ac39ff..50f37ae 100644
43fe83
--- a/src/qemu/qemu_command.c
43fe83
+++ b/src/qemu/qemu_command.c
43fe83
@@ -1561,6 +1561,13 @@ qemuDomainPCIAddressBusSetModel(qemuDomainPCIAddressBusPtr bus,
43fe83
         bus->minSlot = 1;
43fe83
         bus->maxSlot = QEMU_PCI_ADDRESS_SLOT_LAST;
43fe83
         break;
43fe83
+    case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE:
43fe83
+        /* slots 1 - 31, standard PCI slots,
43fe83
+         * but *not* hot-pluggable */
43fe83
+        bus->flags = QEMU_PCI_CONNECT_TYPE_PCI;
43fe83
+        bus->minSlot = 1;
43fe83
+        bus->maxSlot = QEMU_PCI_ADDRESS_SLOT_LAST;
43fe83
+        break;
43fe83
     default:
43fe83
         virReportError(VIR_ERR_INTERNAL_ERROR,
43fe83
                        _("Invalid PCI controller model %d"), model);
43fe83
@@ -1669,6 +1676,12 @@ qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
43fe83
              */
43fe83
             flags = QEMU_PCI_CONNECT_TYPE_PCI;
43fe83
             break;
43fe83
+        case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE:
43fe83
+            /* pci-bridge needs a PCIe slot, but it isn't
43fe83
+             * hot-pluggable, so it doesn't need a hot-pluggable slot.
43fe83
+             */
43fe83
+            flags = QEMU_PCI_CONNECT_TYPE_PCIE;
43fe83
+            break;
43fe83
         default:
43fe83
             break;
43fe83
         }
43fe83
@@ -2372,6 +2385,12 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
43fe83
                  */
43fe83
                 flags = QEMU_PCI_CONNECT_TYPE_PCI;
43fe83
                 break;
43fe83
+            case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE:
43fe83
+                /* dmi-to-pci-bridge requires a non-hotplug PCIe
43fe83
+                 * slot
43fe83
+                 */
43fe83
+                flags = QEMU_PCI_CONNECT_TYPE_PCIE;
43fe83
+                break;
43fe83
             default:
43fe83
                 flags = QEMU_PCI_CONNECT_HOTPLUGGABLE | QEMU_PCI_CONNECT_TYPE_PCI;
43fe83
                 break;
43fe83
@@ -4351,6 +4370,20 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
43fe83
             virBufferAsprintf(&buf, "pci-bridge,chassis_nr=%d,id=pci.%d",
43fe83
                               def->idx, def->idx);
43fe83
             break;
43fe83
+        case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE:
43fe83
+            if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE)) {
43fe83
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
43fe83
+                               _("The dmi-to-pci-bridge (i82801b11-bridge) "
43fe83
+                                 "controller is not supported in this QEMU binary"));
43fe83
+                goto error;
43fe83
+            }
43fe83
+            if (def->idx == 0) {
43fe83
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
43fe83
+                               _("dmi-to-pci-bridge index should be > 0"));
43fe83
+                goto error;
43fe83
+            }
43fe83
+            virBufferAsprintf(&buf, "i82801b11-bridge,id=pci.%d", def->idx);
43fe83
+            break;
43fe83
         case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
43fe83
         case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
43fe83
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
43fe83
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
43fe83
index 40b813c..bdbe5a9 100644
43fe83
--- a/src/qemu/qemu_domain.c
43fe83
+++ b/src/qemu/qemu_domain.c
43fe83
@@ -760,12 +760,23 @@ qemuDomainDefPostParse(virDomainDefPtr def,
43fe83
             VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) < 0)
43fe83
         return -1;
43fe83
 
43fe83
-    if (addPCIeRoot &&
43fe83
-        virDomainDefMaybeAddController(
43fe83
-            def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0,
43fe83
-            VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) < 0)
43fe83
+    /* When a machine has a pcie-root, make sure that there is always
43fe83
+     * a dmi-to-pci-bridge controller added as bus 1, and a pci-bridge
43fe83
+     * as bus 2, so that standard PCI devices can be connected
43fe83
+     */
43fe83
+    if (addPCIeRoot) {
43fe83
+        if (virDomainDefMaybeAddController(
43fe83
+                def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0,
43fe83
+                VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) < 0 ||
43fe83
+            virDomainDefMaybeAddController(
43fe83
+                def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 1,
43fe83
+                VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE) < 0 ||
43fe83
+            virDomainDefMaybeAddController(
43fe83
+                def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 2,
43fe83
+                VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE) < 0) {
43fe83
         return -1;
43fe83
-
43fe83
+        }
43fe83
+    }
43fe83
     return 0;
43fe83
 }
43fe83
 
43fe83
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root.args b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root.args
43fe83
index e937189..23db85c 100644
43fe83
--- a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root.args
43fe83
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root.args
43fe83
@@ -1,4 +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 pci-bridge,chassis_nr=1,id=pci.1,bus=pci.1,addr=0x1 -usb
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
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35.args b/tests/qemuxml2argvdata/qemuxml2argv-q35.args
43fe83
new file mode 100644
43fe83
index 0000000..ddff6f0
43fe83
--- /dev/null
43fe83
+++ b/tests/qemuxml2argvdata/qemuxml2argv-q35.args
43fe83
@@ -0,0 +1,7 @@
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 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/qemuxml2argvdata/qemuxml2argv-q35.xml b/tests/qemuxml2argvdata/qemuxml2argv-q35.xml
43fe83
new file mode 100644
43fe83
index 0000000..3541b14
43fe83
--- /dev/null
43fe83
+++ b/tests/qemuxml2argvdata/qemuxml2argv-q35.xml
43fe83
@@ -0,0 +1,25 @@
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
+    <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/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
43fe83
index 57c6989..aba0f88 100644
43fe83
--- a/tests/qemuxml2argvtest.c
43fe83
+++ b/tests/qemuxml2argvtest.c
43fe83
@@ -995,7 +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_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE);
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_VGA, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
43fe83
+            QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
43fe83
 
43fe83
     DO_TEST("hostdev-scsi-lsi", QEMU_CAPS_DRIVE,
43fe83
             QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
43fe83
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root.xml
43fe83
new file mode 100644
43fe83
index 0000000..25c77f1
43fe83
--- /dev/null
43fe83
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root.xml
43fe83
@@ -0,0 +1,23 @@
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='usb' 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
+  </devices>
43fe83
+</domain>
43fe83
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
43fe83
index ea511b8..8b4590a 100644
43fe83
--- a/tests/qemuxml2xmltest.c
43fe83
+++ b/tests/qemuxml2xmltest.c
43fe83
@@ -294,7 +294,8 @@ mymain(void)
43fe83
     DO_TEST_DIFFERENT("pci-bridge-many-disks");
43fe83
     DO_TEST_DIFFERENT("pci-autoadd-addr");
43fe83
     DO_TEST_DIFFERENT("pci-autoadd-idx");
43fe83
-    DO_TEST("pcie-root");
43fe83
+    DO_TEST_DIFFERENT("pcie-root");
43fe83
+    DO_TEST("q35");
43fe83
 
43fe83
     DO_TEST("hostdev-scsi-lsi");
43fe83
     DO_TEST("hostdev-scsi-virtio-scsi");
43fe83
-- 
43fe83
1.8.3.2
43fe83