mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
qemu: Support vsock model=virtio-{non-}transitional
Add <vsock> model handling for virtio transitional devices. Ex: <vsock model='virtio-transitional'> ... </vsock> * "virtio-transitional" maps to qemu "vhost-vsock-pci-transitional" * "virtio-non-transitional" maps to qemu "vhost-vsock-pci-non-transitional" Reviewed-by: Andrea Bolognani <abologna@redhat.com> Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
0f5958f5c5
commit
6e64899284
@ -8667,7 +8667,11 @@ qemu-kvm -net nic,model=? /dev/null
|
||||
<h3><a id="vsock">Vsock</a></h3>
|
||||
|
||||
<p>A vsock host/guest interface. The <code>model</code> attribute
|
||||
defaults to <code>virtio</code>.
|
||||
defaults to <code>virtio</code>. <span class="since">Since 5.2.0</span>
|
||||
<code>model</code> can also be 'virtio-transitional' and
|
||||
'virtio-non-transitional', see
|
||||
<a href="#elementsVirtioTransitional">Virtio transitional devices</a>
|
||||
for more details.
|
||||
The optional attribute <code>address</code> of the <code>cid</code>
|
||||
element specifies the CID assigned to the guest. If the attribute
|
||||
<code>auto</code> is set to <code>yes</code>, libvirt
|
||||
|
@ -4304,7 +4304,11 @@
|
||||
<element name="vsock">
|
||||
<optional>
|
||||
<attribute name="model">
|
||||
<value>virtio</value>
|
||||
<choice>
|
||||
<value>virtio</value>
|
||||
<value>virtio-transitional</value>
|
||||
<value>virtio-non-transitional</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
<interleave>
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -27,5 +27,8 @@
|
||||
</filesystem>
|
||||
<controller type='usb' model='none'/>
|
||||
<memballoon model='virtio-non-transitional'/>
|
||||
<vsock model='virtio-non-transitional'>
|
||||
<cid auto='no' address='4'/>
|
||||
</vsock>
|
||||
</devices>
|
||||
</domain>
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -27,5 +27,8 @@
|
||||
</filesystem>
|
||||
<controller type='usb' model='none'/>
|
||||
<memballoon model='virtio-transitional'/>
|
||||
<vsock model='virtio-transitional'>
|
||||
<cid auto='no' address='4'/>
|
||||
</vsock>
|
||||
</devices>
|
||||
</domain>
|
||||
|
@ -60,6 +60,11 @@
|
||||
<target chassis='7' port='0xe'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x6'/>
|
||||
</controller>
|
||||
<controller type='pci' index='8' model='pcie-root-port'>
|
||||
<model name='pcie-root-port'/>
|
||||
<target chassis='8' port='0xf'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x7'/>
|
||||
</controller>
|
||||
<filesystem type='mount' accessmode='passthrough' model='virtio-non-transitional'>
|
||||
<source dir='/export/fs1'/>
|
||||
<target dir='fs1'/>
|
||||
@ -83,5 +88,9 @@
|
||||
<backend model='random'>/dev/urandom</backend>
|
||||
<address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
|
||||
</rng>
|
||||
<vsock model='virtio-non-transitional'>
|
||||
<cid auto='no' address='4'/>
|
||||
<address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
|
||||
</vsock>
|
||||
</devices>
|
||||
</domain>
|
||||
|
@ -62,5 +62,9 @@
|
||||
<backend model='random'>/dev/urandom</backend>
|
||||
<address type='pci' domain='0x0000' bus='0x02' slot='0x06' function='0x0'/>
|
||||
</rng>
|
||||
<vsock model='virtio-transitional'>
|
||||
<cid auto='no' address='4'/>
|
||||
<address type='pci' domain='0x0000' bus='0x02' slot='0x07' function='0x0'/>
|
||||
</vsock>
|
||||
</devices>
|
||||
</domain>
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user