[Qemu-devel] [PATCH v8 0/9] vfio: add display support

Gerd Hoffmann posted 9 patches 6 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180306113442.15295-1-kraxel@redhat.com
Test checkpatch passed
Test docker-build@min-glib passed
Test docker-mingw@fedora passed
Test docker-quick@centos6 passed
Test ppcbe passed
Test ppcle passed
Test s390x passed
hw/vfio/pci.h                                      |   5 +
include/hw/vfio/vfio-common.h                      |  22 ++
include/standard-headers/drm/drm_fourcc.h          | 411 +++++++++++++++++++++
include/standard-headers/linux/input-event-codes.h |   1 +
include/standard-headers/linux/input.h             |  11 +
include/standard-headers/linux/pci_regs.h          |  30 +-
include/standard-headers/linux/virtio_net.h        |  13 +
include/ui/console.h                               |   2 +
include/ui/qemu-pixman.h                           |   5 +
linux-headers/asm-powerpc/kvm.h                    |   2 +
linux-headers/asm-powerpc/unistd.h                 |   3 +
linux-headers/asm-s390/unistd.h                    | 401 +-------------------
linux-headers/asm-s390/unistd_32.h                 | 364 ++++++++++++++++++
linux-headers/asm-s390/unistd_64.h                 | 331 +++++++++++++++++
linux-headers/asm-x86/kvm_para.h                   |   4 +
linux-headers/linux/kvm.h                          |  90 +++++
linux-headers/linux/psci.h                         |   3 +
linux-headers/linux/vfio.h                         |  72 ++++
hw/display/vga-pci.c                               |   9 +
hw/vfio/common.c                                   |   7 +
hw/vfio/display.c                                  | 347 +++++++++++++++++
hw/vfio/pci.c                                      |  10 +
ui/console.c                                       |  79 +++-
ui/qemu-pixman.c                                   |  22 ++
hw/vfio/Makefile.objs                              |   2 +-
scripts/update-linux-headers.sh                    |   8 +
ui/trace-events                                    |   2 +
27 files changed, 1839 insertions(+), 417 deletions(-)
create mode 100644 include/standard-headers/drm/drm_fourcc.h
create mode 100644 linux-headers/asm-s390/unistd_32.h
create mode 100644 linux-headers/asm-s390/unistd_64.h
create mode 100644 hw/vfio/display.c
[Qemu-devel] [PATCH v8 0/9] vfio: add display support
Posted by Gerd Hoffmann 6 years, 1 month ago
This series adds support for a vgpu display to the qemu vfio code.

v8:
 - codestyle fixes, this time for real ...

v7:
 - rebase to latest master.
 - dmabuf: update cursor hotspot properly (Tina).
 - dmabuf: track whenever cursor hotspot + position changes.
 - codestyle fixes.

v6:
 - add support for hotplugging QemuConsoles.
 - drop vfio-pci-display device, re-add OnOffAuto display property.
 - add proper cleanup in finalize.

v5:
 - rebase to latest master
 - drop DeviceState->hotpluggable patch, use separate vfio-pci-display
   device instead so we can use DeviceClass->hotpluggable.
 - add vfio dma-buf patch.  Right now this can be tested with '-display
   egl-headless' only.  gtk and spice support is almost ready for merge
   and should follow soon.

cheers,
  Gerd

