diff mbox series

[17/18] qemu: Support virtio-serial controller model=virtio-{non-}transitional

Message ID b3500d323b5d4c5ddad79d5429ae1952c3bb1d19.1547746868.git.crobinso@redhat.com
State New
Headers show
Series qemu: virtio-{non-}transitional support | expand

Commit Message

Cole Robinson Jan. 17, 2019, 5:52 p.m. UTC
Add controller type='virtio-serial' model handling for virtio
transitional devices. Ex:

  <controller type='virtio-serial' model='virtio-transitional'/>

* "virtio-transitional" maps to qemu "virtio-serial-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-serial-pci-non-transitional"

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 docs/formatdomain.html.in                     |  4 +++-
 docs/schemas/domaincommon.rng                 |  9 +++++++++
 src/conf/domain_conf.c                        | 10 ++++++++++
 src/conf/domain_conf.h                        | 10 ++++++++++
 src/qemu/qemu_capabilities.c                  |  6 ++++++
 src/qemu/qemu_capabilities.h                  |  4 ++++
 src/qemu/qemu_command.c                       | 11 +++++++++-
 src/qemu/qemu_domain_address.c                |  2 ++
 .../caps_4.0.0.x86_64.xml                     |  2 ++
 .../virtio-non-transitional.x86_64-3.1.0.args | 15 ++++++++------
 ...virtio-non-transitional.x86_64-latest.args | 15 ++++++++------
 .../virtio-non-transitional.xml               |  1 +
 .../virtio-transitional.x86_64-3.1.0.args     | 13 ++++++------
 .../virtio-transitional.x86_64-latest.args    | 13 ++++++------
 .../qemuxml2argvdata/virtio-transitional.xml  |  1 +
 .../virtio-non-transitional.xml               | 20 +++++++++++++------
 .../virtio-transitional.xml                   | 15 ++++++++------
 17 files changed, 113 insertions(+), 38 deletions(-)

-- 
2.20.1

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

Comments

Andrea Bolognani Jan. 21, 2019, 4:59 p.m. UTC | #1
On Thu, 2019-01-17 at 12:52 -0500, Cole Robinson wrote:
[...]
> +typedef enum {

> +    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_DEFAULT = -1,

> +    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO,

> +    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL,

> +    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_NON_TRANSITIONAL,

> +

> +    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_LAST

> +} virDomainControllerModelVirtioSerial;


Do we even need MODEL_VIRTIO_SERIAL_DEFAULT here? Honest question :)

[...]
> @@ -670,6 +670,8 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,

>              break;

>  

>          case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:

> +            if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL)

> +                return pciFlags;

>              return virtioFlags;


I'd prefer to see the kind of switch statement you added for
VIR_DOMAIN_DEVICE_VSOCK here as well.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Cole Robinson Jan. 22, 2019, 5:46 p.m. UTC | #2
On 01/21/2019 11:59 AM, Andrea Bolognani wrote:
> On Thu, 2019-01-17 at 12:52 -0500, Cole Robinson wrote:

> [...]

>> +typedef enum {

>> +    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_DEFAULT = -1,

>> +    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO,

>> +    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL,

>> +    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_NON_TRANSITIONAL,

>> +

>> +    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_LAST

>> +} virDomainControllerModelVirtioSerial;

> 

> Do we even need MODEL_VIRTIO_SERIAL_DEFAULT here? Honest question :)

> 


The DEFAULT = -1 is the pattern used by other controller models, and I
believe it's kinda enforced by ControllerDefNew which sets cont->model =
-1. It might not serve any purpose in this particular case besides
consistency.

Working in this area made me explore enum DEFAULT/NONE naming a bit and
there's definitely a lot of room for making things consistent.
controller models are the oddball here with the -1 value but I think
that's to do with some old XML migration compat that can be unwound in a
different way. Another task for another day

> [...]

>> @@ -670,6 +670,8 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,

>>              break;

>>  

>>          case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:

>> +            if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL)

