Proxmox VE is an open-source software server for virtualization management. It is a hosted Type-2 hypervisor, and it can host Linux, as well as Windows and macOS. It is chiefly designed for servers, but it is also great for workstations. Imagine you can have separated workspaces that run different operating systems, and they can run simultaneously!
Proxmox VE is based on Debian GNU/Linux, so this part also works™️ for Debian GNU/Linux.
Prerequisite
- Enable VT-d in BIOS
Enable PCI(e) Passthrough
Edit /etc/default/grub
to enable IOMMU:
....
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on video=efifb:off video=vesafb:off pcie_aspm=off"
....
Load VFIO kernel modules in /etc/modules
:
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
Finally, regenerate initramfs
and reboot:
update-grub
update-initramfs -u -k all
Configure GPU Passthrough
Blacklist graphical card drivers to prevent them from being loaded:
echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf
echo "blacklist nvidia" >> /etc/modprobe.d/blacklist.conf
Check for the identifier of the GPU:
root@pve-workstation:~# lspci -v | grep VGA
01:00.0 VGA compatible controller: NVIDIA Corporation GP104 [GeForce GTX 1070] (rev a1) (prog-if 00 [VGA controller]
In this case, the identifier of GPU is 01:00.0
. Then, check for the device ID:
root@pve-workstation:~# lspci -n -s 01:00
01:00.0 0300: 10de:1b81 (rev a1)
01:00.1 0403: 10de:10f0 (rev a1)
Here we have 2 device IDs (GPU and built-in audio). We need to configure VFIO for both of them:
export GPU_PCI="01:00"
export GPU_G_DID="$(lspci -n | grep '$GPU_PCI.0' | cut -d ':' -f 3-4 | cut -c 2-10)"
export GPU_A_DID="$(lspci -n | grep '$GPU_PCI.1' | cut -d ':' -f 3-4 | cut -c 2-10)"
echo "options vfio-pci ids=${GPU_G_DID},${GPU_A_DID} disable_vga=1"> /etc/modprobe.d/vfio.conf
To prevent the unsupported MSRS error which leads to crashes, add some tweaks to modules:
echo "options vfio_iommu_type1 allow_unsafe_interrupts=1" > /etc/modprobe.d/iommu_unsafe_interrupts.conf
echo "options kvm ignore_msrs=1 report_ignored_msrs=0" > /etc/modprobe.d/kvm.conf
Now, after a reboot, the graphics card should be ready to be passed through.