GPU Passthrough with Qemu/Libvirt on Linux

1 minute read

lspci -nn | grep -E "NVIDIA"

In our case our IDs are 11cd:39b3,11cd:21vc.

amd_iommu=on iommu=pt vfio-pci.ids=11cd:39b3,11cd:21vc
sudo grub-mkconfig -o /boot/grub/grub.cfg
sudo reboot
sudo vim /etc/modprobe.d/vfio.conf

Put the following inside this conf file

options vfio-pci ids=11cd:39b3,11cd:21vc
softdep nvidia pre: vfio-pci
sudo mkinitcpio -P
sudo reboot
lspci -k | grep -E "vfio-pci|NVIDIA"

Note: you may not see the GPU inside the VM before installing the drivers.