Saif Bin ShahabSaif Bin Shahab

GPU Passthrough with Qemu/Libvirt on Linux

August 25, 2025

  • Identify the PCI IDs
lspci -nn | grep -E "NVIDIA"

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

  • Put the following in GRUB_CMDLINE_LINUX_DEFAULT= inside /etc/default/grub
amd_iommu=on iommu=pt vfio-pci.ids=11cd:39b3,11cd:21vc
  • Update GRUB
sudo grub-mkconfig -o /boot/grub/grub.cfg
  • Reboot
sudo reboot
  • Isolate GPU
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
  • Update initramfs
sudo mkinitcpio -P
  • Reboot
sudo reboot
  • Verify the kernal driver in use. It should be using vfio-pci as the kernal driver for the GPU.
lspci -k | grep -E "vfio-pci|NVIDIA"

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