Host Setup: Proxmox GPU Passthrough
Proxmox host setup
Table of contents
- Warning: iGPU and VM Only!
- Source Information
- Make IOMMU changes at boot
- Load VFIO modules at boot
- Configure VFIO for PCIe Passthrough
- Blacklist Proxmox host device drivers
- Verify all changes on the Proxmox host
- Next Step: Setup passthrough within a VM
Warning: iGPU and VM Only!
These server-side or host steps are only for Intel integrated GPU (iGPU) passthrough. They will not work as written below with Intel discrete, AMD, or Nvidia GPUs.
These server-side or host steps are only been for passthrough to a VM, not an LXC.
Anand has detailed instructions for LXC passthrough in his excellent article and video, UDMS Part 11: GPU passthrough on Proxmox LXC for Superior HW Transcoding!
These server-side or host steps can be done before or after you have created a VM.
Source Information
Sources:
- iKoolcore R2 script code at https://github.com/KoolCore/Proxmox_VE_Status/blob/main/passthrough.sh
- Craft Computing’s Proxmox 8.0 - PCIe Passthrough Tutorial video is the best explainer I have seen of this process.
- Proxmox PCI(e) Passthrough documentation
I created the steps manually below from the script source code at https://github.com/KoolCore/Proxmox_VE_Status/blob/main/passthrough.sh.
The Craft Computing video, Proxmox 8.0 - PCIe Passthrough Tutorial, follows these steps almost exactly, with the only difference being the changes to /etc/kernel/cmdline
.
Make IOMMU changes at boot
There are two possible boot systems, Systemd (EFI) or Grub.
The ‘Boot Mode’ in the Proxmox GUI summary page for a node (like
pve
) indicates whether it is EFI (systemd) or Grub booted.
Do
For Grub boot, edit /etc/default/grub
-
Open
/etc/default/grub
nano /etc/default/grub
-
Change this line to:
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt"
-
Save file and close
-
Run:
update-grub
For Systemd (EFI) boot, edit /etc/kernel/cmdline
-
Open
/etc/kernel/cmdline
nano /etc/kernel/cmdline
-
Add this to first line:
intel_iommu=on iommu=pt
All commands in
/etc/kernel/cmdline
must be in a single line on the first line! -
Save file and close
-
Run:
proxmox-boot-tool refresh
Load VFIO modules at boot
-
Open
/etc/modules
nano /etc/modules
- Add these lines:
vfio vfio_iommu_type1 vfio_pci vfio_virqfd
- Save file and close
Configure VFIO for PCIe Passthrough
-
Find your GPU PCI identifier
lspci
It will be something like
00:02
-
Find your GPU’s PCI HEX values
Enter the PCI identifier (
00:02
) from above into thelspci
command:lspci -n -s 00:02 -v
You will see an associated HEX value like
8086:46d0
-
Edit
/etc/modprobe.d/vfio.conf
Copy the HEX values from your GPU into this command and hit enter:
echo "options vfio-pci ids=8086:46d0 disable_vga=1"> /etc/modprobe.d/vfio.conf
-
Apply all changes
update-initramfs -u -k all
Blacklist Proxmox host device drivers
This ensures nothing else on the Proxmox host can use the GPU that you want to pass through to a VM.
-
Edit
/etc/modprobe.d/iommu_unsafe_interrupts.conf
echo "options vfio_iommu_type1 allow_unsafe_interrupts=1" > /etc/modprobe.d/iommu_unsafe_interrupts.conf
-
Edit
/etc/modprobe.d/blacklist.conf
echo "blacklist i915" >> /etc/modprobe.d/blacklist.conf echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf echo "blacklist nvidia" >> /etc/modprobe.d/blacklist.conf
-
Apply all changes
update-initramfs -u -k all
-
Reboot to apply all changes
reboot
Verify all changes on the Proxmox host
-
Verify
vfio-pci
kernel driver being used:lspci -n -s 00:02 -v
In the output, you should see:
Kernel driver in use: vfio-pci
-
Verify IOMMU is enabled:
dmesg | grep -e DMAR -e IOMMU
In the output, you should see:
DMAR: IOMMU enabled
-
Verify IOMMU interrupt remapping is enabled:
dmesg | grep 'remapping'
In the output, you should see something like:
DMAR-IR: Enabled IRQ remapping in x2apic mode
-
Verify that Proxmox recognizes the GPU:
lspci -v | grep -e VGA
In the output, you should see something like:
00:02.0 VGA compatible controller: Intel Corporation Alder Lake-N [UHD Graphics] (prog-if 00 [VGA controller])
-
To get more details about your GPU VGA controller:
lspci -v -s 00:02.0
Next Step: Setup passthrough within a VM
Once we have confirmed GPU passthough works on the Proxmox VE host, we have to enable it within a VM to use it.
- To create a VM, perform the steps in Creating a Ubuntu VM
- After you have a working VM, perform the steps in Proxmox GPU (PCI) Passthrough: VM Setup.