Hardware Passthrough

Hardware Passthrough

GPU

iGPU (Intel)

Intels integrated GPUs from 5th up to and including 10th Gen have GVT-g support. That means that the GPU can be subdivided into smaller, logical GPUs. That way you can pass the GPU to multiple VMs instead of just one (like you do if the iGPU only supports VTD-d).
To enable GPU passthrough with GVT-g do the following:

  1. Add intel_iommu=on i915.enable_gvt=1 to the grub configuration:
/etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on i915.enable_gvt=1"
  1. Make it so the necessary kernel modules are loaded at boot time:
/etc/modules
vfio
vfio_iommu_type1
vfio_pci
kvmgt
  1. Update initramfs
update-initramfs -u -k all
  1. Update GRUB
update-grub
  1. Reboot

  2. Check dmesg output for output:

dmesg | grep -e DMAR -e IOMMU

Output should contain

DMAR: IOMMU enabled
DMAR: Intel(R) Virtualization Technology for Directed I/O
  1. You can list the amount of available logical GPUs (change device ID to that of yours):
cat /sys/bus/pci/devices/0000\:00\:02.0/mdev_supported_types/i915-GVTg_V5_4/available_instances
  1. Now a logical GPU can be passed through to a VM or container!
    Choose Add -> PCI Device and select your iGPU. Notice how it says Mediated: yes, that means the iGPU is divided into separate logical GPUs. Now open the MDev Type Dropdown. Here you can see the different logical GPUs and select one:

“So many GPUs!”

PCIe

Intel NIC/Network Adapter

The following is being done with an Intel I350-T4 NIC in a Lenovo Thinkcentre M720q.

  1. Add intel_iommu=on iommu=pt pci_pt_e820_access=on pci=assign-busses to the grub configuration:
⚠️
Apparently the order of the boot flags do matter! It only worked for me, when pci=assign-busses came last.
Additionally, it did not work for me when iGPU-Passthrough flags were set. I did not spend more time on it to fix it, so it may or may not be possible to have both.
/etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt pci_pt_e820_access=on pci=assign-busses"
ℹ️
pci=assign-busses may not be necessary in your case, if your mainboard/firmware is better than the M720q’s one at assigning IOMMU IDs.
  1. Update grub with the new options:
update-grub
  1. Add the file /etc/modprobe.d/igb.conf with the following contents (this will add 7 additional virtual functions (ports) per physical port):
/etc/modprobe.d/igb.conf
options igb max_vfs=7
  1. In the Proxmox-Node settings under Network, set the NICs to Autostart = yes

  2. Reboot

  3. There should now be seven NICs per Port available:

“So many NICs!”