DO NOT TEST THIS IN PRODUCTION
I did a Proof-of-Concept to improve the iGPU passthrough situation in the case where the vbios is not in the ROM BAR. This would usually fail in the guest because the guest amdgpu or i915driver would not be able to find the vbios.
I would like to share this PoC with you to gather feedback / testing.
This is not at all a production ready solution, as you will see with the manual steps which are needed to test this.
Who should test this?
If you have an host with an iGPU, and the usual 8.3 PCI passthrough procedure described at https://docs.xcp-ng.org/compute/#pci-passthrough does not work because the guest dmesg prints something like
Invalid PCI ROM header signature: expecting 0xaa55, got 0x4556
or
Failed to find VBIOS tables (VBT)
or
Unable to locate a BIOS ROM
What has been tested so far
I only tested on an AMD Ryzen Embedded V2748 with Radeon Graphics embedded APU system with a Radeon RX Vega series integrated GPU (PCI vendor id 1002 PCI device id 1636). With this config, I tested that the guest VM was able to correctly probe the GPU with the amgdpu driver.
How to test
- Install a brand new XCP-ng 8.3 on a test host (or make sure you are up to date with latest 8.3 packages on your test host)
- Configure XCP-ng user repositories:
wget https://koji.xcp-ng.org/repos/user/8/8.3/xcpng-users.repo -O /etc/yum.repos.d/xcpng-users.repo
- Update your system with the iGPU PoC packages
yum update --enablerepo=xcp-ng-ysionneau1
- it will prompt you about importing a new GPG key
- it should install the following packages:
=============================================================================================================================================================================================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================================================================================================================================================================================
Updating:
edk2 x86_64 20220801-1.7.11.3~romtest.2.xcpng8.3 xcp-ng-ysionneau1 3.0 M
forkexecd x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 2.5 M
message-switch x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 4.6 M
qcow-stream-tool x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 1.4 M
qemu x86_64 2:4.2.1-5.2.18.1.0.fixrom.1.xcpng8.3 xcp-ng-ysionneau1 16 M
rrdd-plugins x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 9.9 M
sm-cli x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 4.9 M
squeezed x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 1.9 M
varstored-guard x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 5.0 M
vhd-tool x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 5.0 M
wsproxy x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 1.1 M
xapi-core x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 30 M
xapi-nbd x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 3.1 M
xapi-rrd2csv x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 3.0 M
xapi-storage-script x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 2.5 M
xapi-tests x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 5.0 M
xapi-xe x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 1.5 M
xcp-networkd x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 4.9 M
xcp-rrdd x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 3.6 M
xenopsd x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 1.4 M
xenopsd-cli x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 2.0 M
xenopsd-xc x86_64 26.1.19-1.2.0.romtest.1.xcpng8.3 xcp-ng-ysionneau1 5.3 M
Transaction Summary
=============================================================================================================================================================================================================================================================================================================================
Upgrade 22 Packages
- Then you will have to manually dump your iGPU VBIOS to precisely this path:
/root/vbios.bin
- for AMD modern iGPU it should be located in an ACPI table called
VFCT, you could first call acpidump -b then use this """one liner"""
python3 -c 'import struct,sys;d=open(sys.argv[1],"rb").read();assert d[:4]==b"VFCT",d[:4];n=struct.unpack("<I",d[4:8])[0];off=struct.unpack("<I",d[0x34:0x38])[0];i=0
while off and off+28<=n:
pcibus,pcidev,pcifunc,vendor,device,ssvid,ssid,rev,imagelen=struct.unpack("<IIIHHHHII",d[off:off+28])
if imagelen==0 or off+28+imagelen>n:break
fn="vbios_%02d_%04x_%04x.bin"%(i,vendor,device);open(fn,"wb").write(d[off+28:off+28+imagelen]);print(fn,"bus=%d dev=%d func=%d vid=%04x did=%04x len=%d"%(pcibus,pcidev,pcifunc,vendor,device,imagelen));off+=28+imagelen;i+=1' vfct.dat
- Reboot the host
- Follow the usual PCI Passthrough procedure to pass-through the iGPU PCI device to a Linux VM (a Debian 13 for instance): https://docs.xcp-ng.org/compute/#pci-passthrough
- Make sure you have the corresponding gpu firmware Debian package installed in your VM:
firmware-amd-graphics or firmware-intel-graphics
- Start the VM
- Check in the
dmesg if the GPU is correctly detected and probed by the driver (amdgpu for AMD for instance)
What to report
Report as replies to this thread, putting text files as attached-files
- If it worked or not
- the
dmesg of the Linux VM
- the
xl dmesg of the host (dom0)
- the output of
grep xen-pci-passthrough /var/log/xensource.log*
- the
lspci -n -vvv -s SBDF (replace SBDF with the domain:bus:device.function) or your GPU, both in the host (dom0) and in the VM (beware the SBDF will be different!)
hexdump -C /boot/vbios.bin | head -n100 on the host (dom0)
Thank you for your help! 