Blame SOURCES/libvirt-qemu-command-Enable-formatting-vfio-pci.display-option-onto-cmdline.patch

edecca
From 24aa8ecbce19a6f844669ed4a30010caea06b799 Mon Sep 17 00:00:00 2001
edecca
Message-Id: <24aa8ecbce19a6f844669ed4a30010caea06b799@dist-git>
edecca
From: Erik Skultety <eskultet@redhat.com>
edecca
Date: Thu, 19 Jul 2018 15:04:03 +0200
edecca
Subject: [PATCH] qemu: command: Enable formatting vfio-pci.display option onto
edecca
 cmdline
edecca
MIME-Version: 1.0
edecca
Content-Type: text/plain; charset=UTF-8
edecca
Content-Transfer-Encoding: 8bit
edecca
edecca
Since QEMU 2.12, QEMU understands a new vfio-pci device option 'display'
edecca
which can be used to turn on display capabilities on vgpu-enabled
edecca
mediated devices, IOW emulated GPU devices like QXL will no longer be
edecca
needed with vgpu-enable mdevs.
edecca
QEMU defaults to 'auto' for the 'display' attribute, which is not
edecca
foolproof, so we need to play it safe here and default to display='off'
edecca
if this attribute wasn't provided in the XML explicitly.
edecca
edecca
Reviewed-by: Ján Tomko <jtomko@redhat.com>
edecca
Signed-off-by: Erik Skultety <eskultet@redhat.com>
edecca
(cherry picked from commit c0ca6dcf42549855b9ed75031f461a056ae1031c)
edecca
edecca
https://bugzilla.redhat.com/show_bug.cgi?id=1475770
edecca
Signed-off-by: Erik Skultety <eskultet@redhat.com>
edecca
Reviewed-by: Ján Tomko <jtomko@redhat.com>
edecca
---
edecca
 src/qemu/qemu_command.c                       |  4 ++
edecca
 .../hostdev-mdev-display-missing-graphics.xml | 35 ++++++++++++++++
edecca
 ...play-spice-egl-headless.x86_64-latest.args | 37 +++++++++++++++++
edecca
 ...ostdev-mdev-display-spice-egl-headless.xml | 40 ++++++++++++++++++
edecca
 ...ev-display-spice-opengl.x86_64-latest.args | 36 ++++++++++++++++
edecca
 .../hostdev-mdev-display-spice-opengl.xml     | 41 +++++++++++++++++++
edecca
 ...isplay-vnc-egl-headless.x86_64-latest.args | 37 +++++++++++++++++
edecca
 .../hostdev-mdev-display-vnc-egl-headless.xml | 40 ++++++++++++++++++
edecca
 ...ostdev-mdev-display-vnc.x86_64-latest.args | 36 ++++++++++++++++
edecca
 .../hostdev-mdev-display-vnc.xml              | 39 ++++++++++++++++++
edecca
 tests/qemuxml2argvtest.c                      |  7 ++++
edecca
 11 files changed, 352 insertions(+)
edecca
 create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-missing-graphics.xml
edecca
 create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless.x86_64-latest.args
edecca
 create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless.xml
edecca
 create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.x86_64-latest.args
edecca
 create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.xml
edecca
 create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.x86_64-latest.args
edecca
 create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.xml
edecca
 create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-vnc.x86_64-latest.args
edecca
 create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-vnc.xml
edecca
edecca
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
edecca
index 8915040c6a..1fce45134f 100644
edecca
--- a/src/qemu/qemu_command.c
edecca
+++ b/src/qemu/qemu_command.c
edecca
@@ -5177,6 +5177,10 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *def,
edecca
     virBufferAdd(&buf, dev_str, -1);
edecca
     virBufferAsprintf(&buf, ",id=%s,sysfsdev=%s", dev->info->alias, mdevPath);
edecca
 
