ProxMox – GPU Passthrough – Seabios PCI EXPRESS

ProxMox – GPU Passthrough – Seabios PCI EXPRESS

Source:

1. You must know what you want to do!


Read line by line: pve.proxmox.com





2. Check what configuration is the best for you


Checking if card is UEFI (ovmf) or BIOS (Seabios) compatible:


A. Plugin your GPU thich you want passthrough and turn on the hypervisor
I have two GPU, the one I want passthrough is in the second PCI Express



B. Get and compile the software „rom-parser”

git clone https://github.com/awilliam/rom-parser
cd rom-parser
make


C. Find your GPU
Fast and no info:

lspci | grep -i --color 'vga\|3d\|2d'

Find yourself and all info:

lspci -v

Example output:

lspci | grep -i --color 'vga\|3d\|2d'
03:00.0 VGA compatible controller: NVIDIA Corporation G98 [Quadro NVS 295] (rev a1)
04:00.0 VGA compatible controller: NVIDIA Corporation GT218 [GeForce 210] (rev a2)
GPU for passthrough is GeForce 210 and have ID 04:00.0



D. Then dump the rom of you GPU

cd /sys/bus/pci/devices/0000:04:00.0/
echo 1 > rom
cat rom > /tmp/image.rom
echo 0 > rom

and test it with

./rom-parser /tmp/image.rom

Valid ROM signature found @0h, PCIR offset 190h
 PCIR: type 0, vendor: 10de, device: 1280, class: 030000
 PCIR: revision 0, vendor revision: 1
Valid ROM signature found @f400h, PCIR offset 1ch
 PCIR: type 3, vendor: 10de, device: 1280, class: 030000
 PCIR: revision 3, vendor revision: 0
  EFI: Signature Valid
 Last image

To be UEFI compatible, you need a „type 3” in the result.

If you have „type 3” go to blog.quindorian.org. This tutorial is for only „type 0”. This mean that i use BIOS (Seabios), no UEFI (ovmf).





3. The real GPU Passthrough – Seabios PCI EXPRESS


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



B. Enable IOMMU on the host

I have Intel Xeon E5-1620. Edit /etc/default/grub file and replace

GRUB_CMDLINE_LINUX_DEFAULT="quiet"

to

GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on video=efifb:off"

Save your changes by running

update-grub


C. Blacklist kernel modules so they don’t get loaded at boot
In all tutorials which I found, always the NVIDIA and Nouveau modules is turn off. I have two NVIDIA GPU and I had lot of problems with first GPU. From „no refresh screen” to „stopping the hypervisor „. I dont turn off this modules and this work for me.



D. Required modules
add to /etc/modules

vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd


E. Assign your GPU to vfio driver

Example output:

lspci | grep -i --color 'vga\|3d\|2d'
03:00.0 VGA compatible controller: NVIDIA Corporation G98 [Quadro NVS 295] (rev a1)
04:00.0 VGA compatible controller: NVIDIA Corporation GT218 [GeForce 210] (rev a2)
GPU for passthrough is GeForce 210 and have ID 04:00.0


Run lspci -n -s <PCI address> to obtain vendor ID:

lspci -n -s 04:00
04:00.0 0300: 10de:0a65 (rev a2)
04:00.1 0403: 10de:0be3 (rev a1)

Assign your GPU to vfio driver using the IDs obtained above:

echo "options vfio-pci ids=10de:0a65,10de:0be3" > /etc/modprobe.d/vfio.conf


F. Reboot the host(hypervisor)



G. Create Windows VM
Create your Windows VM using the default seabios bios but do not start it yet. Modify /etc/pve/qemu-server/<vmid>.conf and ensure the file looks like:

agent: 1
bootdisk: ide0
cores: 2
ide0: local-zfs:vm-101-disk-0,size=100G
machine: q35
memory: 4096
name: vm-w-desktop-1
net0: e1000=4A:70:AE:3A:7D:71,bridge=vmbr0
numa: 0
scsihw: virtio-scsi-pci
smbios1: uuid=82b1f20f-b5bd-462a-8026-c342b1c37449
sockets: 2
vmgenid: 01cfb0fc-595e-4167-82a3-68a9a26a977a

This is normal configuration with „machine: q35”


Once installing and updating Windows there is one thing you need to make sure of, that you can remotely login to the VM. The reason why is because if you boot the VM with GPU Passhtrough, it disables to standard VGA adapter after which the built-in VNC/Spice from Proxmox will no longer work.

This means you need to enable RDP and set a static IP or install any other form of remote control (VNC, Teamviewer, etc.).



H.Passthrough the GPU
add to /etc/pve/qemu-server/<vmid>.conf

hostpci0: 04:00,x-vga=1,pcie=1



Save the file and see if the VM starts. If it does, great, you are probably done! Windows should see the GPU and start installing a driver from Windows Update. Let it do that for a few minutes and if you want you can then replace the driver with a freshly downloaded one.
I use NVIDIA 335.23 drivers.





One Response so far.

  1. Hello just wanted to give you a quick heads up. The text in your
    post seem to be running off the screen in Internet explorer.
    I’m not sure if this is a format issue or
    something to do with internet browser compatibility but I thought I’d post to let you know.

    The style and design look great though! Hope you get the
    issue fixed soon. Cheers

Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są oznaczone *

This site uses Akismet to reduce spam. Learn how your comment data is processed.