GPU Passthrough¶
Overview¶
Pass the AMD GPU directly to a VM for native graphics performance.
Display Model
The GPU will be owned by the VM. The host is managed over SSH.
Prerequisites¶
- IOMMU enabled in BIOS (AMD-Vi)
- GPU in its own IOMMU group
- No host drivers attached to GPU
Enable IOMMU¶
Edit /etc/default/grub:
Update GRUB:
Verify IOMMU¶
Look for "AMD-Vi" or "IOMMU enabled".
Find GPU IOMMU Group¶
#!/bin/bash
for d in /sys/kernel/iommu_groups/*/devices/*; do
n=${d#*/iommu_groups/*}; n=${n%%/*}
printf 'IOMMU Group %s ' "$n"
lspci -nns "${d##*/}"
done | grep -i "vga\|audio"
Note the GPU and its audio device IDs (e.g., 1002:xxxx).
Bind GPU to VFIO¶
Create VFIO Configuration¶
Replace with your GPU and audio device IDs.
Load VFIO Early¶
Blacklist AMD Drivers¶
Update Initramfs¶
Verify VFIO Binding¶
Should show Kernel driver in use: vfio-pci.
Attach GPU to VM¶
In virt-manager or virsh:
- Add PCI Host Device (GPU)
- Add PCI Host Device (GPU Audio)
- Remove virtual display (Spice/VNC)
- Connect monitor to GPU HDMI
Troubleshooting¶
IOMMU Group Issues¶
If GPU shares a group with other devices:
- Try different PCIe slots
- Use ACS override patch (last resort)
Reset Issues¶
Some GPUs don't reset properly:
No Display After VM Start¶
- Verify monitor connected to GPU
- Check VM is using UEFI
- Ensure Q35 chipset selected