Elementary OS 5.0 / Ubuntu 18.XX - VFIO PCIe passthrough guide / tutorial

Check if IOMMU is working

it is a good idea to check to see that IOMMU grouping is working properly. This script from Wendell will help you:

cd ~
nano iommu-check.sh

and copy following:

#!/bin/bash
for d in /sys/kernel/iommu_groups/*/devices/*; do
  n=${d#*/iommu_groups/*}; n=${n%%/*}
  printf 'IOMMU Group %s ' "$n"
  lspci -nns "${d##*/}"
done

save and exit.

then run:

sh iommu-check.sh

If all is good you should see something like this:

Now you need to find your 2 GPUs (including their audio interfaces). In my case:

Nvidia 970 is in Group 14:

IOMMU Group 14 07:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM204 [GeForce GTX 970] [10de:13c2] (rev a1)
IOMMU Group 14 07:00.1 Audio device [0403]: NVIDIA Corporation GM204 High Definition Audio Controller [10de:0fbb] (rev a1)

Nvidia 450 is in Group 15:

IOMMU Group 15 08:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF106 [GeForce GTS 450] [10de:0dc4] (rev a1)
IOMMU Group 15 08:00.1 Audio device [0403]: NVIDIA Corporation GF106 High Definition Audio Controller [10de:0be9] (rev a1)

Possible edge case scenarios:

A) GPUs are sharing same group, or IOMMU is not working, follor this guide:

https://forum.level1techs.com/t/elementary-os-5-0-beta-vfio-pcie-passthrough-guide-tutorial/131420/17


B) cards with identical IDs (for example, my RX580 and 570 have same ID).

SKIP NEXT STEP OF THIS GUIDE

you wont be assigning any IDs, because they are same. Instead follow guide at link bellow and after its done, one of your cards will have vfio-pcie driver assigned to it.

Also, you will probably need to enable SECURE BOOT, if you cant get it to boot afterwards and get MODSIGN: Couldn't get UEFI db list error

https://forum.level1techs.com/t/vfio-in-2019-pop-os-how-to-general-guide-though-draft/142287

^^ after you complete it, you can continue here https://forum.level1techs.com/t/elementary-os-5-0-ubuntu-18-xx-vfio-pcie-passthrough-guide-tutorial/131420/7