]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Retire 'ivshmem' device
authorPeter Krempa <pkrempa@redhat.com>
Wed, 16 Aug 2023 11:07:34 +0000 (13:07 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 22 Aug 2023 12:04:41 +0000 (14:04 +0200)
The device was removed in qemu-4.0 and is superseded by 'ivshmem-plain'
and 'ivshmem-doorbell'.

Always report error when the old version is used and drop the irrelevant
tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_command.c
src/qemu/qemu_hotplug.c
src/qemu/qemu_migration.c
src/qemu/qemu_validate.c
tests/qemuxml2argvdata/shmem.args [deleted file]
tests/qemuxml2argvdata/shmem.err [deleted file]
tests/qemuxml2argvdata/shmem.xml [deleted file]
tests/qemuxml2argvtest.c
tests/qemuxml2xmloutdata/shmem.xml [deleted file]
tests/qemuxml2xmltest.c

index 77c5335bde7efe1e27d0b4fab68286048fce924a..9a6840e870022feaba8533c492a2dafad72e215c 100644 (file)
@@ -8873,44 +8873,6 @@ qemuBuildSmartcardCommandLine(virCommand *cmd,
 }
 
 
-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)
@@ -9014,7 +8976,7 @@ qemuBuildShmemCommandLine(virCommand *cmd,
 
     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:
index 2e3c99760dfe03743108d9caa0fe3b9fd9e72647..f3f0e23fa74ac36cca85457670803a099dd9eed0 100644 (file)
@@ -2817,19 +2817,7 @@ qemuDomainAttachShmemDevice(virDomainObj *vm,
     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);
 
index d21551ab07d96dcb6fe35c290b37178a6a18f126..9b490a130d72cef084b7d106a8a3631b24e45225 100644 (file)
@@ -1503,11 +1503,6 @@ qemuMigrationSrcIsAllowed(virDomainObj *vm,
         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"),
index d62d064a255fe999e4ed80d91427e5140bc0be0f..28e4a4cc998c98bf01871c47d4c207bd27e0b6be 100644 (file)
@@ -5103,13 +5103,9 @@ qemuValidateDomainDeviceDefShmem(virDomainShmemDef *shmem,
 {
     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)) {
diff --git a/tests/qemuxml2argvdata/shmem.args b/tests/qemuxml2argvdata/shmem.args
deleted file mode 100644 (file)
index 1ca9a33..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-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
diff --git a/tests/qemuxml2argvdata/shmem.err b/tests/qemuxml2argvdata/shmem.err
deleted file mode 100644 (file)
index b9e128e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unsupported configuration: ivshmem device is not supported with this QEMU binary
diff --git a/tests/qemuxml2argvdata/shmem.xml b/tests/qemuxml2argvdata/shmem.xml
deleted file mode 100644 (file)
index b6dfe29..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<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>
index 900a7b4a9d528bd1305a5b0cf0d52e0d77f61b60..80f5af84e102c527a46db5dd76a86d19a0fc9509 100644 (file)
@@ -2441,8 +2441,6 @@ mymain(void)
     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");
diff --git a/tests/qemuxml2xmloutdata/shmem.xml b/tests/qemuxml2xmloutdata/shmem.xml
deleted file mode 100644 (file)
index bdd273d..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-<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>
index 192c49ee70ae1d35898ff7b60d810aa1a74ee7e6..4cc411eba4326ab6973eb7a03ee2aa2732b5e7ba 100644 (file)
@@ -916,7 +916,6 @@ mymain(void)
 
     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");