[libvirt] [PATCH v4 09/10] qemu: command: Enable formatting vfio-pci.display option onto cmdline

Ján Tomko jtomko at redhat.com
Wed Jul 18 15:15:28 UTC 2018


On Wed, Jul 18, 2018 at 02:31:45PM +0200, Erik Skultety wrote:
>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.
>QEMU defaults to 'auto' for the 'display' attribute, which is not
>foolproof, so we need to play it safe here and explicitly format
>display='off' if this attribute wasn't provided in the XML explicitly.

Outdated comment, now that we set it in postParse.

>
>Signed-off-by: Erik Skultety <eskultet at redhat.com>
>---
> src/qemu/qemu_command.c                            |  4 +++
> .../hostdev-mdev-display-missing-graphics.xml      | 35 ++++++++++++++++++
> ...v-display-spice-egl-headless.x86_64-latest.args | 37 +++++++++++++++++++
> .../hostdev-mdev-display-spice-egl-headless.xml    | 40 +++++++++++++++++++++
> ...ev-mdev-display-spice-opengl.x86_64-latest.args | 36 +++++++++++++++++++
> .../hostdev-mdev-display-spice-opengl.xml          | 41 ++++++++++++++++++++++
> ...dev-display-vnc-egl-headless.x86_64-latest.args | 37 +++++++++++++++++++
> .../hostdev-mdev-display-vnc-egl-headless.xml      | 40 +++++++++++++++++++++
> .../hostdev-mdev-display-vnc.x86_64-latest.args    | 36 +++++++++++++++++++
> .../qemuxml2argvdata/hostdev-mdev-display-vnc.xml  | 39 ++++++++++++++++++++
> tests/qemuxml2argvtest.c                           |  7 ++++
> 11 files changed, 352 insertions(+)
> create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-missing-graphics.xml
> create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless.x86_64-latest.args
> create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-spice-egl-headless.xml
> create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.x86_64-latest.args
> create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.xml
> create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.x86_64-latest.args
> create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-vnc-egl-headless.xml
> create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-vnc.x86_64-latest.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 7c44045d61..c61da13893 100644
>--- a/src/qemu/qemu_command.c
>+++ b/src/qemu/qemu_command.c
>@@ -5207,6 +5207,10 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *def,
>     virBufferAdd(&buf, dev_str, -1);
>     virBufferAsprintf(&buf, ",id=%s,sysfsdev=%s", dev->info->alias, mdevPath);
>
>+    if (mdevsrc->display != VIR_TRISTATE_SWITCH_ABSENT)

To play it completely safe, we could add
  && qemuCapsGet(QEMU_CAPS_VFIO_PCI_DISPLAY)
here, and allow having it set to VIR_TRISTATE_SWITCH_OFF in qemuDomainMdevDefValidate.

But I'm not sure whether it's worth the trouble.

Regardless
Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano

>+                          virTristateSwitchTypeToString(mdevsrc->display));
>+
>     if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0)
>         goto cleanup;
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180718/3824fa4b/attachment-0001.sig>


More information about the libvir-list mailing list