Passthrough Intel Dedicated GPU While Using iGPU SRIOV

Here's How to Use Intel Arc GPU While Using iGPU SRIOV

The Problem

Traditionally, when we would like to passthrough a GPU to a Guest VM, we will have to blacklist the drivers from being loaded. nouveau and nvidia for NVIDIA GPUs, amdgpu and radeon for AMD GPUs and i915 and xe for Intel GPUs.

The problem is, if we are taking advantage of the Intel iGPU SRIOV capabilities, we can’t blacklist the sweet i915 driver. But without blacklisting it, if your system has an Intel Arc GPU that you would like to assign to a VM, you are out of luck.

Thankfully, there is a solution.

The Process

So, in order to passthrough my Intel Arc A380 to a VM to use it in, a few things need to happen:

  1. The GPU must not be used by the host
  2. The GPU must have vfio-pci driver loaded
  3. The Guest VM need to have the driver to use it

The first one is relatively easy if you can blacklist xe and i915, but since we are also using the iGPU SRIOV, we can’t do that. So, we will use some modprobe magic to make it happen.

First, look for your GPU and the associated Audio Device with lspci.

As you can see, my Arc A380 is on bus 03:00.0 and the audio device is on 04:00.0.

03:00.0 VGA compatible controller: Intel Corporation DG2 [Arc A380] (rev 05)
04:00.0 Audio device: Intel Corporation DG2 Audio Controller

Next, run lspci -n to find their vendor ID and device ID, we will need them later.

03:00.0 0300: 8086:56a5 (rev 05)
04:00.0 0403: 8086:4f92

So, the GPU has the 8086:56a5 ID, and the audio device has the 8086:4f92 id. With that, we will make some changes to the driver loading process. First of all, edit the /etc/modprobe.d/vfio.conf and use the acquired IDs:

options vfio-pci ids=8086:56a5,8086:4f92 ##GPU ID and Audio ID

softdep i915 pre: vfio-pci
softdep snd_hda_intel pre: vfio-pci

What softdep does is that it would recommend the drivers in the pre section to take precedence. In this context, when the system tries to load the i915 and snd_hda_intel drivers for the Arc A380, it will reference this configuration file and loads vfio-pci instead.

Of course, in order to pass the GPU, we will need some extra configurations. Edit the /etc/modules file and add the following:

vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd

Save everything, update initramfs by running initramfs-update -u, and then reboot.

After system reboot, you should see the vfio\-pci driver is loaded for the Arc graphics card by running lspci -nnk:

03:00.0 VGA compatible controller [0300]: Intel Corporation DG2 [Arc A380] [8086:56a5] (rev 05)
        Subsystem: ASRock Incorporation DG2 [Arc A380] [1849:6004]
        Kernel driver in use: vfio-pci
        Kernel modules: xe, i915
04:00.0 Audio device [0403]: Intel Corporation DG2 Audio Controller [8086:4f92]
        Subsystem: ASRock Incorporation DG2 Audio Controller [1849:6004]
        Kernel driver in use: vfio-pci
        Kernel modules: snd_hda_intel

Now you can use this Arc GPU for PCIe passthrough to other VMs, while still enjoy your iGPU SRIOV.

Wanna know what an Arc A380 is good at? How about an AI-powered NVR solution? Stay tuned as I will use this GPU for my upcoming Frigate NVR Tutorial.