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

Before any of these commands matter, IOMMU has to be enabled at the firmware level (look for VT-d, AMD-Vi or IOMMU in BIOS / UEFI). Common GRUB parameters to enable it on the Linux side: intel_iommu=on (Intel) or amd_iommu=on (AMD), often combined with iommu=pt video=efifb:off video=vesa:off.

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 use UEFI/OVMF (required for GPU passthrough)

After changing GRUB or modprobe configs

Run update-grub + update-initramfs -u, then reboot. 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