edecca
+    if (mdevsrc->display != VIR_TRISTATE_SWITCH_ABSENT)
edecca
+        virBufferAsprintf(&buf, ",display=%s",
edecca
+                          virTristateSwitchTypeToString(mdevsrc->display));
edecca
+
edecca
     if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0)
edecca
         goto cleanup;
edecca
 
edecca
diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-missing-graphics.xml b/tests/qemuxml2argvdata/hostdev-mdev-display-missing-graphics.xml
edecca
new file mode 100644
edecca
index 0000000000..ea559a6444
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2argvdata/hostdev-mdev-display-missing-graphics.xml
edecca
@@ -0,0 +1,35 @@
edecca
+<domain type='qemu'>
edecca
+  <name>QEMUGuest2</name>
edecca
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
edecca
+  <memory unit='KiB'>219136</memory>
edecca
+  <currentMemory unit='KiB'>219136</currentMemory>
edecca
+  <vcpu placement='static'>1</vcpu>
edecca
+  <os>
edecca
+    <type arch='i686' machine='pc'>hvm</type>
edecca
+    <boot dev='hd'/>
edecca
+  </os>
edecca
+  <clock offset='utc'/>
edecca
+  <on_poweroff>destroy</on_poweroff>
edecca
+  <on_reboot>restart</on_reboot>
edecca
+  <on_crash>destroy</on_crash>
edecca
+  <devices>
edecca
+    <emulator>/usr/bin/qemu-system-i686</emulator>
edecca
+    <disk type='block' device='disk'>
edecca
+      <driver name='qemu' type='raw'/>
edecca
+      <source dev='/dev/HostVG/QEMUGuest2'/>
edecca
+      <target dev='hda' bus='ide'/>
edecca
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
edecca
+    </disk>
edecca
+    <controller type='usb' index='0'>
edecca
+    </controller>
edecca
+    <controller type='pci' index='0' model='pci-root'/>
edecca
+    <controller type='ide' index='0'>
edecca
+    </controller>
edecca
+    <hostdev mode='subsystem' type='mdev' model='vfio-pci' display='on'>
edecca
+      <source>
edecca
+        <address uuid='53764d0e-85a0-42b4-af5c-2046b460b1dc'/>
edecca
+      </source>
edecca
+    </hostdev>
edecca
+    <memballoon model='none'/>
edecca
+  </devices>
edecca
+</domain>
edecca
diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless.x86_64-latest.args b/tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless.x86_64-latest.args
edecca
new file mode 100644
edecca
index 0000000000..0ac90c81d2
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless.x86_64-latest.args
edecca
@@ -0,0 +1,37 @@
edecca
+LC_ALL=C \
edecca
+PATH=/bin \
edecca
+HOME=/home/test \
edecca
+USER=test \
edecca
+LOGNAME=test \
edecca
+QEMU_AUDIO_DRV=spice \
edecca
+/usr/bin/qemu-system-i686 \
edecca
+-name guest=QEMUGuest2,debug-threads=on \
edecca
+-S \
edecca
+-object secret,id=masterKey0,format=raw,\
edecca
+file=/tmp/lib/domain--1-QEMUGuest2/master-key.aes \
edecca
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
edecca
+-m 214 \
edecca
+-realtime mlock=off \
edecca
+-smp 1,sockets=1,cores=1,threads=1 \
edecca
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
edecca
+-no-user-config \
edecca
+-nodefaults \
edecca
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
edecca
+-mon chardev=charmonitor,id=monitor,mode=control \
edecca
+-rtc base=utc \
edecca
+-no-shutdown \
edecca
+-no-acpi \
edecca
+-boot strict=on \
edecca
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
edecca
+-drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-0-0 \
edecca
+-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
edecca
+-spice port=0,seamless-migration=on \
edecca
+-display egl-headless \
edecca
+-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,\
edecca
+vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pci.0,addr=0x2 \
edecca
+-device vfio-pci,id=hostdev0,\
edecca
+sysfsdev=/sys/bus/mdev/devices/53764d0e-85a0-42b4-af5c-2046b460b1dc,display=on,\
edecca
+bus=pci.0,addr=0x3 \
edecca
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
edecca
+resourcecontrol=deny \
edecca
+-msg timestamp=on
edecca
diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless.xml b/tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless.xml
edecca
new file mode 100644
edecca
index 0000000000..c8f10c2f3a
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless.xml
edecca
@@ -0,0 +1,40 @@
edecca
+<domain type='qemu' id='1'>
edecca
+  <name>QEMUGuest2</name>
edecca
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
edecca
+  <memory unit='KiB'>219136</memory>
edecca
+  <currentMemory unit='KiB'>219136</currentMemory>
edecca
+  <vcpu placement='static'>1</vcpu>
edecca
+  <os>
edecca
+    <type arch='i686' machine='pc'>hvm</type>
edecca
+    <boot dev='hd'/>
edecca
+  </os>
edecca
+  <clock offset='utc'/>
edecca
+  <on_poweroff>destroy</on_poweroff>
edecca
+  <on_reboot>restart</on_reboot>
edecca
+  <on_crash>destroy</on_crash>
edecca
+  <devices>
edecca
+    <emulator>/usr/bin/qemu-system-i686</emulator>
edecca
+    <disk type='block' device='disk'>
edecca
+      <driver name='qemu' type='raw'/>
edecca
+      <source dev='/dev/HostVG/QEMUGuest2'/>
edecca
+      <target dev='hda' bus='ide'/>
edecca
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
edecca
+    </disk>
edecca
+    <controller type='usb' index='0'>
edecca
+    </controller>
edecca
+    <controller type='pci' index='0' model='pci-root'/>
edecca
+    <controller type='ide' index='0'>
edecca
+    </controller>
edecca
+    <graphics type='spice'/>
edecca
+    <graphics type='egl-headless'/>
edecca
+    <hostdev mode='subsystem' type='mdev' model='vfio-pci' display='on'>
edecca
+      <source>
edecca
+        <address uuid='53764d0e-85a0-42b4-af5c-2046b460b1dc'/>
edecca
+      </source>
edecca
+    </hostdev>
edecca
+    <video>
edecca
+      <model type='qxl' heads='1'/>
edecca
+    </video>
edecca
+    <memballoon model='none'/>
edecca
+  </devices>
edecca
+</domain>
edecca
diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.x86_64-latest.args b/tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.x86_64-latest.args
edecca
new file mode 100644
edecca
index 0000000000..1fd9fdaa16
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.x86_64-latest.args
edecca
@@ -0,0 +1,36 @@
edecca
+LC_ALL=C \
edecca
+PATH=/bin \
edecca
+HOME=/home/test \
edecca
+USER=test \
edecca
+LOGNAME=test \
edecca
+QEMU_AUDIO_DRV=spice \
edecca
+/usr/bin/qemu-system-i686 \
edecca
+-name guest=QEMUGuest2,debug-threads=on \
edecca
+-S \
edecca
+-object secret,id=masterKey0,format=raw,\
edecca
+file=/tmp/lib/domain--1-QEMUGuest2/master-key.aes \
edecca
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
edecca
+-m 214 \
edecca
+-realtime mlock=off \
edecca
+-smp 1,sockets=1,cores=1,threads=1 \
edecca
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
edecca
+-no-user-config \
edecca
+-nodefaults \
edecca
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
edecca
+-mon chardev=charmonitor,id=monitor,mode=control \
edecca
+-rtc base=utc \
edecca
+-no-shutdown \
edecca
+-no-acpi \
edecca
+-boot strict=on \
edecca
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
edecca
+-drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-0-0 \
edecca
+-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
edecca
+-spice port=0,gl=on,rendernode=/dev/dri/foo,seamless-migration=on \
edecca
+-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,\
edecca
+vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pci.0,addr=0x2 \
edecca
+-device vfio-pci,id=hostdev0,\
edecca
+sysfsdev=/sys/bus/mdev/devices/53764d0e-85a0-42b4-af5c-2046b460b1dc,display=on,\
edecca
+bus=pci.0,addr=0x3 \
edecca
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
edecca
+resourcecontrol=deny \
edecca
+-msg timestamp=on
edecca
diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.xml b/tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.xml
edecca
new file mode 100644
edecca
index 0000000000..18c9817608
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.xml
edecca
@@ -0,0 +1,41 @@
edecca
+<domain type='qemu' id='1'>
edecca
+  <name>QEMUGuest2</name>
edecca
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
edecca
+  <memory unit='KiB'>219136</memory>
edecca
+  <currentMemory unit='KiB'>219136</currentMemory>
edecca
+  <vcpu placement='static'>1</vcpu>
edecca
+  <os>
edecca
+    <type arch='i686' machine='pc'>hvm</type>
edecca
+    <boot dev='hd'/>
edecca
+  </os>
edecca
+  <clock offset='utc'/>
edecca
+  <on_poweroff>destroy</on_poweroff>
edecca
+  <on_reboot>restart</on_reboot>
edecca
+  <on_crash>destroy</on_crash>
edecca
+  <devices>
edecca
+    <emulator>/usr/bin/qemu-system-i686</emulator>
edecca
+    <disk type='block' device='disk'>
edecca
+      <driver name='qemu' type='raw'/>
edecca
+      <source dev='/dev/HostVG/QEMUGuest2'/>
edecca
+      <target dev='hda' bus='ide'/>
edecca
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
edecca
+    </disk>
edecca
+    <controller type='usb' index='0'>
edecca
+    </controller>
edecca
+    <controller type='pci' index='0' model='pci-root'/>
edecca
+    <controller type='ide' index='0'>
edecca
+    </controller>
edecca
+    <graphics type='spice'>
edecca
+      <gl enable='yes' rendernode='/dev/dri/foo'/>
edecca
+    </graphics>
edecca
+    <hostdev mode='subsystem' type='mdev' model='vfio-pci' display='on'>
edecca
+      <source>
edecca
+        <address uuid='53764d0e-85a0-42b4-af5c-2046b460b1dc'/>
edecca
+      </source>
edecca
+    </hostdev>
edecca
+    <video>
edecca
+      <model type='qxl' heads='1'/>
edecca
+    </video>
edecca
+    <memballoon model='none'/>
edecca
+  </devices>
edecca
+</domain>
edecca
diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.x86_64-latest.args b/tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.x86_64-latest.args
edecca
new file mode 100644
edecca
index 0000000000..cdf545d0e0
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.x86_64-latest.args
edecca
@@ -0,0 +1,37 @@
edecca
+LC_ALL=C \
edecca
+PATH=/bin \
edecca
+HOME=/home/test \
edecca
+USER=test \
edecca
+LOGNAME=test \
edecca
+QEMU_AUDIO_DRV=none \
edecca
+/usr/bin/qemu-system-i686 \
edecca
+-name guest=QEMUGuest2,debug-threads=on \
edecca
+-S \
edecca
+-object secret,id=masterKey0,format=raw,\
edecca
+file=/tmp/lib/domain--1-QEMUGuest2/master-key.aes \
edecca
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
edecca
+-m 214 \
edecca
+-realtime mlock=off \
edecca
+-smp 1,sockets=1,cores=1,threads=1 \
edecca
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
edecca
+-no-user-config \
edecca
+-nodefaults \
edecca
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
edecca
+-mon chardev=charmonitor,id=monitor,mode=control \
edecca
+-rtc base=utc \
edecca
+-no-shutdown \
edecca
+-no-acpi \
edecca
+-boot strict=on \
edecca
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
edecca
+-drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-0-0 \
edecca
+-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
edecca
+-vnc 127.0.0.1:0 \
edecca
+-display egl-headless \
edecca
+-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,\
edecca
+vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pci.0,addr=0x2 \
edecca
+-device vfio-pci,id=hostdev0,\
edecca
+sysfsdev=/sys/bus/mdev/devices/53764d0e-85a0-42b4-af5c-2046b460b1dc,display=on,\
edecca
+bus=pci.0,addr=0x3 \
edecca
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
edecca
+resourcecontrol=deny \
edecca
+-msg timestamp=on
edecca
diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.xml b/tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.xml
edecca
new file mode 100644
edecca
index 0000000000..b3eaeeef13
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.xml
edecca
@@ -0,0 +1,40 @@
edecca
+<domain type='qemu' id='1'>
edecca
+  <name>QEMUGuest2</name>
edecca
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
edecca
+  <memory unit='KiB'>219136</memory>
edecca
+  <currentMemory unit='KiB'>219136</currentMemory>
edecca
+  <vcpu placement='static'>1</vcpu>
edecca
+  <os>
edecca
+    <type arch='i686' machine='pc'>hvm</type>
edecca
+    <boot dev='hd'/>
edecca
+  </os>
edecca
+  <clock offset='utc'/>
edecca
+  <on_poweroff>destroy</on_poweroff>
edecca
+  <on_reboot>restart</on_reboot>
edecca
+  <on_crash>destroy</on_crash>
edecca
+  <devices>
edecca
+    <emulator>/usr/bin/qemu-system-i686</emulator>
edecca
+    <disk type='block' device='disk'>
edecca
+      <driver name='qemu' type='raw'/>
edecca
+      <source dev='/dev/HostVG/QEMUGuest2'/>
edecca
+      <target dev='hda' bus='ide'/>
edecca
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
edecca
+    </disk>
edecca
+    <controller type='usb' index='0'>
edecca
+    </controller>
edecca
+    <controller type='pci' index='0' model='pci-root'/>
edecca
+    <controller type='ide' index='0'>
edecca
+    </controller>
edecca
+    <graphics type='vnc'/>
edecca
+    <graphics type='egl-headless'/>
edecca
+    <hostdev mode='subsystem' type='mdev' model='vfio-pci' display='on'>
edecca
+      <source>
edecca
+        <address uuid='53764d0e-85a0-42b4-af5c-2046b460b1dc'/>
edecca
+      </source>
edecca
+    </hostdev>
edecca
+    <video>
edecca
+      <model type='qxl' heads='1'/>
edecca
+    </video>
edecca
+    <memballoon model='none'/>
edecca
+  </devices>
edecca
+</domain>
edecca
diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-vnc.x86_64-latest.args b/tests/qemuxml2argvdata/hostdev-mdev-display-vnc.x86_64-latest.args
edecca
new file mode 100644
edecca
index 0000000000..19439afda9
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2argvdata/hostdev-mdev-display-vnc.x86_64-latest.args
edecca
@@ -0,0 +1,36 @@
edecca
+LC_ALL=C \
edecca
+PATH=/bin \
edecca
+HOME=/home/test \
edecca
+USER=test \
edecca
+LOGNAME=test \
edecca
+QEMU_AUDIO_DRV=none \
edecca
+/usr/bin/qemu-system-i686 \
edecca
+-name guest=QEMUGuest2,debug-threads=on \
edecca
+-S \
edecca
+-object secret,id=masterKey0,format=raw,\
edecca
+file=/tmp/lib/domain--1-QEMUGuest2/master-key.aes \
edecca
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
edecca
+-m 214 \
edecca
+-realtime mlock=off \
edecca
+-smp 1,sockets=1,cores=1,threads=1 \
edecca
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
edecca
+-no-user-config \
edecca
+-nodefaults \
edecca
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
edecca
+-mon chardev=charmonitor,id=monitor,mode=control \
edecca
+-rtc base=utc \
edecca
+-no-shutdown \
edecca
+-no-acpi \
edecca
+-boot strict=on \
edecca
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
edecca
+-drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-0-0 \
edecca
+-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
edecca
+-vnc 127.0.0.1:0 \
edecca
+-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,\
edecca
+vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pci.0,addr=0x2 \
edecca
+-device vfio-pci,id=hostdev0,\
edecca
+sysfsdev=/sys/bus/mdev/devices/53764d0e-85a0-42b4-af5c-2046b460b1dc,display=on,\
edecca
+bus=pci.0,addr=0x3 \
edecca
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
edecca
+resourcecontrol=deny \
edecca
+-msg timestamp=on
edecca
diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-vnc.xml b/tests/qemuxml2argvdata/hostdev-mdev-display-vnc.xml
edecca
new file mode 100644
edecca
index 0000000000..f5b3575c04
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2argvdata/hostdev-mdev-display-vnc.xml
edecca
@@ -0,0 +1,39 @@
edecca
+<domain type='qemu' id='1'>
edecca
+  <name>QEMUGuest2</name>
edecca
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
edecca
+  <memory unit='KiB'>219136</memory>
edecca
+  <currentMemory unit='KiB'>219136</currentMemory>
edecca
+  <vcpu placement='static'>1</vcpu>
edecca
+  <os>
edecca
+    <type arch='i686' machine='pc'>hvm</type>
edecca
+    <boot dev='hd'/>
edecca
+  </os>
edecca
+  <clock offset='utc'/>
edecca
+  <on_poweroff>destroy</on_poweroff>
edecca
+  <on_reboot>restart</on_reboot>
edecca
+  <on_crash>destroy</on_crash>
edecca
+  <devices>
edecca
+    <emulator>/usr/bin/qemu-system-i686</emulator>
edecca
+    <disk type='block' device='disk'>
edecca
+      <driver name='qemu' type='raw'/>
edecca
+      <source dev='/dev/HostVG/QEMUGuest2'/>
edecca
+      <target dev='hda' bus='ide'/>
edecca
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
edecca
+    </disk>
edecca
+    <controller type='usb' index='0'>
edecca
+    </controller>
edecca
+    <controller type='pci' index='0' model='pci-root'/>
edecca
+    <controller type='ide' index='0'>
edecca
+    </controller>
edecca
+    <graphics type='vnc'/>
edecca
+    <hostdev mode='subsystem' type='mdev' model='vfio-pci' display='on'>
edecca
+      <source>
edecca
+        <address uuid='53764d0e-85a0-42b4-af5c-2046b460b1dc'/>
edecca
+      </source>
edecca
+    </hostdev>
edecca
+    <video>
edecca
+      <model type='qxl' heads='1'/>
edecca
+    </video>
edecca
+    <memballoon model='none'/>
edecca
+  </devices>
edecca
+</domain>
edecca
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
edecca
index 848e40440a..9237a4fb89 100644
edecca
--- a/tests/qemuxml2argvtest.c
edecca
+++ b/tests/qemuxml2argvtest.c
edecca
@@ -1591,6 +1591,13 @@ mymain(void)
edecca
             QEMU_CAPS_DEVICE_VFIO_PCI);
edecca
     DO_TEST_PARSE_ERROR("hostdev-mdev-invalid-target-address",
edecca
             QEMU_CAPS_DEVICE_VFIO_PCI);
edecca
+    DO_TEST_CAPS_LATEST("hostdev-mdev-display-spice-opengl");
edecca
+    DO_TEST_CAPS_LATEST("hostdev-mdev-display-spice-egl-headless");
edecca
+    DO_TEST_CAPS_LATEST("hostdev-mdev-display-vnc");
edecca
+    DO_TEST_CAPS_LATEST("hostdev-mdev-display-vnc-egl-headless");
edecca
+    DO_TEST_PARSE_ERROR("hostdev-mdev-display-missing-graphics",
edecca
+            QEMU_CAPS_DEVICE_VFIO_PCI,
edecca
+            QEMU_CAPS_VFIO_PCI_DISPLAY);
edecca
     DO_TEST("pci-rom", NONE);
edecca
     DO_TEST("pci-rom-disabled", NONE);
edecca
     DO_TEST("pci-rom-disabled-invalid", NONE);
edecca
-- 
edecca
2.18.0
edecca