videogames.ai Blog About Hardware guide
20 August 2023

Proxmox iGPU and dGPU passthrough setup for Ubuntu and Windows

by Mathieu Poliquin

Recently I experimented with Proxmox to test performance (vs running natively on Ubuntu or Windows). Here are the performance results

Setuping GPU and iGPU passthrough involves quite a lot of details to get right so I made this guide for people who has similar hardware as mine (see specs below), hopefuly it saves you time.

Reference docs: https://pve.proxmox.com/wiki/PCI_Passthrough

Hardware specs:

Software specs:

I also ran GPU passthrough on older hardware:

Requirements

Your motherboard and CPU needs to support virtualisation and passthrough.

For the 12700k it works very well but for example I tried two CPUs with an old b85 motherboard (MSI b85-g41 PC mate).

Both supports virtualisation but only the E3 1226 v3 supports passthrough. I made the mistake of assuming every Haswell processor supported passthrough

In the Intel ark you should check for these lines:

If you do have a E3 12XX v3 with a b85 motherboard you should check this guide because there might be additional steps to make it work for this chipset in your case. Luckily, in my case with the hardware listed above, the instructions in this blog post was enough

Host BIOS and VM Machines settings

You need to have virtualisation enabled in your BIOS

For Intel based hardware the option is called “VT-d” and should be set to Enabled

VM settings:

GRUB

In Proxmox web interface right-click on your node and select _Shell to open the terminal

You will need to edit grub to enable intel_iommu which supports virtual to phsyical address translations

launch the editor:

nano /etc/default/grub

Add intel_iommu=on to GRUB_CMDLINE_LINUX_DEFAULT:

GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"

if you need to passthrough your iGPU as well then you need to add the following settings

GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on i915.enable_gvt=1 iommu=pt video=efifb:off video=vesafb:off"

Kernel modules

You need edit modules file to load additional modules

nano /etc/modules

if you only need to passthrough your dGPU:

vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd

If you need pass through your iGPU as well add this line in addtion to the lines above

kvmgt

As stated in the proxmox docs it’s helpful to blacklist GPU drivers to prevent the host from using it

for NVIDIA GPU

echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf 
echo "blacklist nvidia*" >> /etc/modprobe.d/blacklist.conf 

For your intel iGPU

echo "blacklist i915" >> /etc/modprobe.d/blacklist.conf

Apply changes: Update grub and initramfs

After don’t forget to update grub to your new settings and also initramfs

update-grub && update-initramfs -u -k all

REBOOT

You need to reboot for the next steps

After rebooting, as stated in the proxmox docs you should verify IOMMU is properly enabled by checking the dmesg log

dmesg | grep -e DMAR -e IOMMU
dmesg | grep 'remapping'

Add PCI device to VM

Select your VM and under the Hardware select Add->PCI device

Select RAW device and under drop list select your GPU and/or iGPU

check all functions check ROMBAR

Test

Now you should be able to start your Windows or Ubuntu VM and see your dGPU and/or iGPU


tags: Proxmox - GPU - iGPU - Ubuntu - Windows - Intel - 12700k - 1226v3