Last active
November 14, 2022 05:14
-
-
Save f1yn/cee797b94cd96885ed301558d53d73c6 to your computer and use it in GitHub Desktop.
VFIO Setup for GPU passthrough on Fedora 36 (Intel)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is not a bash script (notice the lack of #!). Please do not run this as a single bash script. | |
| # These commands come AS IS, WITH NO WARRANTY. I AM NOT RESPONSIBLE IF YOU BORK YOUR SYSTEM | |
| # Get these for later | |
| sudo dnf install driverctl | |
| # Install virt manager and friends | |
| sudo dnf group install virtualization | |
| # Get the BUSIDS of the cards | |
| lspci -nn | |
| # Add the IDs to the grub2 bootloader config (you need both graphical and audio) | |
| # ... intel_iommu=on vfio-pci.ids=[busid1],[busid2] ... | |
| sudo vim /etc/default/grub | |
| # Also add the ids to the vfio init conf (you might need to add softdep on the next line if using yucky nvidia drivers) | |
| # ... options vfio-pci ids=[busid1],[busid2] ... | |
| sudo vim /etc/modprobe.d/vfio.conf | |
| # Rebuild grub | |
| sudo grub2-mkconfig -o /boot/grub2/grub.cfg | |
| # Tell dracut that we will be loading vfio and friends on boot | |
| sudo -s | |
| echo "vfio" > /etc/modules-load.d/vfio.conf | |
| echo "vfio-pci" > /etc/modules-load.d/vfio-pci.conf | |
| echo "vfio_iommu_type1" > /etc/modules-load.d/vfio_iommu_type1.conf | |
| exit | |
| # Run dracut command to make sure vfio is correctly loaded after grub | |
| sudo dracut -f --kver "$(uname -r)" | |
| # Reboot then verify | |
| sudo reboot | |
| lspci -k | |
| # Your graphics card (and graphics audio adapter) should both show up with the lines: | |
| # ... Kernel driver in use: vfio-pci ... | |
| # Bonus: Mess around with driverctl to switch between native and vfio-pci as needed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment