Skip to content

Instantly share code, notes, and snippets.

@c4software
Forked from SimonTod/proxmox-gpu-passthrough.md
Last active June 12, 2024 17:17
Show Gist options
  • Save c4software/c824f11ac55ebe8cf01df040a4cb58b2 to your computer and use it in GitHub Desktop.
Save c4software/c824f11ac55ebe8cf01df040a4cb58b2 to your computer and use it in GitHub Desktop.

Proxmox GPU Passthrough

Config :

  • Motherboard : Asrock x300
  • CPU : AMD Ryzen 5 PRO 4650G with Radeon Graphics
  • GPU : AMD Ryzen 5 PRO 4650G with Radeon Graphics
  • Ram : DDR4 2133 MHz

Setting it all up

Update packages

apt update
apt ugrade

Change boot parameters Inside of /etc/default/grub change the following line to include:

GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on iommu=pt pcie_acs_override=downstream,multifunction nofb nomodeset video=vesafb:off,efifb:off"

update grub then reboot

update-grub
reboot

check IOMMU is enabled

dmesg | grep -e DMAR -e IOMMU

blacklist drivers from loading

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

enable modules

echo vfio >> /etc/modules
echo vfio_iommu_type1 >> /etc/modules
echo vfio_pci >> /etc/modules
echo vfio_virqfd >> /etc/modules

enable configuration

update-initramfs -u

find GPU PCI's IDs

lspci -v

find vendor's ID

lspci -n -s 04:00

configure module

echo "options vfio-pci ids=1002:1636 disable_vga=1" > /etc/modprobe.d/vfio.conf

reboot

reboot

Create a new virtual machine inside of Proxmox. During the wizard make sure to select these things:

  • Create the VM using “SCSI” as the Hard Disk controller
  • Under CPU select type “Host”
  • Under Netwerk select Model “VirtIO”

After the wizard completes, we need to change a few things:

  • Next to linking the default DVD-ROM drive to a Windows 10 ISO (if you are passing through to windows), create a second DVD-ROM drive and link the VFIO driver ISO , you will need it while installing windows. Make sure the second DVD-ROM drive is assigned IDE 0
  • Under Options, change the BIOS to “OVMF (UEFI)”
  • Then under Hardware click Add and select “EFI Disk”
echo machine: q35 >> /etc/pve/qemu-server/110.conf

Now return to the web GUI and install Windows as normal. Because of the Hard Disk controller selected it won’t find a drive to install to during the install wizard but just select the ISO we linked to the second DVD-ROM drive and select the “vioscsi” directory.

Make sure you can remote control

GPU passthrough

X300 - Renoir Vbios Download Link

scp RenoirVBIOS.rom your-host:/usr/share/kvm/vbios-renoir.bin
echo "hostpci0: 0000:04:00.0,romfile=vbios-renoir.bin" >> /etc/pve/qemu-server/110.conf

Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment