GPU Passthrough
Overview
Section titled “Overview”GPU passthrough allows you to dedicate a GPU to a virtual machine for near-native performance.
Requirements
Section titled “Requirements”- Two GPUs (integrated + dedicated, or two dedicated)
- CPU with VT-d (Intel) or AMD-Vi support
- IOMMU-capable motherboard
BIOS Settings
Section titled “BIOS Settings”Enable these options:
- VT-d / AMD-Vi
- IOMMU
- Above 4G Decoding
Kernel Parameters
Section titled “Kernel Parameters”Edit /etc/default/grub:
GRUB_CMDLINE_LINUX_DEFAULT="intel_iommu=on iommu=pt"For AMD:
GRUB_CMDLINE_LINUX_DEFAULT="amd_iommu=on iommu=pt"Regenerate GRUB:
sudo grub-mkconfig -o /boot/grub/grub.cfgVFIO Setup
Section titled “VFIO Setup”- Identify GPU IDs:
lspci -nn | grep -i nvidia- Add to
/etc/modprobe.d/vfio.conf:
options vfio-pci ids=10de:xxxx,10de:yyyy- Update initramfs:
sudo mkinitcpio -PVirt-Manager Setup
Section titled “Virt-Manager Setup”- Install:
sudo pacman -S virt-manager qemu libvirt - Enable services:
sudo systemctl enable --now libvirtd - Add user to groups:
sudo usermod -aG libvirt,kvm $USER - Create VM and attach GPU via “Add Hardware”
Looking Glass
Section titled “Looking Glass”For low-latency display output from the VM:
yay -S looking-glass