diff mbox series

[v2,23/25] qemu: Support virtio-serial controller model=virtio-{non-}transitional

Message ID 19ade9466bcfe2b5e3da94c22aa564d7f9c6711c.1548278586.git.crobinso@redhat.com
State Superseded
Headers show
Series qemu: virtio-{non-}transitional support | expand

Commit Message

Cole Robinson Jan. 23, 2019, 9:32 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                        | 11 ++++++++++
 src/conf/domain_conf.h                        | 10 +++++++++
 src/qemu/qemu_command.c                       | 12 +++++++++-
 src/qemu/qemu_domain_address.c                | 15 ++++++++++++-
 .../virtio-non-transitional.x86_64-3.1.0.args | 18 +++++++++------
 ...virtio-non-transitional.x86_64-latest.args | 18 +++++++++------
 .../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               | 22 +++++++++++++------
 .../virtio-transitional.xml                   | 15 ++++++++-----
 14 files changed, 120 insertions(+), 42 deletions(-)

-- 
2.20.1

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

Comments

Andrea Bolognani Jan. 29, 2019, 2:53 p.m. UTC | #1
On Wed, 2019-01-23 at 16:32 -0500, Cole Robinson wrote:
[...]
> @@ -525,11 +525,21 @@ qemuBuildVirtioDevStr(virBufferPtr buf,

>              ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_NON_TRANSITIONAL;

>              break;

>  

> +        case VIR_DOMAIN_DEVICE_CONTROLLER:

> +            if (device.data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) {

> +                has_tmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL;

> +                has_ntmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_NON_TRANSITIONAL;

> +                tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_TRANSITIONAL;

> +                ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_NON_TRANSITIONAL;

> +            } else {

> +                return 0;

> +            }


Please invert this, same as for hostdevs and input devices, so that
it looks like

  case VIR_DOMAIN_DEVICE_CONTROLLER:
      if (device.data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL)
          return 0;
      ...

With that addressed, and of course with the usual caveats around
formatting model='virtio',

  Reviewed-by: Andrea Bolognani <abologna@redhat.com>


-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Andrea Bolognani Jan. 29, 2019, 3:14 p.m. UTC | #2
On Tue, 2019-01-29 at 15:53 +0100, Andrea Bolognani wrote:
> On Wed, 2019-01-23 at 16:32 -0500, Cole Robinson wrote:

> [...]

> > @@ -525,11 +525,21 @@ qemuBuildVirtioDevStr(virBufferPtr buf,

> >              ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_NON_TRANSITIONAL;

> >              break;

> >  

> > +        case VIR_DOMAIN_DEVICE_CONTROLLER:

> > +            if (device.data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) {

> > +                has_tmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL;

> > +                has_ntmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_NON_TRANSITIONAL;

> > +                tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_TRANSITIONAL;

> > +                ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_NON_TRANSITIONAL;

> > +            } else {

> > +                return 0;

> > +            }

> 

> Please invert this, same as for hostdevs and input devices, so that

> it looks like

> 

>   case VIR_DOMAIN_DEVICE_CONTROLLER:

>       if (device.data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL)

>           return 0;

>       ...


Oh, I see now that you add another branch in the following commit,
which of course makes the above not applicable.

You can either leave it as is or turn it into a switch statement,
the latter being my personal preference.

-- 
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 6838774c74..b820adbc8a 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 ccc94a2fba..1c83281ad2 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2310,6 +2310,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 8169428051..4518f426b2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -382,6 +382,13 @@  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",
@@ -10321,6 +10328,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;
 }
@@ -10338,6 +10347,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 0e87d7efef..804e6900e9 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -789,6 +789,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 || \
@@ -3473,6 +3482,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_command.c b/src/qemu/qemu_command.c
index a5c11956ed..ea40494143 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -525,11 +525,21 @@  qemuBuildVirtioDevStr(virBufferPtr buf,
             ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_NON_TRANSITIONAL;
             break;
 
+        case VIR_DOMAIN_DEVICE_CONTROLLER:
+            if (device.data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) {
+                has_tmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL;
+                has_ntmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_NON_TRANSITIONAL;
+                tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_TRANSITIONAL;
+                ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_NON_TRANSITIONAL;
+            } else {
+                return 0;
+            }
+            break;
+
         case VIR_DOMAIN_DEVICE_LEASE:
         case VIR_DOMAIN_DEVICE_SOUND:
         case VIR_DOMAIN_DEVICE_VIDEO:
         case VIR_DOMAIN_DEVICE_WATCHDOG:
-        case VIR_DOMAIN_DEVICE_CONTROLLER:
         case VIR_DOMAIN_DEVICE_GRAPHICS:
         case VIR_DOMAIN_DEVICE_HUB:
         case VIR_DOMAIN_DEVICE_REDIRDEV:
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 7878d827de..6ecbb6defc 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -665,7 +665,20 @@  qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
             break;
 
         case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:
-            return virtioFlags;
+            switch ((virDomainControllerModelVirtioSerial) cont->model) {
+            case VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL:
+                /* Transitional devices only work in conventional PCI slots */
+                return pciFlags;
+
+            case VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO:
+            case VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_NON_TRANSITIONAL:
+            case VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_DEFAULT:
+                return virtioFlags;
+
+            case VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_LAST:
+                return 0;
+            }
+            break;
 
         case VIR_DOMAIN_CONTROLLER_TYPE_FDC:
         case VIR_DOMAIN_CONTROLLER_TYPE_CCID:
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 0f5de86315..7543a225cb 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
@@ -32,9 +32,13 @@  addr=0x1 \
 -device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \
 -device pcie-root-port,port=0xe,chassis=7,id=pci.7,bus=pcie.0,addr=0x1.0x6 \
 -device pcie-root-port,port=0xf,chassis=8,id=pci.8,bus=pcie.0,addr=0x1.0x7 \
--device pcie-root-port,port=0x10,chassis=9,id=pci.9,bus=pcie.0,addr=0x2 \
+-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 virtio-serial-pci,disable-legacy=on,disable-modern=off,\
+id=virtio-serial0,bus=pci.3,addr=0x0 \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.3,\
+-device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.4,\
 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,disable-modern=off,id=fs0,\
@@ -43,16 +47,16 @@  fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \
 -device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\
 id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \
 -device virtio-input-host-pci,disable-legacy=on,disable-modern=off,id=input0,\
-evdev=/dev/input/event1234,bus=pci.7,addr=0x0 \
+evdev=/dev/input/event1234,bus=pci.8,addr=0x0 \
 -device vhost-scsi-pci,disable-legacy=on,disable-modern=off,\
-wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.4,addr=0x0 \
+wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.5,addr=0x0 \
 -device virtio-balloon-pci,disable-legacy=on,disable-modern=off,id=balloon0,\
-bus=pci.5,addr=0x0 \
+bus=pci.6,addr=0x0 \
 -object rng-random,id=objrng0,filename=/dev/urandom \
 -device virtio-rng-pci,disable-legacy=on,disable-modern=off,rng=objrng0,\
-id=rng0,bus=pci.6,addr=0x0 \
+id=rng0,bus=pci.7,addr=0x0 \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
 resourcecontrol=deny \
 -device vhost-vsock-pci,disable-legacy=on,disable-modern=off,id=vsock0,\
-guest-cid=4,vhostfd=6789,bus=pci.8,addr=0x0 \
+guest-cid=4,vhostfd=6789,bus=pci.9,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 383b29f629..514db3ee7f 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -32,9 +32,13 @@  addr=0x1 \
 -device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \
 -device pcie-root-port,port=0xe,chassis=7,id=pci.7,bus=pcie.0,addr=0x1.0x6 \
 -device pcie-root-port,port=0xf,chassis=8,id=pci.8,bus=pcie.0,addr=0x1.0x7 \
--device pcie-root-port,port=0x10,chassis=9,id=pci.9,bus=pcie.0,addr=0x2 \
+-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 virtio-serial-pci-non-transitional,id=virtio-serial0,bus=pci.3,\
+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.3,addr=0x0,\
+-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.4,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,\
@@ -43,14 +47,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.7,addr=0x0 \
+evdev=/dev/input/event1234,bus=pci.8,addr=0x0 \
 -device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
-id=hostdev0,bus=pci.4,addr=0x0 \
--device virtio-balloon-pci-non-transitional,id=balloon0,bus=pci.5,addr=0x0 \
+id=hostdev0,bus=pci.5,addr=0x0 \
+-device virtio-balloon-pci-non-transitional,id=balloon0,bus=pci.6,addr=0x0 \
 -object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.6,addr=0x0 \
+-device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.7,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.8,addr=0x0 \
+bus=pci.9,addr=0x0 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml
index 3fd32632d3..a873821e4a 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml
@@ -29,6 +29,7 @@ 
     <input type='passthrough' bus='virtio' model='virtio-non-transitional'>
       <source evdev='/dev/input/event1234'/>
     </input>
+    <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 8046e5c102..5b58af88df 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -27,8 +27,9 @@  file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
 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-serial-pci,id=virtio-serial0,bus=pci.2,addr=0x3 \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x3,drive=drive-virtio-disk0,\
+-device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x4,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 \
@@ -36,13 +37,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=0x7 \
+addr=0x8 \
 -device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
-bus=pci.2,addr=0x4 \
--device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x5 \
+bus=pci.2,addr=0x5 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x6 \
 -object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x6 \
+-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x7 \
 -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=0x8 \
+-device vhost-vsock-pci,id=vsock0,guest-cid=4,vhostfd=6789,bus=pci.2,addr=0x9 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index 410eb28f0a..6c697eba83 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -27,8 +27,9 @@  file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
 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-serial-pci-transitional,id=virtio-serial0,bus=pci.2,addr=0x3 \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x3,\
+-device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x4,\
 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,\
@@ -37,14 +38,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=0x7 \
+evdev=/dev/input/event1234,bus=pci.2,addr=0x8 \
 -device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
-id=hostdev0,bus=pci.2,addr=0x4 \
--device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x5 \
+id=hostdev0,bus=pci.2,addr=0x5 \
+-device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x6 \
 -object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x6 \
+-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x7 \
 -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=0x8 \
+bus=pci.2,addr=0x9 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml
index 5daea19ada..fa1cccce64 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-transitional.xml
@@ -29,6 +29,7 @@ 
     <input type='passthrough' bus='virtio' model='virtio-transitional'>
       <source evdev='/dev/input/event1234'/>
     </input>
+    <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 32c57a27f1..11496d872d 100644
--- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
@@ -18,8 +18,11 @@ 
       <driver name='qemu' type='raw'/>
       <source dev='/dev/HostVG/QEMUGuest1'/>
       <target dev='vda' bus='virtio'/>
-      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
     </disk>
+    <controller type='virtio-serial' index='0' model='virtio-non-transitional'>
+      <address type='pci' domain='0x0000' bus='0x03' 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'/>
@@ -68,7 +71,12 @@ 
     <controller type='pci' index='9' model='pcie-root-port'>
       <model name='pcie-root-port'/>
       <target chassis='9' port='0x10'/>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
+    </controller>
+    <controller type='pci' index='10' model='pcie-root-port'>
+      <model name='pcie-root-port'/>
+      <target chassis='10' port='0x11'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
     </controller>
     <filesystem type='mount' accessmode='passthrough' model='virtio-9p-non-transitional'>
       <source dir='/export/fs1'/>
@@ -82,24 +90,24 @@ 
     </interface>
     <input type='passthrough' bus='virtio' model='virtio-non-transitional'>
       <source evdev='/dev/input/event1234'/>
-      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x08' 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='0x04' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
     </hostdev>
     <memballoon model='virtio-non-transitional'>
-      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
     </memballoon>
     <rng model='virtio-non-transitional'>
       <backend model='random'>/dev/urandom</backend>
-      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
     </rng>
     <vsock model='virtio-non-transitional'>
       <cid auto='no' address='4'/>
-      <address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x09' slot='0x00' function='0x0'/>
     </vsock>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml
index c944f0d9f8..c8edb4723c 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -18,8 +18,11 @@ 
       <driver name='qemu' type='raw'/>
       <source dev='/dev/HostVG/QEMUGuest1'/>
       <target dev='vda' bus='virtio'/>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
     </disk>
+    <controller type='virtio-serial' index='0' model='virtio-transitional'>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' 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'/>
@@ -51,24 +54,24 @@ 
     </interface>
     <input type='passthrough' bus='virtio' model='virtio-transitional'>
       <source evdev='/dev/input/event1234'/>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x07' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x08' 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='0x04' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x05' function='0x0'/>
     </hostdev>
     <memballoon model='virtio-transitional'>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x05' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x06' function='0x0'/>
     </memballoon>
     <rng model='virtio-transitional'>
       <backend model='random'>/dev/urandom</backend>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x06' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x07' function='0x0'/>
     </rng>
     <vsock model='virtio-transitional'>
       <cid auto='no' address='4'/>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x08' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x09' function='0x0'/>
     </vsock>
   </devices>
 </domain>