How to Enable GPU Passthrough on Proxmox 6.2

Hello everyone, I am currently building my small homelabs system using my old AMD FX-8350 processor. I am running the latest Proxmox 6.2.4 and it works very well. But lately, I want to do something different. Proxmox supports the GPU passthrough which is interesting. We can assign and use the power of our GPU to one of the virtual machine. There are some steps to do the GPU passthrough. It is not super simple but doable. We will get through there in a moment.

This tutorial is based on the AMD processor. There are some pretty basic differences between AMD and Intel processor. You can visit the official guide on Proxmox website. If you are new to Proxmox and GPU passthrough things, it is better to read it first.

Steps to Enable GPU Passthrough on Proxmox 6.2

Step 1. BIOS Settings

It is important to set the BIOS prior to the GPU passthrough. You will need to enable the VT-d, Virtualization as well as UEFI.

Step 2. Enable the IOMMU

This step will enable the IOMMU by editing the Grub. I would recommend you to connect to the server via ssh from other computer.

On the host machine, we are going to edit the grub.

nano /etc/default/grub

Now find the following line

GRUB_CMDLINE_LINUX_DEFAULT="quiet"

And then change the line into this one

GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on"

Close and save the editor and reboot Proxmox server. After reboot, connect via SSH again and run this command to confirm.

dmesg | grep -e DMAR -e IOMMU

You should see something like this:

If it returns nothing, then something is wrong. You need to check your hardware configuration and/or maybe there are some unsupported hardware.

Step 3. Load Additional Kernel Modules

Here we are going to add some modules to our Proxmox server. Add the following lines to /etc/modules

vfio
vfio_pci
vfio_virqfd

Close and save the file. And then reboot the server again.

Step 4. Verify the IOMMU Interrupt Remapping

It is important to make sure that our system supports the Interrupt Remapping. To check, use this command

dmesg | grep 'remapping'

You should see something like this

AMD-Vi means the interrupt remapping is enabled so we are good to go from here. And you can also use this command for more results.

dmesg | grep -e DMAR -e IOMMU 

Step 5. Get GPU id

Now we need to get our GPU id and configure the Proxmox. Execute this command to get the GPU id and the associated vendor id.

lspci -v

Output:

As you can see, my Graphic card id is 01:00. Now lets run another command to get the vendor id

lspci -n -s 01:00

Output:

01:00.0 0300: 1002:67df (rev ef)
01:00.1 0403: 1002:aaf0

Due take a note of the vendor id shown. In this case, 1002:67df and 1002:aaf0

With this vendor id, we need to assign these two values to vfio. Use this command and don’t forget to change the vendor ids with yours.

echo "options vfio-pci ids=1002:67df,1002:aaf0" > /etc/modprobe.d/vfio.conf

Reboot Proxmox VE. So basically, we were done configuring the Proxmox host to provide the GPU passthrough feature. Next, we are going to create a new VM that will be used for Windows 10.

Step 6. Create a New VM

Here we are going to create a new VM. But do not start it because we will add some configuration to this new VM manually.

Create a new VM from the Proxmox web interface. But make sure you choose or use the following settings:

  • BIOS: OMVF (UEFI)
  • Machine: q35

Follow the wizard until it completes and then install Windows 10 completely. Make sure you set the Remote Desktop on the newly installed Windows 10 because after we configure GPU passthrough, you won’t be able to use the console from the Proxmox web dashboard. Once you set up the remote desktop. Shutdown the VM.

Step 7. Additional Configuration for Windows 10 VM

Now lets SSH to the Proxmox server once again and edit the new Windows 10 vm conf. In this example, my new Windows 10 conf file is in /etc/pve/qemu-server/102.conf. Add the following lines to the config file.

cpu: host,hidden=1,flags=+pcid
hostpci0: 01:00,pcie=1,x-vga=on

Here is my full config screenshot

If we switch to the Proxmox web console in the hardware section, it looks like this.

As you can see, there is a PCI Device (hostpci0) at the end of my hardware list.

Now start the Windows 10 VM and remote desktop to it. Check if the Graphic card is detected and active in your Windows 10 VM.

Alternatively, you can also use a monitor connected to your VGA card and use the Windows 10 VM on that monitor. If you do this, you may also want to passthrough the mouse and keyboard as well.

USB keyboard and mouse passthrough

8 Comments

  1. i make installation of Catalina under proxmox like in your dosc
    then i try to passthrough pcie and
    first time boot my display work but after balck screen
    system show rx 480 card but
    monitor is blank

    • Hi,
      I hope you already setup your macos for remote desktop via VNC. So you can change some settings from other pc.
      I have similar problem. MacOS will detect your RX card and the proxmox display as two separate monitor.
      Connect via VNC and set/change the multiple display settings from there.
      Make your external monitor as the main display.

    • Hi, connect to your Mac via VNC and from there you can change the display settings. You may need to enable the mirroring feature from System Preference >> Display

  2. I cant enter with VNC (connection reset by peer) ((((
    Should i keep enabled ROM-BAR option?
    can i enter by ssh and setup via cli?
    if yes please suggest appropriate commands

2 Trackbacks / Pingbacks

  1. Step by Step Creating Windows 10 Virtual Machine on Proxmox with GPU Passthrough | Manjaro dot site
  2. Tips to Create Ubuntu 20.04 VM on Proxmox with GPU Passthrough

Leave a Reply

Your email address will not be published.


*