I have found a guide that tells me to do the following to get GPU pass through working on 20.04
apt install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager ovmf
lspci -nn
returns
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA104 [GeForce RTX 3060 Ti Lite Hash Rate] [10de:2489] (rev a1)
01:00.1 Audio device [0403]: NVIDIA Corporation GA104 High Definition Audio Controller [10de:228b] (rev a1)
/etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_iommu=on kvm.ignore_msrs=1 vfio-pci.ids=10de:2489,10de:228b"
Then
update-grub
However when I reboot back I get a plain black screen. Is the process different for 22.04? i9-12900k is the CPU
GPU PASSTHROUGH GUIDE FOR UBUNTU 22.04 LTS
This guide was tested on Ubuntu 22.04 LTS with Nouveau driver and the following system configuration:
Attention! This guide is only relevant for Nouveau driver. Please read the text carefully before you start system changes.
HARDWARE SPECIFICATION REQUIRED FOR THIS GUIDE
For Intel based system:
Motherboard with Integrated Graphics (for manipulations)
CPU with VT-x, VT-d and Processor Graphics
Discrete Graphics Card with GPU passthrough support (for passthrough)
Monitor with two inputs like Displayport, D-SUB, DVI, HDMI or switcher box with monitor or two monitors.
For AMD based system:
Motherboard with Integrated Graphics (for manipulations)
CPU with AMD-V, AMD-Vi and Integrated Graphics
Discrete Graphics Card with GPU passthrough support (for passthrough)
Monitor with two inputs like Displayport, D-SUB, DVI, HDMI or switcher box with monitor or two monitors.
See list of IOMMU-supporting hardware (list may not be complete).
Also You will need 8GB RAM for operating system (OS) and 8GB RAM for guest machine, the 16GB RAM may significantly increase your HDD's or SSD's performance and lifetime.
REQUIRED STEPS
STEP 1. Enable Hardware-assisted virtualization in the BIOS
For Intel based system enable Intel Virtualization Tech (VT-x) and Intel VT-D Tech
For AMD based system enable SVM Mode.
STEP 2. Set the BIOS to use the Integrated Graphics as the primary boot device
Attention! If you boot the system with designed for passthrough PCI-Express Graphics Device, error code 43* will appear.
STEP 3. Check for IOMMU Support on your CPU
For AMD processor:
For Intel processor:
You should see the highlighted text svm or vmx.
STEP 4. Enable IOMMU
Add the following options to GRUB_CMDLINE_LINUX_DEFAULT=""
For AMD processor:
For Intel processor:
STEP 5. Update GRUB
STEP 6. Reboot your system
STEP 7. Check that IOMMU is enabled
You should see message like below:
STEP 8. Find your device
You should see text like below:
If You see text "Kernel driver in use: nvidia" like below:
your system uses NVIDIA Proprietary Drivers. You need to remove all old video drivers. Here is a recipe which removes all old video drivers, and reinstalls nouveau:
Run autoremove:
Then reboot your system and repeat the STEP 8.
STEP 9. Create a new file called vfio.conf
Add the following lines with your device IDs from the STEP 8:
STEP 10. Update the existing initramfs
STEP 11. Reboot your system
STEP 12. Make sure everything is OK
You should see text like below:
STEP 13. Use VirtManager to create a new guest machine
Install KVM
Add user
If you have group issue "adduser: The group `libvirtd' does not exist." try:
Install VirtManager
Create new guest machine with a custom configuration.
You must:
a) select the "Q35" chipset and "UEFI x86_64:/usr/share/OVMF/OVMF_CODE_4M.ms.fd" firmware or similar
b) add PCI Host Devices** for GPU passthrough
c) set QXL video driver and SPICE client for display with "Address" listen type.
STEP 14. Edit the guest machine
Add the following lines:
The end result should look something like:
Once your done editing, use CTRL+x to save the changes.
STEP 15. Run the guest machine
NOTE
If you want to use the PCI-Express Graphics Device as the primary boot device, do the following:
Change the following lines with your device IDs from the STEP 8:
with:
Update the existing initramfs
Reboot your system and set the BIOS to use the PCI-Express Graphics Device as the primary boot device.
TROUBLESHOOTING
Problem: the guest machine start normally but I see black screen.
Action:
check the cable connections and the settings of your monitor
check the steps 1, 2, 14
install the correct device driver on Windows
uninstall and reinstall the device driver on Windows
update the device driver on Windows
REFERENCES
KVM GPU Passthrough Tutorial
Fighting error 43 – Nvidia GPU in a virtual machine
Fix graphics device problems with error code 43
VideoDriverDetection
YouTube | GPU passthrough guide for Ubuntu 20.04
* Windows has stopped this device because it has reported problems (code 43).
** For example the NVIDIA Corporation TU117 [GeForce GTX 1650] and NVIDIA Corporation devices