I run this on Intel CPU with integrated GPU with suppport for face recognision - i3-8100T . Your CPU need to support JPEG encoding: https://en.wikipedia.org/wiki/Intel_Quick_Sync_Video#Hardware_decoding_and_encoding . The best choice is a processor from the Coffee Lake series.
To run kernel with GPU virtualization you need to boot with params:
init_on_alloc=0 i915.enable_gvt=1 kvm.ignore_msrs=1 intel_iommu=on i915.enable_guc=0
Next, you need this hook to libvirt,
Variables:
GVT_PCI - REF: https://wiki.archlinux.org/title/Intel_GVT-g#Prerequisite
GVT_GUID - you must generate UID by command uuidgen
.
MDEV_TYPE - REF: https://wiki.archlinux.org/title/Intel_GVT-g#Prerequisite
DOMAIN - libvirt DOMAIN which need to use virtual GPU.
cat /etc/libvirt/hooks/qemu
#!/bin/bash
GVT_PCI='0000:00:02.0'
GVT_GUID='UUID_GENERATED'
MDEV_TYPE='i915-GVTg_V5_4'
DOMAIN='LIBVIRT_DOMAIN'
echo "\$1: $1 \$2: $2 \$3: $3 \$4: $4" >> /var/log/hook
if [ $1 == $DOMAIN ]; then
if [ $# -ge 3 ]; then
echo "3" >> /var/log/hook
if [ $2 = "prepare" -a $3 = "begin" ]; then
echo "add" >> /var/log/hook
echo "$GVT_GUID" > "/sys/bus/pci/devices/$GVT_PCI/mdev_supported_types/$MDEV_TYPE/create"
elif [ $2 = "release" -a $3 = "end" ]; then
echo "end" >> /var/log/hook
echo 1 > /sys/bus/pci/devices/$GVT_PCI/$GVT_GUID/remove
fi
fi
fi
echo "endscript" >> /var/log/hook
Then, you must generate redpill image, i use this: https://github.com/tossp/redpill-tool-chain/blob/master/README_EN.md
Next, i use GUI virt-manager
app to settings this VM, follow my screenshots. In few screenshots, i show you XML code,
because this settings cannot set with GUI:
In this address field you must use variable GVT_GUID
from hook script.
<hostdev mode="subsystem" type="mdev" managed="no" model="vfio-pci" display="off">
<source>
<address uuid="GVT_GUID"/>
</source>
<alias name="hostdev0"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0"/>
</hostdev>
<video>
<model type="cirrus" vram="16384" heads="1" primary="yes"/>
<alias name="video0"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x17" function="0x0"/>
</video>
<video>
<model type="virtio" heads="1"/>
<alias name="video1"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x06" function="0x0"/>
</video>