>> +                return pciFlags;

>>              return virtioFlags;

> 

> I'd prefer to see the kind of switch statement you added for

> VIR_DOMAIN_DEVICE_VSOCK here as well.

> 


Okay I'll try to expand that pattern out to other patches too

- Cole

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Andrea Bolognani Jan. 23, 2019, 11:34 a.m. UTC | #3
On Tue, 2019-01-22 at 12:46 -0500, Cole Robinson wrote:
> On 01/21/2019 11:59 AM, Andrea Bolognani wrote:

> > On Thu, 2019-01-17 at 12:52 -0500, Cole Robinson wrote:

> > [...]

> > > +typedef enum {

> > > +    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_DEFAULT = -1,

> > > +    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO,

> > > +    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL,

> > > +    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_NON_TRANSITIONAL,

> > > +

> > > +    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_LAST

> > > +} virDomainControllerModelVirtioSerial;

> > 

> > Do we even need MODEL_VIRTIO_SERIAL_DEFAULT here? Honest question :)

> 

> The DEFAULT = -1 is the pattern used by other controller models, and I

> believe it's kinda enforced by ControllerDefNew which sets cont->model =

> -1. It might not serve any purpose in this particular case besides

> consistency.


I see.

> Working in this area made me explore enum DEFAULT/NONE naming a bit and

> there's definitely a lot of room for making things consistent.

> controller models are the oddball here with the -1 value but I think

> that's to do with some old XML migration compat that can be unwound in a

> different way. Another task for another day


Definitely :)

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox series

Patch

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index bdf533ba3e..1bba2ca284 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4135,7 +4135,9 @@ 
         <dd>The <code>virtio-serial</code> controller has two additional
         optional attributes <code>ports</code> and <code>vectors</code>,
         which control how many devices can be connected through the
-        controller.</dd>
+        controller. <span class="since">Since 5.1.0</span>, it
+        supports an optional attribute <code>model</code> which can
+        be 'virtio', 'virtio-transitional', or 'virtio-non-transitional'</dd>
         <dt><code>scsi</code></dt>
         <dd>A <code>scsi</code> controller has an optional attribute
         <code>model</code>, which is one of 'auto', 'buslogic', 'ibmvscsi',
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 242f237360..99987b4a3a 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2311,6 +2311,15 @@ 
             <attribute name="type">
               <value>virtio-serial</value>
             </attribute>
+            <optional>
+              <attribute name="model">
+                <choice>
+                  <value>virtio</value>
+                  <value>virtio-transitional</value>
+                  <value>virtio-non-transitional</value>
+                </choice>
+              </attribute>
+            </optional>
             <optional>
               <attribute name="ports">
                 <ref name="unsignedInt"/>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 76955b6d78..46fbc0befc 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -384,6 +384,12 @@  VIR_ENUM_IMPL(virDomainControllerModelIDE, VIR_DOMAIN_CONTROLLER_MODEL_IDE_LAST,
               "piix4",
               "ich6")
 
+VIR_ENUM_IMPL(virDomainControllerModelVirtioSerial,
+              VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_LAST,
+              "virtio",
+              "virtio-transitional",
+              "virtio-non-transitional")
+
 VIR_ENUM_IMPL(virDomainFS, VIR_DOMAIN_FS_TYPE_LAST,
               "mount",
               "block",
@@ -10222,6 +10228,8 @@  virDomainControllerModelTypeFromString(const virDomainControllerDef *def,
         return virDomainControllerModelPCITypeFromString(model);
     else if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE)
         return virDomainControllerModelIDETypeFromString(model);
+    else if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL)
+        return virDomainControllerModelVirtioSerialTypeFromString(model);
 
     return -1;
 }
@@ -10239,6 +10247,8 @@  virDomainControllerModelTypeToString(virDomainControllerDefPtr def,
         return virDomainControllerModelPCITypeToString(model);
     else if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE)
         return virDomainControllerModelIDETypeToString(model);
