Enable gpu passthru
These steps have been adapted from Jim's Garage's guide and have been expanded with additional context. It is recommended to perform these steps via SSH or the Proxmox web console. Keep in mind, once a GPU is isolated from the host, it will no longer output display from the host.
1. Enable IOMMU in the bios (Intel VT-d & VT-x or AMD-V)
Recommended to Google this as the process and options vary by montherboard and manufactorer.
2. Enable IOMMU in GRUB
ssh
into the Proxmox host-
Edit grub config
-
Update the
GRUB_CMDLINE_LINUX_DEFAULT
variable in the grub config with the appropriate commands below.Intel:
AMD:
-
Save changes and exit editor
- Run
update-grub
-
Verify IOMMU is enabled by running the following command:
You should see a line like this in the output:
If you see a line confirming IOMMU is enabled, you’re good to proceed to step 7.
If nothing prints, try running dmesg by itself and manually searching for "DMAR" or "IOMMU" in the output. If you still don’t see anything, or if instead you see error messages, check out the troubleshoot section below for a possible fix.
Error logs fill up space
The
dmesg
log can grow large over time and may fill up storage on your Proxmox server if not managed. So it's best to make sure any errors are resolved or silenced. -
Reboot the Proxmox host
3. Enable VFIO modules
shh
into the Proxmox host-
Edit the VFIO modules
-
Add the following modules:
-
Save changes and exit editor
- Run
update-initramfs -u -k all
- Reboot the Proxmox host
ssh
into Proxmox host-
Verify the modules are enabled with the following. Check the driver version line is present.
4. Isolate GPU from Host
Updating graphics cards
You'll need to perform the following steps anytime you replace, remove or add GPUs.
ssh
into Proxmox host-
Get the ids of the GPU device(s) and associated hdmi audio device(s)
To get all devices...
To get Nvidia gpu ids...
To get AMD gpu ids...
-
Take note of the device codes for both the VGA compatible controller and Audio device. Device IDs are typically two groups of four alphanumeric characters separated by a colon (i.e.
XXXX:XXXX
). Each GPU usually has two device IDs, one for video and one for audio.Here’s an example of the output for an NVIDIA GPU:
-
Edit the
vfio.conf
to bind devices to the vfio-pci driver: -
Add an
options
line to thevfio.conf
(see examples below), replacing the device IDs with the ones you found in step 3. If you have multiple GPUs (or any PCI devices), list all the device IDs together in a single options line, separated by commas:Example with one GPU:
Example of two GPUs:
-
Save changes and exit editor
5. Blacklist GPU drivers
ssh
into the Proxmox host-
Run the following commands to blacklist gpu drivers
-
Reboot the Proxmox host
Next Steps
Troubleshoot
"AER Correctable error message recieved" when running dmesg
This message is usually related to PCIe Active State Power Management (ASPM). While not the "best" way, you can try disabling ASPM to fix it. To do this, add pcie_aspm=off
to the GRUB_CMDLINE_LINUX_DEFAULT
line in /etc/default/grub
. This is the same file you edited earlier in step 2.
For example, on Intel systems, it might look like this:
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt pcie_aspm=off"
.
After making this change, update grub with sudo update-grub
and reboot your system.
grafts: