Description:
This patch adds support for GPU Passthrough of dedicated AMD GPUs. No integrated or second dedicated GPU is neccessary to use GPU Passthrough. If no second GPU is installed, FreeBSD will run headless after booting your VM.
It's based on some other reviews:
To simplify testing, this patch includes all changes. I'm going to rebase this patch as soon as other reviews are merged.
Prerequisites:
- CPU with VT-d or AMD-Vi
Tested Scenarios:
Hardware | OS | |
Intel Xeon D-1527 + AMD E8860 | Windows 10 | Working |
Intel Xeon D-1527 + AMD E8860 | Ubuntu 20.04 | Working |
For Windows it's only neccessary to use another BAR-emulation for passthru devices.
Linux GPU driver is searching for a VBIOS which is currently missing. This patch tries to extract VBIOS and passthrough it as PCI ROM to a guest.
How to use GPU Passthrough:
- Use newest UEFI with enabled bus enumeration:
- get latest edk2 sources
- portsnap fetch extract
- cd /usr/ports/sysutils/uefi-edk2-bhyve
- make extract
- modify OvmfPkg/Bhyve/BhyveX64.dsc:
- set gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration to FALSE:
gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE
- set gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration to FALSE:
- rebuild and install new UEFI
- cd /usr/ports/sysutils/uefi-edk2-bhyve
- make reinstall
- get latest edk2 sources
- Just add your GPU to bhyve like any other pci passthru device:
- assign ppt driver to your gpu
- add your gpu as passthru device to your bhyve config (e.g.: -s 2,passthru,3/0/0)
- To use a custom Video-BIOS add the path to the romfile:
- -s 2,passthru,3/0/0,rom=<path/to/romfile>