[libvirt] [RFC PATCH 0/7] Enable vfio-pci 'property' for mediated devices

Erik Skultety eskultet at redhat.com
Wed May 30 13:42:54 UTC 2018


Since QEMU 2.12 there's a new vfio-pci device property 'display' with values
on/off/auto. This special kind of display allows using a mediated device which
is a VGA compatible device for a display output.
There are 2 different implementations of how the device output is handled,
referred to as dmabuf and vfio region mapping (currently NVIDIA uses the latter,
while Intel relies on the former). From libvirt's perspective the important
difference is that dmabuf requires OpenGL support whereas vfio regions don't
(it will of course work even with OpenGL enabled). There's a catch though -
because of several constraints in the vendor drivers (as discussed here [1]),
there currently isn't a reasonable way for libvirt (other than spawning a dummy
 QEMU instance) to probe such mediated devices for the display mode they use.
This the nr.1 reason why libvirt is not going to support the value 'auto' with
QEMU and will default to 'off' instead in all cases to stay safe the least and
therefore is going to rely on users being able to configure this properly
otherwise they'll get an error.

Once there's a way for libvirt to probe the nature of the display-capable
mediated devices, we can consider adding support for 'auto' value meaning that
libvirt is going to take care of adding an appropriate Spice/VNC graphics
device depending on the system if these are missing in the config, otherwise
the user's choice is always favoured.

TL;DR:
- we have a new attribute value for vfio-pci mediated devices called 'display'
    -> devices can now format this new 'display=on/off' property to the cmdline

- if user enables the vfio display (display=on) but doesn't enable OpenGL for
    Spice, we automatically assume the usage of '-display egl-headless'
    (uses local drm nodes) which works both for Spice and VNC
    -> if OpenGL is enabled, then '-display egl-headless' is not necessary

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1475770
[1] https://www.redhat.com/archives/libvir-list/2018-May/msg00243.html

Erik Skultety (7):
  conf: Remove a redundant model/address-type check in mdev post parse
  qemu: command: Move graphics iteration to its own function
  conf: Introduce virDomainDefHasSpiceGL helper
  conf: Introduce new <hostdev> attribute 'display'
  qemu: caps: Add vfio-pci.display capability
  qemu: domain: Set default vfio-pci display value depending on
    capability
  qemu: command: Enable formatting vfio-pci.display option onto cmdline

 docs/formatdomain.html.in                          | 16 ++++-
 docs/schemas/domaincommon.rng                      |  5 ++
 src/conf/domain_conf.c                             | 56 +++++++++++----
 src/conf/domain_conf.h                             |  4 ++
 src/libvirt_private.syms                           |  1 +
 src/qemu/qemu_capabilities.c                       |  2 +
 src/qemu/qemu_capabilities.h                       |  1 +
 src/qemu/qemu_command.c                            | 84 +++++++++++++++-------
 src/qemu/qemu_domain.c                             | 75 +++++++++++++++++++
 tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml |  1 +
 tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml   |  1 +
 tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml   |  1 +
 tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml  |  1 +
 .../hostdev-mdev-display-missing-graphics.xml      | 35 +++++++++
 .../hostdev-mdev-display-spice-no-opengl.args      | 32 +++++++++
 .../hostdev-mdev-display-spice-no-opengl.xml       | 41 +++++++++++
 .../hostdev-mdev-display-spice-opengl.args         | 31 ++++++++
 .../hostdev-mdev-display-spice-opengl.xml          | 41 +++++++++++
 .../qemuxml2argvdata/hostdev-mdev-display-vnc.args | 32 +++++++++
 .../qemuxml2argvdata/hostdev-mdev-display-vnc.xml  | 39 ++++++++++
 tests/qemuxml2argvtest.c                           | 23 ++++++
 .../hostdev-mdev-display-spice-no-opengl.xml       | 47 ++++++++++++
 .../hostdev-mdev-display-spice-opengl.xml          | 48 +++++++++++++
 .../hostdev-mdev-display-vnc.xml                   | 47 ++++++++++++
 tests/qemuxml2xmltest.c                            |  3 +
 25 files changed, 626 insertions(+), 41 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-missing-graphics.xml
 create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-spice-no-opengl.args
 create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-spice-no-opengl.xml
 create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.args
 create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-spice-opengl.xml
 create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-vnc.args
 create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-vnc.xml
 create mode 100644 tests/qemuxml2xmloutdata/hostdev-mdev-display-spice-no-opengl.xml
 create mode 100644 tests/qemuxml2xmloutdata/hostdev-mdev-display-spice-opengl.xml
 create mode 100644 tests/qemuxml2xmloutdata/hostdev-mdev-display-vnc.xml

--
2.14.3




More information about the libvir-list mailing list