A Guide to virtualise your Intel GPU. Heavily based on https://forum.qubes-os.org/t/lenovo-thinkpad-t14-gen-5/27923/27. The Output will still be send trough the normal QubesOS pipeline, so no extra Monitor is needed. ATTENTION: This Guide requires executing 3rd party Code in dom0 at Kernel priveleges (a driver). This can be a security risk depending on your threadmodell, but you also can check the code (if you understand a bit of programming). All commands must be run in dom0.

  1. You need this Patchset from Github. Pick the apropriate version for your Kernel (check for Kernel version with uname -a in a dom0 terminal) Download as ZIP or TAR
  2. Copy the code to dom0 (via qvm-run -p [VM] "cat [Path/to/code]" > code, only works on files so you should use a ZIP or TAR Archive)
  3. Uncompress ZIP or TAR (with unzip or tar -xaf)
  4. Add to DKMS via sudo dkms add ./[path/to/unziped/code]
  5. Install module via sudo dkms install i915-sriov-dkms/[version] (use TAB to Autocomplete)

  6. Add the following to your GRUB Kernel commandline in /etc/defualt/grub: intel_iommu=on i915.enable_guc=3 i915.max_vfs=7 module_blacklist=xe intel_iommu=on i915.enable_guc=3 i915.max_vfs=7 module_blacklist=xe (Variable named GRUB_CMDLINE_LINUX_DEFAULT)

  7. Update GRUB: sudo grub2-mkconfig -o /boot/efi/EFI/qubes/grub.cfg

  8. rebuild initramfs: sudo dracut --regenerate-all --force
  9. Restart and when using HEADS or AEM do the respective steps of resigning your boot files.
  10. Activate vGPUs with: echo 7 | sudo tee sys/devices/pci0000\:00/0000\:00\:02.0/sriov_numvfs (Assuming GPU is on PCI device 00:02.0 which is normal for an iGPU at least in my experience. In doubt check with lspci) You can use any value between 1-7 from my experience its better to choose as low as you can if you want to game.
  11. Assign new GPU to respective VM.
  12. Change VM Kernel to version used in dom0 (so the driver is also available to the VM. This may need the qubes-kernel-vm-support, though not realy clear why)
  13. Change VM Kernelopts to enable driver: qvm-features [VM] boot-mode.kernelopts.sriov "i915.force_probe=XXXX i915.enable_guc=3' (as for the XXXX use your GPU device id you get this via cat "/sys/devices/pci000:00/0000:00:02.0/device", may not be needed) and change to the new Kernelopts via: qvm-features [VM] boot-mode.active sriov
  14. Enable GPU acceleration by disabling forced Software Rendering: qvm-service [VM] --disable software-rendering
  15. Recheck if VM is using HVM mode and has enough RAM assigned. You should probably use static RAM assignment without memory balancing.

After that GPU acceleration should work in your VM. You can test with glxheads if your GPU is used.

Problems: For me there is currently one strange Problem. On some Games the VM sometimes hangs on display output. This is not realy reproducible and depends on the game used. While testing i encountered on game that wouldn't run. Check my other Thread for more info on which games. GPU acceleration for other things, like AI (the real one not LLMs), did work fine.

Troubleshooting

driver not picked up in AppVM

  1. Check if the AppVM uses the same kernel as dom0 (otherwise the driver might simply not be included in the modules)
  2. Check if firmware-intel-graphics is installed.

  3. Try installing the Driver in the template via DKMS. For this you also need to setup kernel provided by qube.