GPU Passthrough

Help and Info~5 minView script

Reference for inspecting and configuring GPU / TPU passthrough on Proxmox: device identification (lspci), VFIO module setup, IOMMU validation, initramfs / GRUB updates and per-VM passthrough config (qm set hostpci, machine q35, bios ovmf).

IOMMU must be enabled in BIOS / UEFI

Enable IOMMU in firmware first: look for VT-d, AMD-Vi or IOMMU in BIOS/UEFI. AMD enables IOMMU by default on the Linux side, as do Intel systems with Proxmox kernels 6.8 and newer. Older Intel kernels may need intel_iommu=on. The optional iommu=pt setting controls IOMMU passthrough mode; it is not a reason to disable the host framebuffer indiscriminately.

Device Identification

CommandDescriptionAction
lspci -nn | grep -i nvidiaList NVIDIA PCI devices
lspci -nn | grep -i vgaList all VGA compatible devices
lspci -nn | grep -i amdList AMD PCI devices
lspci -nnk | grep -A3 VGAList VGA devices with kernel drivers
lspci -v -s <PCI_ID>Show detailed info for specific PCI device

VFIO Configuration

CommandDescriptionAction
dmesg | grep -i vfioCheck VFIO module messages
cat /etc/modprobe.d/vfio.confReview VFIO passthrough configuration
ls -la /etc/modprobe.d/List all modprobe configuration files
cat /etc/modulesShow modules loaded at boot time
lsmod | grep vfioCheck if VFIO modules are loaded

IOMMU Configuration

CommandDescriptionAction
cat /etc/default/grubReview GRUB options for IOMMU
update-grubApply GRUB changes
dmesg | grep -i iommuCheck IOMMU messages in kernel log
dmesg | grep -e DMAR -e IOMMUCheck DMAR and IOMMU messages
find /sys/kernel/iommu_groups/ -type l | sort -VList IOMMU groups

System Updates

CommandDescriptionAction
update-initramfs -uApply initramfs changes (VFIO)
update-initramfs -u -k allUpdate initramfs for all kernels
cat /proc/cmdlineShow current kernel boot parameters

VM Configuration

CommandDescriptionAction
qm config <vmid> | grep hostpciShow PCI passthrough config for a VM
qm set <vmid> -hostpci0 <PCI_ID>,pcie=1,x-vga=1Add GPU passthrough to a VM
cat /etc/pve/qemu-server/<vmid>.confView VM configuration file
qm set <vmid> -machine q35Set VM to use Q35 chipset (recommended for passthrough)
qm set <vmid> -bios ovmfSet VM to UEFI/OVMF (recommended when the GPU ROM supports UEFI)

After changing GRUB or modprobe configs

On hosts using GRUB, apply boot-option changes with update-grub. Refresh module changes with update-initramfs -u -k all, then reboot. Other bootloaders require their own configuration procedure. Verify with cat /proc/cmdline (kernel parameters), dmesg | grep -i iommu (IOMMU initialised) and find /sys/kernel/iommu_groups/ -type l | sort -V (groups present).

Related