Gerd Hoffmann (9):
  linux-headers: update to 4.16-rc1
  standard-headers: add drm/drm_fourcc.h
  ui/pixman: add qemu_drm_format_to_pixman()
  console: minimal hotplug suport
  secondary-vga: properly close QemuConsole on unplug
  vfio/common: cleanup in vfio_region_finalize
  vfio/display: core & wireup
  vfio/display: adding region support
  vfio/display: adding dmabuf support

 hw/vfio/pci.h                                      |   5 +
 include/hw/vfio/vfio-common.h                      |  22 ++
 include/standard-headers/drm/drm_fourcc.h          | 411 +++++++++++++++++++++
 include/standard-headers/linux/input-event-codes.h |   1 +
 include/standard-headers/linux/input.h             |  11 +
 include/standard-headers/linux/pci_regs.h          |  30 +-
 include/standard-headers/linux/virtio_net.h        |  13 +
 include/ui/console.h                               |   2 +
 include/ui/qemu-pixman.h                           |   5 +
 linux-headers/asm-powerpc/kvm.h                    |   2 +
 linux-headers/asm-powerpc/unistd.h                 |   3 +
 linux-headers/asm-s390/unistd.h                    | 401 +-------------------
 linux-headers/asm-s390/unistd_32.h                 | 364 ++++++++++++++++++
 linux-headers/asm-s390/unistd_64.h                 | 331 +++++++++++++++++
 linux-headers/asm-x86/kvm_para.h                   |   4 +
 linux-headers/linux/kvm.h                          |  90 +++++
 linux-headers/linux/psci.h                         |   3 +
 linux-headers/linux/vfio.h                         |  72 ++++
 hw/display/vga-pci.c                               |   9 +
 hw/vfio/common.c                                   |   7 +
 hw/vfio/display.c                                  | 347 +++++++++++++++++
 hw/vfio/pci.c                                      |  10 +
 ui/console.c                                       |  79 +++-
 ui/qemu-pixman.c                                   |  22 ++
 hw/vfio/Makefile.objs                              |   2 +-
 scripts/update-linux-headers.sh                    |   8 +
 ui/trace-events                                    |   2 +
 27 files changed, 1839 insertions(+), 417 deletions(-)
 create mode 100644 include/standard-headers/drm/drm_fourcc.h
 create mode 100644 linux-headers/asm-s390/unistd_32.h
 create mode 100644 linux-headers/asm-s390/unistd_64.h
 create mode 100644 hw/vfio/display.c

-- 
2.9.3


Re: [Qemu-devel] [PATCH v8 0/9] vfio: add display support
Posted by Gerd Hoffmann 6 years, 1 month ago
On Tue, Mar 06, 2018 at 12:34:33PM +0100, Gerd Hoffmann wrote:
> This series adds support for a vgpu display to the qemu vfio code.

Ok, for anyone who wants play with this, the requirements:

qemu
====

The repo at git://git.kraxel.org/qemu has a sirius/dmabufs-merge branch
with this series and spice patches and gtk patches merged.

The traditional work/intel-vgpu branch has been updated too (it is the
same as sirius/dmabufs-merge plus some work-in-progress patches).

host kernel
===========

You need a 4.16-rc kernel.  The intel graphics driver comes with mdev
support.  Needs gen5+ hardware (broadwell, skylake, kaby-lake).  Not
sure about nvidia.

Pure software drivers are available from 
   git://git.kraxel.org/cgit/linux vfio-sample-display

There are three kernel modules in samples/vfio-mdev:

  (1) mdpy.ko.  Very simple display device.  Fixed framebuffer and
      resolution.  Uses the region-based vfio display interface.
  (2) mbochs.ko.  Mimics qemu vga with bochs dispi vbe interface.
      Doesn't emulate any legacy vga.  But good enough to make the
      bochs-drm.ko driver happy.  Uses the dmabuf-based vfio display
      interface.  Zero-copy display updates.
  (3) mdpy-fb.ko.  Guest framebuffer driver for (1).

guest kernel
============

intel-gvt: 4.9+ I think.
nvidia:    dunno.
mbochs:    3.14+ should work.
mdpy:      The vfio-sample-display branch above if you want see guest
	   display updates.  Without that you'll see a static test
	   pattern.

booting the guest
=================

Create mdev devices and use "-device vfio-pci,..." as usual, see
https://www.kernel.org/doc/Documentation/vfio-mediated-device.txt

For mdev devices using dmabufs you need opengl support.
So start qemu with spice or gtk ui and opengl enabled:

  qemu -display gtk,gl=on
  qemu -spice gl=on,$otherargs

When using a display without opengl support you can use egl-headless to
handle the opengl rendering and texture readout (which of course adds
some overhead):

  qemu -display egl-headless -vga $display
  qemu -display egl-headless -spice gl=off,$otherargs

enjoy,
  Gerd