diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0740d2529eae7acc781ee6390d90eaeafa9565cb..18f9557d1832748ec9144eda67f5602003fdb6ed 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -8667,7 +8667,11 @@ qemu-kvm -net nic,model=? /dev/null
A vsock host/guest interface. The model
attribute
- defaults to virtio
.
+ defaults to virtio
. Since 5.2.0
+ model
can also be 'virtio-transitional' and
+ 'virtio-non-transitional', see
+ Virtio transitional devices
+ for more details.
The optional attribute address
of the cid
element specifies the CID assigned to the guest. If the attribute
auto
is set to yes
, libvirt
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index ae90f60a70c43531a70baa88764a459c63b6da5c..f1c253fefb8d43b9def3ad5e0d53e2889ad11686 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4304,7 +4304,11 @@
- virtio
+
+ virtio
+ virtio-transitional
+ virtio-non-transitional
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a37c71007f5d536aba943ca6480dc212a69594be..4c6a63f63afe9feacdad273746d514abe7feb1c0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -996,6 +996,8 @@ VIR_ENUM_IMPL(virDomainIOMMUModel, VIR_DOMAIN_IOMMU_MODEL_LAST,
VIR_ENUM_IMPL(virDomainVsockModel, VIR_DOMAIN_VSOCK_MODEL_LAST,
"default",
"virtio",
+ "virtio-transitional",
+ "virtio-non-transitional",
);
VIR_ENUM_IMPL(virDomainDiskDiscard, VIR_DOMAIN_DISK_DISCARD_LAST,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 4bce829c674633b68c739d8904f95d7a98890085..c43101a8ff5df69a616913b2686e1052f97a5bb8 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2434,6 +2434,8 @@ struct _virDomainIOMMUDef {
typedef enum {
VIR_DOMAIN_VSOCK_MODEL_DEFAULT,
VIR_DOMAIN_VSOCK_MODEL_VIRTIO,
+ VIR_DOMAIN_VSOCK_MODEL_VIRTIO_TRANSITIONAL,
+ VIR_DOMAIN_VSOCK_MODEL_VIRTIO_NON_TRANSITIONAL,
VIR_DOMAIN_VSOCK_MODEL_LAST
} virDomainVsockModel;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d17bf7306d470bc72b70a36e60adb089e36b871f..edcc3b9bdc392f73b7cba510d741a858a1e18fe3 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -507,6 +507,11 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
has_ntmodel = device.data.memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL;
break;
+ case VIR_DOMAIN_DEVICE_VSOCK:
+ has_tmodel = device.data.vsock->model == VIR_DOMAIN_VSOCK_MODEL_VIRTIO_TRANSITIONAL;
+ has_ntmodel = device.data.vsock->model == VIR_DOMAIN_VSOCK_MODEL_VIRTIO_NON_TRANSITIONAL;
+ break;
+
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_INPUT:
case VIR_DOMAIN_DEVICE_SOUND:
@@ -525,7 +530,6 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_MEMORY:
case VIR_DOMAIN_DEVICE_IOMMU:
- case VIR_DOMAIN_DEVICE_VSOCK:
case VIR_DOMAIN_DEVICE_LAST:
default:
return 0;
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 8ee64ded326139d6f718453b2e2651ac58a8ac55..4e0a7eb3fd0524f47837d2ebafaa3fcfe9b105e8 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -974,7 +974,19 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
break;
case VIR_DOMAIN_DEVICE_VSOCK:
- return virtioFlags;
+ switch ((virDomainVsockModel) dev->data.vsock->model) {
+ case VIR_DOMAIN_VSOCK_MODEL_VIRTIO_TRANSITIONAL:
+ /* Transitional devices only work in conventional PCI slots */
+ return pciFlags;
+ case VIR_DOMAIN_VSOCK_MODEL_VIRTIO:
+ case VIR_DOMAIN_VSOCK_MODEL_VIRTIO_NON_TRANSITIONAL:
+ return virtioFlags;
+
+ case VIR_DOMAIN_VSOCK_MODEL_DEFAULT:
+ case VIR_DOMAIN_VSOCK_MODEL_LAST:
+ return 0;
+ }
+ break;
/* These devices don't ever connect with PCI */
case VIR_DOMAIN_DEVICE_NVRAM:
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 30e8e4244eba0729738b597629553980310e21c0..97df54dd77c28b1341cadfbec79cd79a147b8f53 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
@@ -31,6 +31,7 @@ addr=0x1 \
-device pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 \
-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 \
-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,\
addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
@@ -49,4 +50,6 @@ bus=pci.5,addr=0x0 \
id=rng0,bus=pci.6,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.7,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 dbf7a4ef15bca327eded78a400c3364ca79de48e..2a73798ee2e713bb6417a1e52d74028a0fe5c2ac 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -31,6 +31,7 @@ addr=0x1 \
-device pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 \
-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 \
-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,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
@@ -47,4 +48,6 @@ id=hostdev0,bus=pci.4,addr=0x0 \
-device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.6,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.7,addr=0x0 \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml
index 39c5e1645a4569476df5e9187d95195a677c3a22..0f691cea3bcc8bc79332f48918fadb971aab6e23 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml
@@ -27,5 +27,8 @@
+
+
+
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 b7cb3048910857d932c73930c10770e74c7c7f52..c3df97ca86767fee4ce89bdecda35aa594fb259e 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -45,4 +45,6 @@ bus=pci.2,addr=0x5 \
id=rng0,bus=pci.2,addr=0x6 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
+-device vhost-vsock-pci,disable-legacy=off,disable-modern=off,id=vsock0,\
+guest-cid=4,vhostfd=6789,bus=pci.2,addr=0x7 \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index 77332549bfbe37ea84f45a29da26a6439c3062b2..f3a4e0804e5141b95953b169259838cd3f6f34db 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -43,4 +43,6 @@ id=hostdev0,bus=pci.2,addr=0x4 \
-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x6 \
-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=0x7 \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml
index 7b815979cbc69a2863b726d9e42d5b4ffceee0d0..d10c917a356ba4e96fb263ff708b6bea19a92045 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-transitional.xml
@@ -27,5 +27,8 @@
+
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
index 721dccbaef4715fc671eb1b9448c42618bd4b36c..9f05de5089816a944d2a2ed52c8b1b388f346b48 100644
--- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
@@ -60,6 +60,11 @@
+
+
+
+
+
@@ -83,5 +88,9 @@
/dev/urandom
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml
index 2402c5f2278fdd6f2206e08311a7164bea252a8f..0d99aa2ded193ad555ecc4d7d955218262a27b39 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -62,5 +62,9 @@
/dev/urandom
+
+
+
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index b99f2d75835731f490ad8df87e26579aadc500d9..5f78d82478da7e5fe98a841a06bc74f2dca01799 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1259,13 +1259,15 @@ mymain(void)
QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
QEMU_CAPS_DEVICE_VIRTIO_RNG,
- QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY);
+ QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
+ QEMU_CAPS_DEVICE_VHOST_VSOCK);
DO_TEST("virtio-non-transitional",
QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
QEMU_CAPS_DEVICE_VIRTIO_RNG,
- QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY);
+ QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
+ QEMU_CAPS_DEVICE_VHOST_VSOCK);
if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
virFileDeleteTree(fakerootdir);