Tomas' Labroratory

Proxmox ATI GPU Passthrough Guide

After a lot of fiddling around with settings and hardware, I finally have a stable Proxmox 5.1 ATI GPU pass-through system.   What helped me was this helpful article to finally get all the bugs ironed out.   I did have to make several tweaks for my system.   I'm running an Intel system with ATI Radeon GPU.

  1. Ensure VT-d is supported and enabled in the BIOS

  2. Enable IOMMU on the host

    1. append the following to the GRUB_CMDLINE_LINUX_DEFAULT line in /etc/default/grub

      intel_iommu=on
      
    2. Save your changes by running

      update-grub
      
  3. Blacklist NVIDIA & Nouveau kernel modules so they don’t get loaded at boot

    1.  echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf
        echo "blacklist nvidia" >> /etc/modprobe.d/blacklist.conf
        echo "blacklist radeon" >>
        /etc/modprobe.d/blacklist.conf
      
    2. Save your changes by running

      update-initramfs -u
      
  4. Add the following lines to /etc/modules

    vfio
     vfio_iommu_type1
     vfio_pci
     vfio_virqfd
    
  5. Reboot the host

  6. Create your Windows VM using the UEFI bios hardware option (not the deafoult seabios) but do not start it yet.  Use VirtIO.  Modify /etc/pve/qemu-server/.conf and ensure the following are in the file. Create / modify existing entries as necessary.

    bios: ovmf
     machine: q35
     cpu: host,hidden=1
     numa: 1
    
  7. Install Windows

    1. Mount second ISO  (virtio-win*.iso)
    2. Load IO driver from d:\viostore\w10\amd64\viostore.inf
    3. After install be sure to enable Remote desktop.
  8. Pass through the GPU.

    1. Modify /etc/pve/qemu-server/.conf and add hostpci0: ,x-vga=on,pcie=1. Example

      hostpci0: 01:00,x-vga=on,pcie=1
      
  9. Passthrough USB keyboard and mouse

    1. I find it best to passthrough specific USB ports rather than device IDs.  That way I can hotplug different devices to specific ports later without having to reboot.
  10. Done.

Troubleshooting

Blue screening when launching certain applications

AMD drivers setup application and/or Windows boot would consistently blue screen on me with the following error:

kmode_exception_not_handled

The fix as outlined here was to create /etc/modprobe.d/kvm.conf and add the parameter “options kvm ignore_msrs=1”

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

Same fix can be applied at runtime with

echo 1 > /sys/module/kvm/parameters/ignore_msrs

Update 4/9/18: Blue screening happens to Windows 10 1803 as well with the error

System Thread Exception Not Handled

The fix for this is the same – ignore_msrs=1

Frezing keyboard/mouse:

Device Manager -> Human Interface Devices -> Microsoft Hardware USB Keyboard -> Power Management -> Uncheck "Allow the computer to turn off this device to save power"

Notes:

Other guides require setting up vfio.conf.  With my hardware it was not required.  It's probably needed for a nVidia card though.

  1. Determine the PCI address of your GPU

    1. Run

      lspci -v
      

      and look for your card.  Usually 01:00.0 & 01:00.1. You can omit the part after the decimal to include them both in one go – so in that case it would be 01:00

    2. Run lspci -n -s to obtain vendor IDs. Example :

      lspci -n -s 01:00
       01:00.0 0300: 10de:1b81 (rev a1)
       01:00.1 0403: 10de:10f0 (rev a1)
      
  2. Assign your GPU to vfio driver using the IDs obtained above. Example:

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