We will cover how to enable Proxmox GPU passthrough to a virtual machine in VE. As part of our Server Management Services, Bobcares offers solutions to every query that comes our way.

 

Configuring Proxmox GPU passthrough

 

GPU passthrough is a technology that permits the Linux kernel to present the internal PCI GPU directly to the virtual machine(VM). The device behaves as powered directly by the virtual machine, and the virtual machine detects the PCI device as if it were physically connected.

Proxmox GPU passthrough

Step 1: Configuring the Grub

 

You can SSH directly into your Proxmox server, or utilize the noVNC Shell terminal under “Node” and open up the /etc/default/grub file using nano or any preferable text editor.

 

nano /etc/default/grub

 

Once you access the file search for the below command line :

GRUB_CMDLINE_LINUX_DEFAULT="quiet"

 

Then change it to look like this:

For Intel CPUs:
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"

 

For AMD CPUs:
GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on"

 

Once you are done editing /etc/default/grub run this command:

update-grub

 

Step 2: VFIO Modules

 

Next, you need to add a few VFIO modules to your Proxmox system, for that edit the file /etc/modules

nano /etc/modules

 

Add the following code to the /etc/modules file, then save and exit:

vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd

 

Step 3: IOMMU interrupt remapping

 

Run the following commands in your Shell:

echo "options vfio_iommu_type1 allow_unsafe_interrupts=1" > /etc/modprobe.d/iommu_unsafe_interrupts.conf
echo "options kvm ignore_msrs=1" > /etc/modprobe.d/kvm.conf

 

Step 4: Blacklisting Drivers

 

Here we need to blacklist the drivers so that the Proxmox host system does not utilize our GPU(s), so run the below commands in your Shell:

echo "blacklist radeon" >> /etc/modprobe.d/blacklist.conf
echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf
echo "blacklist nvidia" >> /etc/modprobe.d/blacklist.conf

 

Step 5: Adding GPU to VFIO

 

Run the command:

lspci -v

Check for the lines that show your video card. It'll look similAR like this:

 

01:00.0 VGA compatible controller: NVIDIA Corporation GP104 [GeForce GTX 1070] (rev a1) (prog-if 00 [VGA controller])

01:00.1 Audio device: NVIDIA Corporation GP104 High Definition Audio Controller (rev a1)

 

Make note of the first set of values i.e “01:00.0 and 01:00.1, you will need that for next step.

Run the below command and replace 01:00 with the received value that you got next to your GPU when you ran the previous command:

 

lspci -n -s 01:00


Executing this command will output your GPU card’s Vendor IDs. Usually, one ID for the GPU and one more ID for the Audio bus. will show similar like this:

01:00.0 0000: 10de:1b81 (rev a1)

01:00.1 0000: 10de:10f0 (rev a1

 

We want to keep vendor id codes: 10de:1b81 and 10de:10f0.

 

Now, we will add GPU vendor ID to the VFIO:

 

echo "options vfio-pci ids=10de:1b81,10de:10f0 disable_vga=1"> /etc/modprobe.d/vfio.conf

 

Finally, update and restart by running the below command:

update-initramfs -u

To restart:

reset
 

Now your Proxmox host is successfully ready to pass through GPUs!

 

[Looking for a solution to another query? We are just a click away.]

 

Conclusion

To sum up, this guide is aimed at virtualization, particularly for Proxmox users. It is intended as an overall guide for passing through a GPU or multiple GPUs to Virtual Machine Proxmox GPU passthrough.

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED