Enable ***Intel VT-d*** or ***AMD-Vi*** in BIOS settings. \
If you can't find those virtualization options in BIOS, your hardware probably doesn't support it.
Enable ***Intel VT-d*** or ***AMD-Vi*** in BIOS settings. If these options are not present, it is likely that your hardware does not support IOMMU.
Disable **Resizable BAR Support** in BIOS settings.
Disable ***Resizable BAR Support*** in BIOS settings.
Cards that support Resizable BAR can cause problems with black screens following driver load if Resizable BAR is enabled in UEFI/BIOS. There doesn't seem to be a large performance penalty for disabling it, so turn it off for now until ReBAR support is available for KVM.
***Set the kernel paramater depending on your CPU.*** \
@ -36,18 +35,9 @@ Reboot your system for the changes to take effect.
```sh
dmesg | grep IOMMU
```
The output of above command should contain the following message:
The output should include the message `Intel-IOMMU: enabled` for Intel CPUs or `AMD-Vi: AMD IOMMUv2 loaded and initialized` for AMD CPUs.
```
Intel-IOMMU: enabled
```
or
```
AMD-Vi: AMD IOMMUv2 loaded and initialized
```
Now, you need to make sure that your IOMMU groups are valid. \
Run the following script to view the IOMMU groups and attached devices. \
To view the IOMMU groups and attached devices, run the following script:
```sh
#!/bin/bash
shopt -s nullglob
@ -59,15 +49,13 @@ for g in `find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V`; do
done;
```
During passthrough, you need to pass every device (except PCI) in the group which includes your GPU. \
When using passthrough, it is necessary to pass every device in the group that includes your GPU. \
You can avoid having to pass everything by using [ACS override patch](https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF#Bypassing_the_IOMMU_groups_(ACS_override_patch)).
### **Install required tools**
<details>
<summary><b>Gentoo Linux</b></summary>
RECOMMENDED USE FLAGS: app-emulation/virt-manager gtk<br>
             app-emulation/qemu spice usb usbredir pulseaudio