-
Notifications
You must be signed in to change notification settings - Fork 0
VFIO Steps (Version 20.04 LTS)
As of version 20.04 LTS, Ubuntu has decided to make the VFIO drivers built-in to the default kernel instead of a module. This has made VFIO much easier in most cases, however, if you wish to perform a VFIO pass-through with two GPUs that are the same model you may run into trouble. You can still do VFIO pass-through with identical GPUs, but you will have to load a different kernel that has VFIO loaded as a module. I will not be going into details on how to do this, sorry for the inconvenience.
You will need to know your GPU's ID. To do this, run the lspci -vnn
command and search for your GPU you wish to passthrough.
As an example, here is mine:
09:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP104 [GeForce GTX 1070 Ti] [10de:1b82] (rev a1) (prog-if 00 [VGA controller])
09:00.1 Audio device [0403]: NVIDIA Corporation GP104 High Definition Audio Controller [10de:10f0] (rev a1)
Note that you will need the Audio device on the GPU as well.
Keep track of your GPU's ID numbers, mine are 10de:1b82
and 10de:10f0
.
We will be using Kernelstub to add parameters to our kernel. It is recommended to use Kernelstub so that your parameters are not reset during an update.
Add the following parameters using these commands:
sudo kernelstub -a 'intel_iommu=on'
sudo kernelstub -a 'iommu=pt'
Now add this command with your GPU IDs (replace the numbers in the command with your GPU IDs separated by comma):
sudo kernelstub -a 'vfio-pci.ids=\"10de:1b82,10de:10f0\"'
Once your computer is rebooted, run lspci -vnn
and check if your GPU is using the vfio-pci
driver:
09:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP104 [GeForce GTX 1070 Ti] [10de:1b82] (rev a1) (prog-if 00 [VGA controller])
Subsystem: Micro-Star International Co., Ltd. [MSI] GP104 [GeForce GTX 1070 Ti] [1462:330f]
Flags: bus master, fast devsel, latency 0, IRQ 84, NUMA node 0
Memory at c0000000 (32-bit, non-prefetchable) [size=16M]
Memory at a0000000 (64-bit, prefetchable) [size=256M]
Memory at b0000000 (64-bit, prefetchable) [size=32M]
I/O ports at 3000 [size=128]
Expansion ROM at c1000000 [disabled] [size=512K]
Capabilities: <access denied>
Kernel driver in use: vfio-pci
Kernel modules: nvidiafb, nouveau
09:00.1 Audio device [0403]: NVIDIA Corporation GP104 High Definition Audio Controller [10de:10f0] (rev a1)
Subsystem: Micro-Star International Co., Ltd. [MSI] GP104 High Definition Audio Controller [1462:330f]
Flags: bus master, fast devsel, latency 0, IRQ 85, NUMA node 0
Memory at c1080000 (32-bit, non-prefetchable) [size=16K]
Capabilities: <access denied>
Kernel driver in use: vfio-pci
Kernel modules: snd_hda_intel
Please report anything that is incorrect throughout this Wiki to issues.