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

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