Talk:Intel GVT-g

From ArchWiki
Jump to navigation Jump to search

If you don't set the aperture size[1] to at least 512MB[2], you won't get all of the options listed on mdev_supported_types[3]. It might be a good idea to add a section that talks about this. CuriousTommy (talk) 04:53, 31 January 2019 (UTC)

GTK display crashes on Wayland but not on X11

On Wayland, after firing up a Windows 10 guest with "-display gtk,gl=on", the window shows up for a while then crashes:

   location/to/QEMU/script: line <number>: 14321 Segmentation fault      (core dumped) <qemu commands>

my script:

   qemu-system-x86_64 \
   -m 4G -smp 8,cores=4 \
   -enable-kvm \
   -k en-us \
   -machine kernel_irqchip=on,type=q35 \
   -cpu host,hv-time,hv-relaxed,hv-vapic,hv-spinlocks=0x1fff,hv-runtime \
   -usb -device usb-tablet \
   -soundhw hda \
   -drive file=$HOME/virtual-machines/win10.raw,format=raw \
   -device intel-iommu,caching-mode=on \
   -net nic -net user,smb=$HOME/data \
   -vga none \
     -display gtk,gl=on \
     -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 \
     -device vfio-pci,sysfsdev=/sys/bus/pci/devices/0000:00:02.0/158ae64a-0d18-4ef9-b991-199985c3fdb2/,display=on,x-igd-opregion=on

Running it on X11 or adding "GDK_BACKEND=x11" doesn't cause this problem. Perhaps we should note this as well? Takutekato2 (talk) 10:04, 19 April 2020 (UTC)

Libvirt hook

Hear is a modified libvirt hook that does not require modification for each domain that has vgpu like the one in the article.

If the domain has no mdev vgpu element, the value of GVT_GUID is an empty string (null). The if's test to make sure its not null. (-n "$GVT_GUID").

/etc/libvirt/hooks/qemu
#!/bin/bash

GVT_PCI="0000:00:02.0"
GVT_GUID="$(xmllint --xpath 'string(/domain/devices/hostdev[@type="mdev"][@display="on"]/source/address/@uuid)' -)"
MDEV_TYPE="i915-GVTg_V5_4"

if [ $# -ge 3 ]; then
    if [ -n "$GVT_GUID" -a $2 = "prepare" -a $3 = "begin" ]; then
        echo "$GVT_GUID" > "/sys/bus/pci/devices/$GVT_PCI/mdev_supported_types/$MDEV_TYPE/create"
    elif [ -n "$GVT_GUID" -a $2 = "release" -a $3 = "end" ]; then
        echo 1 > /sys/bus/pci/devices/$GVT_PCI/$GVT_GUID/remove
    fi
fi
fi

It's important to make sure GVT_GUID is NOT null before executing the remove statement, or $GVT_PCI/$GVT_GUID/remove becomes $GVT_PCI//remove, removing the host iGPU, crashing the host (that happened to me). The value @display="on" above should be changed to @display="off", depending on how the domain is setup, according to the article. Chriscjsus (talk) 00:04, 7 August 2021 (UTC)