[Intel-gfx] [PATCH v18 0/6] drm/i915/gvt: Dma-buf support for GVT-g

Gerd Hoffmann kraxel at redhat.com
Thu Nov 16 09:33:38 UTC 2017


> > > This patch set can be tried with the following example:
> > > 	git://git.kraxel.org/qemu  branch: work/intel-vgpu
> > > 
> > 
> > Tested-by: Gerd Hoffmann <kraxel at redhat.com>
> 
> Hi Gerd,
> 
> Can you share the xml snippets required for the VM to make this work?
> Last I tried I couldn't get the display/video/hostdev configuration to
> get any enhanced behavior through the dmabuf.  Thanks,

qemu built from the branch listed above.

Testing with a shell script right now, see below.  First argument is the
mode.  "vgpu-gtk" works fine.  "vgpu-spice-remote" works too, even
remotely, but it's not very efficient (grabs display data via opengl
ReadPixels, then sends it over classic spice protocol).

For the latter I have a libvirt snippet too, which has to jump through a
few loops due to libvirt not having support for vgou display yet, with
the most annonying issue being that libvirt insists adding a emulated
vga to the guest if you configure spice.

HTH,
  Gerd

====================== cut here ====================
#!/bin/sh

# args
mode="${1-vga}"; shift

# config
vers="26"
live="$(ls -t $HOME/iso/Fedora*Live*${vers}*.iso | head -1)"
name="$(basename $live)"
qemu="/usr/local/bin/qemu-system-x86_64"
uuid="aca92d96-6654-43d9-8f45-544c19e89f20"
path="/sys/bus/mdev/devices/${uuid}"

###########################################################################
# tweaks

case "$mode" in
vga)
	args="-vga std"
	;;
virtio)
	args="-vga virtio"
	;;
virtio-gl)
	args=""
	args="$args -vga virtio"
	args="$args -display gtk,gl=on"
	;;
vgpu-gtk)
	args=""
	args="$args -vga none"
	args="$args -display gtk,gl=on"
	args="$args -device vfio-pci,sysfsdev=${path},addr=0x5,x-display=on"
	qemu="sudo $qemu"
	;;
vgpu-sdl)
	# intel sdl 1.2 patches ...
	args=""
	args="$args -vga none"
	args="$args -display sdl"
	args="$args -device vfio-pci,sysfsdev=${path},addr=0x5"
	qemu="sudo $qemu"
	;;
vgpu-spice-local)
	# using spice, passing around dma-bufs
	# FIXME: launch remote-viewer on unix socket
	args=""
	args="$args -vga none"
	args="$args -spice disable-ticketing,gl=on,unix,addr=/tmp/spice-vgpu"
	args="$args -device vfio-pci,sysfsdev=${path},addr=0x5,x-display=on"
	qemu="sudo $qemu"
	;;
vgpu-spice-remote)
	# using spice, readpixels dmabuf,
	# send traditional spice display updates
	(sleep 1; remote-viewer spice://localhost:5909) &
	args=""
	args="$args -vga none"
	args="$args -display egl-headless"
	args="$args -spice disable-ticketing,gl=off,port=5909"
	args="$args -device vfio-pci,sysfsdev=${path},addr=0x5,x-display=on"
	qemu="sudo $qemu"
	;;
*)
	echo "unknown mode: $mode"
	echo "valid modes:"
	echo "    vga virtio virtio-gl vgpu-gtk vgpu-sdl"
	echo "    vgpu-spice-local vgpu-spice-remote"
	exit 1
	;;
esac

###########################################################################
# go!

set -ex
exec $qemu -enable-kvm -name "$name"			\
	-boot menu=on -m 2G -usb			\
	-drive if=none,id=live,media=cdrom,file="$live"	\
	-netdev user,id=unet \
	\
	-device virtio-net-pci,addr=0x08,netdev=unet	\
	-device virtio-scsi-pci,addr=0x09		\
	-device scsi-cd,drive=live,scsi-id=4,bootindex=1 \
	-device usb-tablet				\
	\
	$args "$@"
====================== cut here ====================
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>liveiso-vgpu-remote</name>
  <uuid>a2fc1e5e-8370-44b2-a31f-140f441e0355</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.8'>hvm</type>
    <bootmenu enable='yes'/>
    <bios useserial='yes'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <vmport state='off'/>
  </features>
  <cpu mode='custom' match='exact' check='partial'>
    <model fallback='allow'>Broadwell</model>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source file='/home/kraxel/iso/Fedora-Workstation-Live-x86_64-26-1.5.iso'/>
      <target dev='sda' bus='scsi'/>
      <readonly/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='4' unit='0'/>
    </disk>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='scsi' index='0' model='virtio-scsi'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </controller>
    <controller type='usb' index='0' model='nec-xhci'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x14' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:28:99:99'/>
      <source network='bios'/>
      <model type='virtio'/>
      <boot order='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='spice' autoport='yes'>
      <listen type='address'/>
    </graphics>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x19' function='0x0'/>
    </sound>
    <video>
      <model type='cirrus' vram='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci'>
      <source>
        <address uuid='aca92d96-6654-43d9-8f45-544c19e89f20'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
    </memballoon>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-set'/>
    <qemu:arg value='device.video0.driver=ne2k_pci'/>
    <qemu:arg value='-set'/>
    <qemu:arg value='device.hostdev0.x-display=yes'/>
    <qemu:arg value='-display'/>
    <qemu:arg value='egl-headless'/>
  </qemu:commandline>
</domain>



More information about the Intel-gfx mailing list