How to Enable PCI-e Passthrough on Proxmox 7.1

close up photo of mining rig
Photo by panumas nikhomkhai on Pexels.com

The most recent version of Proxmox 7.1 is now available when this article is written. There are many improvements that have been added to this release. In this article, we will learn how to enable PCI Passthrough on Proxmox 7.1. PCI Passthrough is a cool feature that will improve the performance of the Proxmox virtual machines. This feature will enable the VM or guest machine to have direct access to various devices connected to the host such as CPU and GPU’s.

Before we can use all those great features, we need to enable the PCI Passthrough on Proxmox 7.1. Make sure your hardware meets the requirements. For the processor, the modern AMD FX series and newer already support this feature. If you are using Intel, I would recommend using the Intel Haswell or newer. Also, it is better to make sure that the motherboard supports UEFI. There are some issues with the legacy BIOS, so better avoid them.

Enable PCI-e Passthrough on AMD Processor

Connect to the Proxmox server and then let’s have some fun. We need to enable the IOMMU.

nano /etc/default/grub

Find the following line:

GRUB_CMDLINE_LINUX_DEFAULT

Change the line into this

GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on"

Close and save. Then, update-grub.

update-grub

Reboot the Proxmox server. After reboot, confirm with this command to see if the IOMMU is enabled.

dmesg | grep -e DMAR -e IOMMU

You should see the following output

DMAR: IOMMU enabled

Now add the following modules to the /etc/modules

vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd

If you are using an additional graphics card, you will need to blacklist the device so it will not be used by the Proxmox because we will use the graphics card for the Proxmox virtual machine.

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

And then add the following line

Close and save the file. Now execute this command

update-initramfs -u
reboot

Done. At this point, we have successfully enabled the PCI-e passthrough on AMD system.

Enable PCI-e Passthrough on Intel Processor

Similar to AMD, in order to enable the PCI-e Passthrough on Intel processor, edit the grub file.

nano /etc/default/grub

And then, find the following line

GRUB_CMDLINE_LINUX_DEFAULT

Change it to

GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"

Now update grub

update-grub

Reboot and check if the IOMMU is enabled

dmesg | grep -e DMAR -e IOMMU

You should see the following line output

DMAR: IOMMU enabled

Now edit the vfio.conf file

nano /etc/modules

Add the following lines

vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd

And then execute these commands

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

Finally, update initramfs and reboot

update-initramfs -u
reboot

Done. At this point, we have successfully enabled the PCI-e passthrough on Proxmox. Stay tuned to this blog to get more information about how to use GPU passthrough on Proxmox.

Be the first to comment

Leave a Reply

Your email address will not be published.


*