Skip to content

GPU Passthrough

GPU passthrough allows you to dedicate a GPU to a virtual machine for near-native performance.

  • Two GPUs (integrated + dedicated, or two dedicated)
  • CPU with VT-d (Intel) or AMD-Vi support
  • IOMMU-capable motherboard

Enable these options:

  • VT-d / AMD-Vi
  • IOMMU
  • Above 4G Decoding

Edit /etc/default/grub:

Terminal window
GRUB_CMDLINE_LINUX_DEFAULT="intel_iommu=on iommu=pt"

For AMD:

Terminal window
GRUB_CMDLINE_LINUX_DEFAULT="amd_iommu=on iommu=pt"

Regenerate GRUB:

Terminal window
sudo grub-mkconfig -o /boot/grub/grub.cfg
  1. Identify GPU IDs:
Terminal window
lspci -nn | grep -i nvidia
  1. Add to /etc/modprobe.d/vfio.conf:
Terminal window
options vfio-pci ids=10de:xxxx,10de:yyyy
  1. Update initramfs:
Terminal window
sudo mkinitcpio -P
  1. Install: sudo pacman -S virt-manager qemu libvirt
  2. Enable services: sudo systemctl enable --now libvirtd
  3. Add user to groups: sudo usermod -aG libvirt,kvm $USER
  4. Create VM and attach GPU via “Add Hardware”

For low-latency display output from the VM:

Terminal window
yay -S looking-glass