+    else if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL)
+        return virDomainControllerModelVirtioSerialTypeToString(model);
 
     return NULL;
 }
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9771b0b3d7..0d801b0d6d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -791,6 +791,15 @@  typedef enum {
     VIR_DOMAIN_CONTROLLER_MODEL_IDE_LAST
 } virDomainControllerModelIDE;
 
+typedef enum {
+    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_DEFAULT = -1,
+    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO,
+    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL,
+    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_NON_TRANSITIONAL,
+
+    VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_LAST
+} virDomainControllerModelVirtioSerial;
+
 # define IS_USB2_CONTROLLER(ctrl) \
     (((ctrl)->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) && \
      ((ctrl)->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1 || \
@@ -3467,6 +3476,7 @@  VIR_ENUM_DECL(virDomainControllerPCIModelName)
 VIR_ENUM_DECL(virDomainControllerModelSCSI)
 VIR_ENUM_DECL(virDomainControllerModelUSB)
 VIR_ENUM_DECL(virDomainControllerModelIDE)
+VIR_ENUM_DECL(virDomainControllerModelVirtioSerial)
 VIR_ENUM_DECL(virDomainFS)
 VIR_ENUM_DECL(virDomainFSDriver)
 VIR_ENUM_DECL(virDomainFSAccessMode)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 0838f2a406..1ddb4317f3 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -544,6 +544,10 @@  VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
               "virtio-input-host-pci-non-transitional",
               "virtio-scsi-pci-transitional",
               "virtio-scsi-pci-non-transitional",
+
+              /* 345 */
+              "virtio-serial-pci-transitional",
+              "virtio-serial-pci-non-transitional",
     );
 
 
@@ -1150,6 +1154,8 @@  struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
     {"virtio-input-host-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_NON_TRANSITIONAL},
     {"virtio-scsi-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_SCSI_TRANSITIONAL},
     {"virtio-scsi-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_SCSI_NON_TRANSITIONAL},
+    {"virtio-serial-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_SERIAL_TRANSITIONAL},
+    {"virtio-serial-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_SERIAL_NON_TRANSITIONAL},
 };
 
 static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index d23bd251f2..0bb215130b 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -529,6 +529,10 @@  typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
     QEMU_CAPS_DEVICE_VIRTIO_SCSI_TRANSITIONAL, /* -device virtio-scsi-pci-transitional */
     QEMU_CAPS_DEVICE_VIRTIO_SCSI_NON_TRANSITIONAL, /* -device virtio-scsi-pci-non-transitional */
 
+    /* 345 */
+    QEMU_CAPS_DEVICE_VIRTIO_SERIAL_TRANSITIONAL, /* -device virtio-serial-pci-transitional */
+    QEMU_CAPS_DEVICE_VIRTIO_SERIAL_NON_TRANSITIONAL, /* -device virtio-serial-pci-non-transitional */
+
     QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;
 
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 50042b2919..940d55b1b1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -514,6 +514,12 @@  qemuBuildVirtioTransitional(virBufferPtr buf,
                 tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SCSI_TRANSITIONAL;
                 ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SCSI_NON_TRANSITIONAL;
                 break;
+            } else if (strstr(baseName, "serial")) {
+                has_tmodel = model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL;
+                has_ntmodel = model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_NON_TRANSITIONAL;
+                tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SERIAL_TRANSITIONAL;
+                ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SERIAL_NON_TRANSITIONAL;
+                break;
             }
             return 0;
 
@@ -3026,7 +3032,10 @@  qemuBuildControllerDevStr(const virDomainDef *domainDef,
         break;
 
     case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:
-        if (qemuBuildVirtioDevStr(&buf, "virtio-serial", def->info.type) < 0)
+        if (qemuBuildVirtioTransitional(&buf, "virtio-serial", qemuCaps,
+                                        def->info.type,
+                                        def->model, NULL,
+                                        VIR_DOMAIN_DEVICE_CONTROLLER) < 0)
             goto error;
 
         virBufferAsprintf(&buf, ",id=%s", def->info.alias);
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 9d07fa133e..50cc47b7b3 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -670,6 +670,8 @@  qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
             break;
 
         case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:
+            if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL)
+                return pciFlags;
             return virtioFlags;
 
         case VIR_DOMAIN_CONTROLLER_TYPE_FDC:
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
index aa9a0d2d3b..aaf7d404eb 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
@@ -230,6 +230,8 @@ 
   <flag name='virtio-input-host-pci-non-transitional'/>
   <flag name='virtio-scsi-pci-transitional'/>
   <flag name='virtio-scsi-pci-non-transitional'/>
+  <flag name='virtio-serial-pci-transitional'/>
+  <flag name='virtio-serial-pci-non-transitional'/>
   <version>3001050</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>446361</microcodeVersion>
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
index 6fea53fa6e..60ef581744 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
@@ -35,9 +35,12 @@  addr=0x1 \
 -device pcie-root-port,port=0x10,chassis=9,id=pci.9,bus=pcie.0,\
 multifunction=on,addr=0x2 \
 -device pcie-root-port,port=0x11,chassis=10,id=pci.10,bus=pcie.0,addr=0x2.0x1 \
+-device pcie-root-port,port=0x12,chassis=11,id=pci.11,bus=pcie.0,addr=0x2.0x2 \
 -device virtio-scsi-pci,disable-legacy=on,id=scsi0,bus=pci.3,addr=0x0 \
+-device virtio-serial-pci,disable-legacy=on,id=virtio-serial0,bus=pci.4,\
+addr=0x0 \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci,disable-legacy=on,scsi=off,bus=pci.4,addr=0x0,\
+-device virtio-blk-pci,disable-legacy=on,scsi=off,bus=pci.5,addr=0x0,\
 drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
 -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
 -device virtio-9p-pci,disable-legacy=on,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,\
@@ -46,15 +49,15 @@  bus=pci.1,addr=0x0 \
 -device virtio-net-pci,disable-legacy=on,netdev=hostnet0,id=net0,\
 mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \
 -device virtio-input-host-pci,disable-legacy=on,id=input0,\
-evdev=/dev/input/event1234,bus=pci.8,addr=0x0 \
+evdev=/dev/input/event1234,bus=pci.9,addr=0x0 \
 -device vhost-scsi-pci,disable-legacy=on,wwpn=naa.5123456789abcde0,vhostfd=3,\
-id=hostdev0,bus=pci.5,addr=0x0 \
--device virtio-balloon-pci,disable-legacy=on,id=balloon0,bus=pci.6,addr=0x0 \
+id=hostdev0,bus=pci.6,addr=0x0 \
+-device virtio-balloon-pci,disable-legacy=on,id=balloon0,bus=pci.7,addr=0x0 \
 -object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci,disable-legacy=on,rng=objrng0,id=rng0,bus=pci.7,\
+-device virtio-rng-pci,disable-legacy=on,rng=objrng0,id=rng0,bus=pci.8,\
 addr=0x0 \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
 resourcecontrol=deny \
 -device vhost-vsock-pci,disable-legacy=on,id=vsock0,guest-cid=4,vhostfd=6789,\
-bus=pci.9,addr=0x0 \
+bus=pci.10,addr=0x0 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index ad644de35d..f9cc136f70 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -35,9 +35,12 @@  addr=0x1 \
 -device pcie-root-port,port=0x10,chassis=9,id=pci.9,bus=pcie.0,\
 multifunction=on,addr=0x2 \
 -device pcie-root-port,port=0x11,chassis=10,id=pci.10,bus=pcie.0,addr=0x2.0x1 \
+-device pcie-root-port,port=0x12,chassis=11,id=pci.11,bus=pcie.0,addr=0x2.0x2 \
 -device virtio-scsi-pci-non-transitional,id=scsi0,bus=pci.3,addr=0x0 \
+-device virtio-serial-pci-non-transitional,id=virtio-serial0,bus=pci.4,\
+addr=0x0 \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci-non-transitional,scsi=off,bus=pci.4,addr=0x0,\
+-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.5,addr=0x0,\
 drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
 -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
 -device virtio-9p-pci-non-transitional,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,\
@@ -46,14 +49,14 @@  bus=pci.1,addr=0x0 \
 -device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\
 mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \
 -device virtio-input-host-pci-non-transitional,id=input0,\
-evdev=/dev/input/event1234,bus=pci.8,addr=0x0 \
+evdev=/dev/input/event1234,bus=pci.9,addr=0x0 \
 -device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
-id=hostdev0,bus=pci.5,addr=0x0 \
--device virtio-balloon-pci-non-transitional,id=balloon0,bus=pci.6,addr=0x0 \
+id=hostdev0,bus=pci.6,addr=0x0 \
+-device virtio-balloon-pci-non-transitional,id=balloon0,bus=pci.7,addr=0x0 \
 -object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.7,addr=0x0 \
+-device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.8,addr=0x0 \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
 resourcecontrol=deny \
 -device vhost-vsock-pci-non-transitional,id=vsock0,guest-cid=4,vhostfd=6789,\
-bus=pci.9,addr=0x0 \
+bus=pci.10,addr=0x0 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml
index 03273dc2d9..a269658520 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml
@@ -30,6 +30,7 @@ 
       <source evdev='/dev/input/event1234'/>
     </input>
     <controller type='scsi' model='virtio-non-transitional'/>
+    <controller type='virtio-serial' model='virtio-non-transitional'/>
     <controller type='usb' index='0' model='none'/>
     <memballoon model='virtio-non-transitional'/>
     <vsock model='virtio-non-transitional'>
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
index e8b3712acb..e495ab3747 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -28,8 +28,9 @@  addr=0x1 \
 -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
 -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
 -device virtio-scsi-pci,id=scsi0,bus=pci.2,addr=0x3 \
+-device virtio-serial-pci,id=virtio-serial0,bus=pci.2,addr=0x4 \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x4,drive=drive-virtio-disk0,\
+-device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x5,drive=drive-virtio-disk0,\
 id=virtio-disk0,bootindex=1 \
 -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
 -device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x1 \
@@ -37,13 +38,13 @@  id=virtio-disk0,bootindex=1 \
 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\
 addr=0x2 \
 -device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.2,\
-addr=0x8 \
+addr=0x9 \
 -device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
-bus=pci.2,addr=0x5 \
--device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x6 \
+bus=pci.2,addr=0x6 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x7 \
 -object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x7 \
+-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x8 \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
 resourcecontrol=deny \
--device vhost-vsock-pci,id=vsock0,guest-cid=4,vhostfd=6789,bus=pci.2,addr=0x9 \
+-device vhost-vsock-pci,id=vsock0,guest-cid=4,vhostfd=6789,bus=pci.2,addr=0xa \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index 95d20f8579..506cca1107 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -28,8 +28,9 @@  addr=0x1 \
 -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
 -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
 -device virtio-scsi-pci-transitional,id=scsi0,bus=pci.2,addr=0x3 \
+-device virtio-serial-pci-transitional,id=virtio-serial0,bus=pci.2,addr=0x4 \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x4,\
+-device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x5,\
 drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
 -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
 -device virtio-9p-pci-transitional,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,\
@@ -38,14 +39,14 @@  bus=pci.2,addr=0x1 \
 -device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\
 mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \
 -device virtio-input-host-pci-transitional,id=input0,\
-evdev=/dev/input/event1234,bus=pci.2,addr=0x8 \
+evdev=/dev/input/event1234,bus=pci.2,addr=0x9 \
 -device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
-id=hostdev0,bus=pci.2,addr=0x5 \
--device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x6 \
+id=hostdev0,bus=pci.2,addr=0x6 \
+-device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x7 \
 -object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x7 \
+-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x8 \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
 resourcecontrol=deny \
 -device vhost-vsock-pci-transitional,id=vsock0,guest-cid=4,vhostfd=6789,\
-bus=pci.2,addr=0x9 \
+bus=pci.2,addr=0xa \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml
index 1616cb137b..ac9ae43ef6 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-transitional.xml
@@ -30,6 +30,7 @@ 
       <source evdev='/dev/input/event1234'/>
     </input>
     <controller type='scsi' model='virtio-transitional'/>
+    <controller type='virtio-serial' model='virtio-transitional'/>
     <controller type='usb' index='0' model='none'/>
     <memballoon model='virtio-transitional'/>
     <vsock model='virtio-transitional'>
diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
index 56b673d7fa..e00962d513 100644
--- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
@@ -18,11 +18,14 @@ 
       <driver name='qemu' type='raw'/>
       <source dev='/dev/HostVG/QEMUGuest1'/>
       <target dev='vda' bus='virtio'/>
-      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
     </disk>
     <controller type='scsi' index='0' model='virtio-non-transitional'>
       <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
     </controller>
+    <controller type='virtio-serial' index='0' model='virtio-non-transitional'>
+      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
+    </controller>
     <controller type='usb' index='0' model='none'/>
     <controller type='sata' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
@@ -78,6 +81,11 @@ 
       <target chassis='10' port='0x11'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
     </controller>
+    <controller type='pci' index='11' model='pcie-root-port'>
+      <model name='pcie-root-port'/>
+      <target chassis='11' port='0x12'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
+    </controller>
     <filesystem type='mount' accessmode='passthrough' model='virtio-non-transitional'>
       <source dir='/export/fs1'/>
       <target dir='fs1'/>
@@ -90,24 +98,24 @@ 
     </interface>
     <input type='passthrough' bus='virtio' model='virtio-non-transitional'>
       <source evdev='/dev/input/event1234'/>
-      <address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x09' slot='0x00' function='0x0'/>
     </input>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <hostdev mode='subsystem' type='scsi_host' managed='no' model='virtio-non-transitional'>
       <source protocol='vhost' wwpn='naa.5123456789abcde0'/>
-      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
     </hostdev>
     <memballoon model='virtio-non-transitional'>
-      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
     </memballoon>
     <rng model='virtio-non-transitional'>
       <backend model='random'>/dev/urandom</backend>
-      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
     </rng>
     <vsock model='virtio-non-transitional'>
       <cid auto='no' address='4'/>
-      <address type='pci' domain='0x0000' bus='0x09' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/>
     </vsock>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml
index cf6c43bcb0..af02183fe2 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -18,11 +18,14 @@ 
       <driver name='qemu' type='raw'/>
       <source dev='/dev/HostVG/QEMUGuest1'/>
       <target dev='vda' bus='virtio'/>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x05' function='0x0'/>
     </disk>
     <controller type='scsi' index='0' model='virtio-transitional'>
       <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
     </controller>
+    <controller type='virtio-serial' index='0' model='virtio-transitional'>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
+    </controller>
     <controller type='usb' index='0' model='none'/>
     <controller type='sata' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
@@ -54,24 +57,24 @@ 
     </interface>
     <input type='passthrough' bus='virtio' model='virtio-transitional'>
       <source evdev='/dev/input/event1234'/>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x08' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x09' function='0x0'/>
     </input>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <hostdev mode='subsystem' type='scsi_host' managed='no' model='virtio-transitional'>
       <source protocol='vhost' wwpn='naa.5123456789abcde0'/>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x05' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x06' function='0x0'/>
     </hostdev>
     <memballoon model='virtio-transitional'>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x06' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x07' function='0x0'/>
     </memballoon>
     <rng model='virtio-transitional'>
       <backend model='random'>/dev/urandom</backend>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x07' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x08' function='0x0'/>
     </rng>
     <vsock model='virtio-transitional'>
       <cid auto='no' address='4'/>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x09' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x0a' function='0x0'/>
     </vsock>
   </devices>
 </domain>