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 🤠
Hey, simple question, I have like two GPUs (one integrated from cpu):
00:02.0 Display controller: Intel Corporation CometLake-S GT2 [UHD Graphics 630] (rev 05)
DeviceName: Onboard - Video
Subsystem: ASUSTeK Computer Inc. Device 8694
Kernel driver in use: i915
01:00.0 VGA compatible controller: NVIDIA Corporation GA102 [GeForce RTX 3080] (rev a1)
Subsystem: ZOTAC International (MCO) Ltd. Device 1612
Kernel driver in use: nouveau
Kernel modules: nouveau
How does it work? Will my computer use the integrated GPU from the CPU if I disable the GPU (main, rtx 3080) from Booting?
Best regards
cian