Setting Up GPU Passthrough on Fedora with 2 GPUs

I have 2 GPUs. FIrst one is AMD, and I am adding a second one, NVIDIA. It was already running with AMD so all the drivers were installed. No drivers are installed for NVIDIA. NVIDIA will be used in the VM environment only.

Install Qemu/KVM


Enable IOMMU (both in BIOS and Kernel)

In kernel, you can enable it using this command line argument:

> sudo vim /etc/default/grub
GRUB_CMDLINE_LINUX="... intel_iommu=on" # edit this line and add this new flag
> sudo grub2-mkconfig -o /boot/grub2/grub.cfg # update with the changes
> sudo reboot

Detach the Second GPU from the Host

> virsh nodedev-list # list devices you'd like to detach
> lspci # also you can get numbers here to match with the above command's output

# now attach all relevant devices
> virsh nodedev-detach  pci_0000_03_00_0 
> virsh nodedev-detach  pci_0000_03_00_1

Creating VM

1. Create the machine
2. Now "Add Hardware"
3. Add the required PCI device



Leave a Reply

Your email address will not be published. Required fields are marked *