}
-static virJSONValue *
-qemuBuildShmemDevLegacyProps(virDomainDef *def,
- virDomainShmemDef *shmem)
-{
- g_autoptr(virJSONValue) props = NULL;
- g_autofree char *size = NULL;
- const char *shm = NULL;
- g_autofree char *chardev = NULL;
-
- /* while this would result in a type error with newer qemus, the 'ivshmem'
- * device was removed in qemu-4.0, so for the sake of not changing the
- * commandline we do this hack */
- size = g_strdup_printf("%llum", shmem->size >> 20);
-
- if (shmem->server.enabled)
- chardev = g_strdup_printf("char%s", shmem->info.alias);
- else
- shm = shmem->name;
-
- if (virJSONValueObjectAdd(&props,
- "s:driver", "ivshmem",
- "s:id", shmem->info.alias,
- "s:size", size,
- "S:shm", shm,
- "S:chardev", chardev,
- "B:msi", shmem->msi.enabled,
- "p:vectors", shmem->msi.vectors,
- "T:ioeventfd", shmem->msi.ioeventfd,
- NULL) < 0)
- return NULL;
-
- if (qemuBuildDeviceAddressProps(props, def, &shmem->info) < 0)
- return NULL;
-
- return g_steal_pointer(&props);
-}
-
-
virJSONValue *
qemuBuildShmemDevProps(virDomainDef *def,
virDomainShmemDef *shmem)
switch (shmem->model) {
case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM:
- devProps = qemuBuildShmemDevLegacyProps(def, shmem);
+ /* unreachable, rejected by validation */
break;
case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_PLAIN:
qemuDomainObjPrivate *priv = vm->privateData;
virDomainDeviceDef dev = { VIR_DOMAIN_DEVICE_SHMEM, { .shmem = shmem } };
- switch (shmem->model) {
- case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_PLAIN:
- case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_DOORBELL:
- break;
-
- case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM:
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
- _("live attach of shmem model '%1$s' is not supported"),
- virDomainShmemModelTypeToString(shmem->model));
- G_GNUC_FALLTHROUGH;
- case VIR_DOMAIN_SHMEM_MODEL_LAST:
- return -1;
- }
+ /* validation ensures that the legacy 'ivshmem' device is rejected */
qemuAssignDeviceShmemAlias(vm->def, shmem, -1);
for (i = 0; i < vm->def->nshmems; i++) {
virDomainShmemDef *shmem = vm->def->shmems[i];
- if (shmem->model == VIR_DOMAIN_SHMEM_MODEL_IVSHMEM) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("migration with legacy shmem device is not supported"));
- return false;
- }
if (shmem->role != VIR_DOMAIN_SHMEM_ROLE_MASTER) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("shmem device '%1$s' cannot be migrated, only shmem with role='%2$s' can be migrated"),
{
switch (shmem->model) {
case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM:
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_IVSHMEM)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("ivshmem device is not supported "
- "with this QEMU binary"));
- return -1;
- }
- break;
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("ivshmem device is no longer supported"));
+ return -1;
case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_PLAIN:
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_IVSHMEM_PLAIN)) {
+++ /dev/null
-LC_ALL=C \
-PATH=/bin \
-HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
-USER=test \
-LOGNAME=test \
-XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
-XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
-XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
-/usr/bin/qemu-system-x86_64 \
--name guest=QEMUGuest1,debug-threads=on \
--S \
--object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes \
--machine pc,usb=off,dump-guest-core=off \
--accel tcg \
--m size=219136k \
--overcommit mem-lock=off \
--smp 1,sockets=1,cores=1,threads=1 \
--uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
--display none \
--no-user-config \
--nodefaults \
--chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
--mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=utc \
--no-shutdown \
--no-acpi \
--boot strict=on \
--usb \
--audiodev '{"id":"audio1","driver":"none"}' \
--device ivshmem,id=shmem0,size=4m,shm=shmem0,bus=pci.0,addr=0x2 \
--device ivshmem,id=shmem1,size=128m,shm=shmem1,bus=pci.0,addr=0x3 \
--device ivshmem,id=shmem2,size=256m,shm=shmem2,bus=pci.0,addr=0x4 \
--device ivshmem,id=shmem3,size=512m,chardev=charshmem3,bus=pci.0,addr=0x5 \
--chardev socket,id=charshmem3,path=/var/lib/libvirt/shmem-shmem3-sock \
--device ivshmem,id=shmem4,size=1024m,chardev=charshmem4,bus=pci.0,addr=0x6 \
--chardev socket,id=charshmem4,path=/tmp/shmem4-sock \
--device ivshmem,id=shmem5,size=2048m,chardev=charshmem5,msi=on,ioeventfd=off,bus=pci.0,addr=0x7 \
--chardev socket,id=charshmem5,path=/tmp/shmem5-sock \
--device ivshmem,id=shmem6,size=4096m,chardev=charshmem6,msi=on,vectors=16,bus=pci.0,addr=0x8 \
--chardev socket,id=charshmem6,path=/tmp/shmem6-sock \
--device ivshmem,id=shmem7,size=8192m,chardev=charshmem7,msi=on,vectors=32,ioeventfd=on,bus=pci.0,addr=0x9 \
--chardev socket,id=charshmem7,path=/tmp/shmem7-sock \
--msg timestamp=on
+++ /dev/null
-unsupported configuration: ivshmem device is not supported with this QEMU binary
+++ /dev/null
-<domain type='qemu'>
- <name>QEMUGuest1</name>
- <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
- <memory unit='KiB'>219136</memory>
- <currentMemory unit='KiB'>219136</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='x86_64' machine='pc'>hvm</type>
- <boot dev='hd'/>
- </os>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-x86_64</emulator>
- <controller type='usb' index='0'/>
- <controller type='pci' index='0' model='pci-root'/>
- <input type='mouse' bus='ps2'/>
- <input type='keyboard' bus='ps2'/>
- <memballoon model='none'/>
- <shmem name='shmem0'/>
- <shmem name='shmem1'>
- <size unit='M'>128</size>
- </shmem>
- <shmem name='shmem2'>
- <size unit='M'>256</size>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
- </shmem>
- <shmem name='shmem3'>
- <model type='ivshmem'/>
- <size unit='M'>512</size>
- <server/>
- </shmem>
- <shmem name='shmem4'>
- <size unit='M'>1024</size>
- <server path='/tmp/shmem4-sock'/>
- </shmem>
- <shmem name='shmem5'>
- <size unit='M'>2048</size>
- <server path='/tmp/shmem5-sock'/>
- <msi ioeventfd='off'/>
- </shmem>
- <shmem name='shmem6'>
- <model type='ivshmem'/>
- <size unit='M'>4096</size>
- <server path='/tmp/shmem6-sock'/>
- <msi vectors='16'/>
- </shmem>
- <shmem name='shmem7'>
- <size unit='M'>8192</size>
- <server path='/tmp/shmem7-sock'/>
- <msi vectors='32' ioeventfd='on'/>
- </shmem>
- </devices>
-</domain>
DO_TEST_CAPS_ARCH_VER_FULL("fips-enabled", "x86_64", "5.1.0", ARG_FLAGS, FLAG_FIPS_HOST);
DO_TEST_CAPS_ARCH_LATEST_FULL("fips-enabled", "x86_64", ARG_FLAGS, FLAG_FIPS_HOST);
- DO_TEST("shmem", QEMU_CAPS_DEVICE_IVSHMEM);
- DO_TEST_PARSE_ERROR_NOCAPS("shmem");
DO_TEST_CAPS_LATEST("shmem-plain-doorbell");
DO_TEST_CAPS_LATEST_FAILURE("shmem-invalid-size");
DO_TEST_CAPS_LATEST_FAILURE("shmem-invalid-address");
+++ /dev/null
-<domain type='qemu'>
- <name>QEMUGuest1</name>
- <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
- <memory unit='KiB'>219136</memory>
- <currentMemory unit='KiB'>219136</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='x86_64' machine='pc'>hvm</type>
- <boot dev='hd'/>
- </os>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-x86_64</emulator>
- <controller type='usb' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
- </controller>
- <controller type='pci' index='0' model='pci-root'/>
- <input type='mouse' bus='ps2'/>
- <input type='keyboard' bus='ps2'/>
- <audio id='1' type='none'/>
- <memballoon model='none'/>
- <shmem name='shmem0'>
- <model type='ivshmem'/>
- <size unit='M'>4</size>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
- </shmem>
- <shmem name='shmem1'>
- <model type='ivshmem'/>
- <size unit='M'>128</size>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
- </shmem>
- <shmem name='shmem2'>
- <model type='ivshmem'/>
- <size unit='M'>256</size>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
- </shmem>
- <shmem name='shmem3'>
- <model type='ivshmem'/>
- <size unit='M'>512</size>
- <server/>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
- </shmem>
- <shmem name='shmem4'>
- <model type='ivshmem'/>
- <size unit='M'>1024</size>
- <server path='/tmp/shmem4-sock'/>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
- </shmem>
- <shmem name='shmem5'>
- <model type='ivshmem'/>
- <size unit='M'>2048</size>
- <server path='/tmp/shmem5-sock'/>
- <msi ioeventfd='off'/>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
- </shmem>
- <shmem name='shmem6'>
- <model type='ivshmem'/>
- <size unit='M'>4096</size>
- <server path='/tmp/shmem6-sock'/>
- <msi vectors='16'/>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
- </shmem>
- <shmem name='shmem7'>
- <model type='ivshmem'/>
- <size unit='M'>8192</size>
- <server path='/tmp/shmem7-sock'/>
- <msi vectors='32' ioeventfd='on'/>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
- </shmem>
- </devices>
-</domain>
DO_TEST_CAPS_LATEST("tap-vhost");
DO_TEST_CAPS_LATEST("tap-vhost-incorrect");
- DO_TEST("shmem", QEMU_CAPS_DEVICE_IVSHMEM);
DO_TEST_CAPS_LATEST("shmem-plain-doorbell");
DO_TEST_CAPS_LATEST("smbios");
DO_TEST_CAPS_LATEST("smbios-multiple-type2");