From nobody Mon Feb 9 12:29:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1531153485668838.0370730153741; Mon, 9 Jul 2018 09:24:45 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B868A3082145; Mon, 9 Jul 2018 16:24:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 76C5417CF4; Mon, 9 Jul 2018 16:24:42 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2A7D91800B6E; Mon, 9 Jul 2018 16:24:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w69GOcwO020414 for ; Mon, 9 Jul 2018 12:24:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id C04807C4A; Mon, 9 Jul 2018 16:24:38 +0000 (UTC) Received: from beluga.usersys.redhat.com (unknown [10.43.2.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 457D651DF; Mon, 9 Jul 2018 16:24:38 +0000 (UTC) From: Erik Skultety To: libvir-list@redhat.com Date: Mon, 9 Jul 2018 18:24:18 +0200 Message-Id: <269eec665d5319ec224f6342348c719109cf2523.1531151383.git.eskultet@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [PATCH v2 6/7] qemu: command: Enable formatting vfio-pci.display option onto cmdline X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 09 Jul 2018 16:24:44 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Since QEMU 2.12, QEMU understands a new vfio-pci device option 'display' which can be used to turn on display capabilities on vgpu-enabled mediated devices, IOW emulated GPU devices like QXL will no longer be needed with vgpu-enable mdevs. Since QEMU 2.12 defaults to 'auto' for the 'display' attribute, which often doesn't work as reliably, we need to play it safe here and explicitly format display=3D'off' if this attribute wasn't provided in the XML explicitly. Signed-off-by: Erik Skultety --- src/qemu/qemu_command.c | 24 ++++++++++++- .../hostdev-mdev-display-spice-egl-headless.args | 32 +++++++++++++++++ .../hostdev-mdev-display-spice-egl-headless.xml | 40 ++++++++++++++++++= +++ .../hostdev-mdev-display-spice-opengl.args | 31 ++++++++++++++++ .../hostdev-mdev-display-spice-opengl.xml | 41 ++++++++++++++++++= ++++ .../hostdev-mdev-display-vnc-egl-headless.args | 32 +++++++++++++++++ .../hostdev-mdev-display-vnc-egl-headless.xml | 40 ++++++++++++++++++= +++ .../qemuxml2argvdata/hostdev-mdev-display-vnc.args | 31 ++++++++++++++++ .../qemuxml2argvdata/hostdev-mdev-display-vnc.xml | 39 ++++++++++++++++++= ++ tests/qemuxml2argvtest.c | 31 ++++++++++++++++ 10 files changed, 340 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-h= eadless.args create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-h= eadless.xml create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-spice-openg= l.args create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-spice-openg= l.xml create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-hea= dless.args create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-hea= dless.xml create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-vnc.args create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-vnc.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 8026efbe87..6192253a9c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5178,6 +5178,17 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *d= ef, virBufferAdd(&buf, dev_str, -1); virBufferAsprintf(&buf, ",id=3D%s,sysfsdev=3D%s", dev->info->alias, md= evPath); =20 + /* QEMU 2.12 added support for vfio-pci display type, we default to + * 'display=3Doff', since QEMU defaults to 'auto' which is unreliable = and + * we don't want to risk any breakages */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VFIO_PCI_DISPLAY) && + mdevsrc->display =3D=3D VIR_TRISTATE_SWITCH_ABSENT) + mdevsrc->display =3D VIR_TRISTATE_SWITCH_OFF; + + if (mdevsrc->display > VIR_TRISTATE_SWITCH_ABSENT) + virBufferAsprintf(&buf, ",display=3D%s", + virTristateSwitchTypeToString(mdevsrc->display)); + if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0) goto cleanup; =20 @@ -5395,7 +5406,9 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd, =20 /* MDEV */ if (virHostdevIsMdevDevice(hostdev)) { - switch ((virMediatedDeviceModelType) subsys->u.mdev.model) { + virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &subsys->u.md= ev; + + switch ((virMediatedDeviceModelType) mdevsrc->model) { case VIR_MDEV_MODEL_TYPE_VFIO_PCI: if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -5403,6 +5416,15 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd, "supported by this version of QEMU")); return -1; } + + if (mdevsrc->display !=3D VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VFIO_PCI_DISPLAY))= { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("display property of device vfio-pci = is " + "not supported by this version of QEM= U")); + return -1; + } + break; case VIR_MDEV_MODEL_TYPE_VFIO_CCW: if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_CCW)) { diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless= .args b/tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless.args new file mode 100644 index 0000000000..0d7792c938 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless.args @@ -0,0 +1,32 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dspice \ +/usr/bin/qemu-system-i686 \ +-name QEMUGuest2 \ +-S \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest2/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot c \ +-usb \ +-drive file=3D/dev/HostVG/QEMUGuest2,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ +-device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-= 0 \ +-spice port=3D0 \ +-display egl-headless \ +-device qxl-vga,id=3Dvideo0,ram_size=3D67108864,vram_size=3D67108864,bus= =3Dpci.0,\ +addr=3D0x2 \ +-device vfio-pci,id=3Dhostdev0,\ +sysfsdev=3D/sys/bus/mdev/devices/53764d0e-85a0-42b4-af5c-2046b460b1dc,disp= lay=3Don,\ +bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless= .xml b/tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless.xml new file mode 100644 index 0000000000..c8f10c2f3a --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless.xml @@ -0,0 +1,40 @@ + + QEMUGuest2 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + +
+ + + + + + + + + + +
+ + + + + + diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.args = b/tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.args new file mode 100644 index 0000000000..170b4e4ed0 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.args @@ -0,0 +1,31 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dspice \ +/usr/bin/qemu-system-i686 \ +-name QEMUGuest2 \ +-S \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest2/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot c \ +-usb \ +-drive file=3D/dev/HostVG/QEMUGuest2,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ +-device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-= 0 \ +-spice port=3D0,gl=3Don,rendernode=3D/dev/dri/foo \ +-device qxl-vga,id=3Dvideo0,ram_size=3D67108864,vram_size=3D67108864,bus= =3Dpci.0,\ +addr=3D0x2 \ +-device vfio-pci,id=3Dhostdev0,\ +sysfsdev=3D/sys/bus/mdev/devices/53764d0e-85a0-42b4-af5c-2046b460b1dc,disp= lay=3Don,\ +bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.xml b= /tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.xml new file mode 100644 index 0000000000..18c9817608 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.xml @@ -0,0 +1,41 @@ + + QEMUGuest2 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + +
+ + + + + + + + + + + +
+ + + + + + diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.a= rgs b/tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.args new file mode 100644 index 0000000000..439e741b0d --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.args @@ -0,0 +1,32 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i686 \ +-name QEMUGuest2 \ +-S \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest2/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot c \ +-usb \ +-drive file=3D/dev/HostVG/QEMUGuest2,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ +-device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-= 0 \ +-vnc 127.0.0.1:0 \ +-display egl-headless \ +-device qxl-vga,id=3Dvideo0,ram_size=3D67108864,vram_size=3D67108864,bus= =3Dpci.0,\ +addr=3D0x2 \ +-device vfio-pci,id=3Dhostdev0,\ +sysfsdev=3D/sys/bus/mdev/devices/53764d0e-85a0-42b4-af5c-2046b460b1dc,disp= lay=3Don,\ +bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.x= ml b/tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.xml new file mode 100644 index 0000000000..b3eaeeef13 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.xml @@ -0,0 +1,40 @@ + + QEMUGuest2 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + +
+ + + + + + + + + + +
+ + + + + + diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-vnc.args b/tests/q= emuxml2argvdata/hostdev-mdev-display-vnc.args new file mode 100644 index 0000000000..d1fa3e7b8c --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-mdev-display-vnc.args @@ -0,0 +1,31 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i686 \ +-name QEMUGuest2 \ +-S \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest2/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot c \ +-usb \ +-drive file=3D/dev/HostVG/QEMUGuest2,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ +-device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-= 0 \ +-vnc 127.0.0.1:0 \ +-device qxl-vga,id=3Dvideo0,ram_size=3D67108864,vram_size=3D67108864,bus= =3Dpci.0,\ +addr=3D0x2 \ +-device vfio-pci,id=3Dhostdev0,\ +sysfsdev=3D/sys/bus/mdev/devices/53764d0e-85a0-42b4-af5c-2046b460b1dc,disp= lay=3Don,\ +bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-vnc.xml b/tests/qe= muxml2argvdata/hostdev-mdev-display-vnc.xml new file mode 100644 index 0000000000..f5b3575c04 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-mdev-display-vnc.xml @@ -0,0 +1,39 @@ + + QEMUGuest2 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + +
+ + + + + + + + + +
+ + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 26f40d3144..0a289ca9cf 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1591,6 +1591,37 @@ mymain(void) QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST_PARSE_ERROR("hostdev-mdev-invalid-target-address", QEMU_CAPS_DEVICE_VFIO_PCI); + DO_TEST("hostdev-mdev-display-spice-opengl", + QEMU_CAPS_SPICE, + QEMU_CAPS_SPICE_GL, + QEMU_CAPS_SPICE_RENDERNODE, + QEMU_CAPS_DEVICE_QXL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_VFIO_PCI_DISPLAY); + DO_TEST("hostdev-mdev-display-spice-egl-headless", + QEMU_CAPS_SPICE, + QEMU_CAPS_EGL_HEADLESS, + QEMU_CAPS_DEVICE_QXL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_VFIO_PCI_DISPLAY); + DO_TEST("hostdev-mdev-display-vnc", + QEMU_CAPS_VNC, + QEMU_CAPS_DEVICE_QXL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_VFIO_PCI_DISPLAY); + DO_TEST("hostdev-mdev-display-vnc-egl-headless", + QEMU_CAPS_VNC, + QEMU_CAPS_EGL_HEADLESS, + QEMU_CAPS_DEVICE_QXL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_VFIO_PCI_DISPLAY); + DO_TEST_PARSE_ERROR("hostdev-mdev-display-missing-graphics", + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_VFIO_PCI_DISPLAY); DO_TEST("pci-rom", NONE); DO_TEST("pci-rom-disabled", NONE); DO_TEST("pci-rom-disabled-invalid", NONE); --=20 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list