Simular Guides
- (My) Perfect Gaming VM Setup with GPU Passthrough – Virtualization Server Part 14
- Configuring GPU Passthrough with VFIO on Fedora 30 notes
Usefull Commands
lspci -nnk
list pci devicessudo grub2-mkconfig -o /etc/grub2-efi.cfg
updates the grubsudo call-a-friend @ballas
calls the best knowledge base, fuck wiki 🤣
First you will have to find the GPU id's that you would like to passthrough, you can do this by running in the terminal:
# For AMD GPU's:
$ lspci -nnk | grep Navi
# For nvidia GPU's:
$ lspci -nnk | grep NVIDIA
Example output, here we are interested in the VGA compatible controller
(1002:73bf) and the Audio device
(1002:ab28)
0a:00.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 XL Upstream Port of PCI Express Switch [1002:1478] (rev c1)
0b:00.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 XL Downstream Port of PCI Express Switch [1002:1479]
0c:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] [1002:73bf] (rev c1)
0c:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 21 HDMI Audio [Radeon RX 6800/6800 XT / 6900 XT] [1002:ab28]
Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] Navi 21 HDMI Audio [Radeon RX 6800/6800 XT / 6900 XT] [1002:ab28]
First you will have to modify the default grub file.
$ sudo gedit /etc/default/grub
We want to modify the GRUB_CMDLINE_LINUX
# for amd gpu replace GPU_TYPE with `amdgpu`.
# for nvidia gpu replace GPU_TYPE with `nouveau`.
# if you have and intel replace `amd_iommu` with `intel_iommu`.
# `vfio-pci.ids` are equivalent to the id's found in the previous step.
# values to add
`amd_iommu=on`
`video=efifb:off` // disable gpu on boot
`kvm.ignore_msrs=1`
`rd.driver.pre=vfio-pci` // this preloads the vfio-pci
- GRUB_CMDLINE_LINUX="rhgb quiet"
+ GRUB_CMDLINE_LINUX="rhgb quiet rd.driver.blacklist=GPU_TYPE modprobe.blacklist=GPU_TYPE video=efifb:off amd_iommu=on rd.driver.pre=vfio-pci kvm.ignore_msrs=1 vfio-pci.ids=1002:73bf,1002:ab28"
Then we need to update grup
sudo grub2-mkconfig -o /etc/grub2-efi.cfg
We then need to edit the dracut config
$ sudo gedit /etc/dracut.conf.d/local.conf
add_drivers+=" vfio vfio_iommu_type1 vfio_pci vfio_virqfd "
$ sudo dracut -f --kver $(uname -r)
Rebooot!
$ sudo dnf groupinstall virtualization
Then you reboot 🦸
- Open up
Virtual Machine Manager
- Create new virtual machine
- Local install media (ISO image or CDROM) -> Select the ISO to windows10 or windows11
- Assign Ram & CPU
- Tick the
Customize configuration before install
If you are running windows 11 you will need a secure boot and tpm module.
- Under overview add the following config
Chipset: q35
Firmware: x86_64:/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd
- Under CPUs, untick the
copy host cpu configuration
then for a example use the following config for a Ryzen 5900x
Model: host-passthrough
Topology
[X] Manually set CPU topology
Sockets: 1
Cores: 6
Threads: 2
- Add a TPM module by clicking on
Add Hardware > TPM
Model: TIS
Backend: Emulated device
Version: 2.0
And then you can begin installation. Bobs your uncle 🤠
Yup, you will have to plug in display outputs to both your motherboards display out and your gpu's output. Also make sure that the gpu you're passing through exists in its own iommu group,
Essentially just run this script:
and see if the output puts your gpu you want to pass through in its own iommu group entirely (Should look something like this)
(heres a snippet from the archwiki that goes through this in detail)