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

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