Hardware Passthrough

Hardware Passthrough

GPU

iGPU (Intel)

Intels integrated GPUs from 5th up to and including 10th Gen have GVT-g support. That means that the GPU can be subdivided into smaller, logical GPUs. That way you can pass the GPU to multiple VMs instead of just one (like you do if the iGPU only supports VTD-d).
To enable GPU passthrough with GVT-g do the following:

  1. Add intel_iommu=on i915.enable_gvt=1 to the grub configuration:
/etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on i915.enable_gvt=1"
  1. Make it so the necessary kernel modules are loaded at boot time:
/etc/modules
vfio
vfio_iommu_type1
vfio_pci
kvmgt
  1. Update initramfs
update-initramfs -u -k all
  1. Update GRUB
update-grub
  1. Reboot

  2. Check dmesg output for output:

dmesg | grep -e DMAR -e IOMMU

Output should contain

DMAR: IOMMU enabled
DMAR: Intel(R) Virtualization Technology for Directed I/O
  1. You can list the amount of available logical GPUs (change device ID to that of yours):
cat /sys/bus/pci/devices/0000\:00\:02.0/mdev_supported_types/i915-GVTg_V5_4/available_instances
  1. Now a logical GPU can be passed through to a VM or container!
    Choose Add -> PCI Device and select your iGPU. Notice how it says Mediated: yes, that means the iGPU is divided into separate logical GPUs. Now open the MDev Type Dropdown. Here you can see the different logical GPUs and select one:

“So many GPUs!”