How to Enable GPU Passthrough in Proxmox
If you’re looking to harness the power of GPU acceleration within your Proxmox Virtual Environment, you’re in luck. Proxmox now offers experimental native PCI passthrough, allowing you to utilize physical PCI devices like graphics cards or network cards inside a virtual machine (VM). This guide will walk you through the process of setting up GPU passthrough in Proxmox for improved performance and functionality.
Supported GPUs
The GPU passthrough feature in Proxmox has been reported to work with a variety of GPUs, including:
- AMD Radeon 5xxx, 6xxx, 7xxx series
- NVIDIA GeForce 7, 8, GTX 4xx, 5xx, 6xx, 7xx, 9xx, 10xx, and RTX 16xx/20xx series
Please note that these lists are not exhaustive, and the compatibility may evolve over time.
Getting Started
Before diving into the GPU passthrough setup process, make sure you have SSH access to your Proxmox server.
Editing GRUB
- Access your Proxmox server over SSH.
- Open the GRUB configuration file using the command:
sudo vi /etc/default/grub
. - Locate the line similar to:
GRUB_CMDLINE_LINUX_DEFAULT
. - Depending on your CPU vendor, modify the line as follows:
- For Intel CPUs:
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"
- For AMD CPUs:
GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on"
- Save the changes and update GRUB using:
sudo update-grub
.
After a reboot, you can verify the changes by running: dmesg | grep -e DMAR -e IOMMU
.
Adding VFIO Modules
- Edit the
/etc/modules
file:sudo vi /etc/modules
. - Add the following lines to the file:
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
- Save the file.
Checking Interrupt Remapping
To ensure your system supports interrupt remapping, run: dmesg | grep 'remapping'
.
If you see messages like:
- “AMD-Vi: Interrupt remapping enabled”
- “DMAR-IR: Enabled IRQ remapping in x2apic mode”
It indicates that interrupt remapping is supported. If not, you can enable interrupts using the provided commands.
Blacklisting Host Drivers
To avoid issues with host driver conflicts, you need to blacklist certain drivers. Run the following commands:
echo "blacklist radeon" | sudo tee -a /etc/modprobe.d/blacklist.conf
echo "blacklist nouveau" | sudo tee -a /etc/modprobe.d/blacklist.conf
echo "blacklist nvidia" | sudo tee -a /etc/modprobe.d/blacklist.conf
Identifying GPU Details
Use the command lspci -v
to find your video card details. Look for keywords like NVIDIA, VGA, RADEON, etc. Make a note of the vendor ID and Device ID.
Configuring VFIO
- Run:
lspci -n -s 01:00
(replace “01:00” with your GPU’s address). - Note the vendor and Device IDs (e.g., “10de:1381” and “10de:0fbc”).
- Create a VFIO configuration file:
echo "options vfio-pci ids=10de:1381,10de:0fbc" | sudo tee /etc/modprobe.d/vfio.conf
.
Rebooting and Verifying
- Recreate initrd with:
sudo update-initramfs -u
. - Reboot the server.
- GPU passthrough should now be active.
Conclusion
Enabling GPU passthrough in Proxmox can greatly enhance the performance and capabilities of your virtual machines, particularly when it comes to graphics-intensive tasks. By following the steps outlined in this guide, you can tap into the power of your GPU within virtualized environments, opening up new possibilities for your projects and workloads. Remember that the GPU compatibility list may evolve, so it’s always a good idea to stay up to date with Proxmox developments and GPU compatibility updates.