Skip to content

Instantly share code, notes, and snippets.

@matt22207
Last active April 26, 2024 18:36
Show Gist options
  • Star 39 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save matt22207/bb1ba1811a08a715e32f106450b0418a to your computer and use it in GitHub Desktop.
Save matt22207/bb1ba1811a08a715e32f106450b0418a to your computer and use it in GitHub Desktop.
Proxmox 5700G APU GPU Passthrough Notes

Some random notes on trying (and failing) to get Proxmox as host with 5700G APU GPU PCI Passthrough to Ubuntu guest VM working:

References:

Made some progress, but i am thinking this may not possible (for now without more support from AMD?) due to the shared memory of the GPU and system. Various AMD features (like PSP and TMZ) are meant for security and ensuring the programs/cpu can't read your GPU memory. I am totally unknowledgeable here, so I am speculating based off various threads. I suspect the stability issues various people mentioned may be due to issues with reserving memory for the GPU. Not sure, but it seems the memory sharing happens inside the VM at the driver level (rather than on the host at a higher level of hardware), as when i give the VM 10GB, i can see the amdgpu driver grabs 2GB and only 8GB are left to the OS on the host. So maybe this is all self-contained cleanly in the VM, and not really an issue. Not sure.

Anyway, I'm trying Proxmox and I was able to get an external display working (only on first boot??) inside an Ubuntu guest VM, and it seems like various 3d apps run at high fps (vkcube, glxgears) although i haven't installed any games yet to test, and not sure if this is really running on the GPU or CPU since the grpahic driver is shown as llvmpipe. Additionally, the amdgpu driver is still not loading and is giving some errors even though the monitor and those 3d apps work. Also, no audio yet either :( .

In case it helps others solve this, here's some things i've learned:

  • On the Host, modify /etc/default/grub and then run update-grub :
GRUB_DEFAULT=0
GRUB_TIMEOUT=0
GRUB_CMDLINE_LINUX_DEFAULT="amd_iommu=on iommu=pt video=efifb:off pcie_acs_override=downstream,multifunction amdgpu.exp_hw_support=1 modprobe.blacklist=amdgpu,snd_hda_intel,ccp textonly loglevel=0 silent text nomodeset"
GRUB_TERMINAL=serial
#GRUB_TERMINAL_OUTPUT -- comment this out along with GRUB_TERMINAL_INPUT if included, since GRUB_TERMINAL overrides
GRUB_FORCE_HIDDEN_MENU="true"
  • Not sure if all of these kernel params are needed, and some may be excessive, but most of this is random guesses trying to get the host not to touch any sort of display during boot, etc. Also, the pcie_acs_override is to split the PCI IOMMU groups since by default the GPU group included USB devices that i did not want to pass through. I am not sure if this is a problem, and possibly the full original group (including USB needs to be passed through.

  • On the host, blacklist these via /etc/modprobe.d/blacklist.conf (or similar) to avoid having your host initialize the AMD GPU and related devices (snd_hda_intel for audio and ccp for PSP security device i think) :

echo "blacklist amdgpu" >> /etc/modprobe.d/pve-blacklist.conf
echo "blacklist snd_hda_intel" >> /etc/modprobe.d/pve-blacklist.conf
echo "blacklist ccp" >> /etc/modprobe.d/pve-blacklist.conf
  • reboot

  • ensure these weren't activated by checking the boot logs such as sudo dmesg | grep amdgpu

    • note, ccp still gets loaded by kvm_amd no matter what i tried. not sure if this is a blocker
  • Confirm your IOMMU groups are split if needed so you can pass in the GPU+audio on its own by looking for different groups via this script: https://gist.github.com/flungo/428c374c040de1d0a30fd4a593d39040

  • Install/Setup your VM using q35 and OVMF (UEFI) without setting up PCI passthrough yet .. for me in ProxMox, this is just for initial setup in the noVNC console as hardware display may not work yet.. I had to switch to SeaBIOS after setup was complete to get the physical display output working. I would hope/assume we could get UEFI working, but it didn't see to work for me at all with this vbios.

  • After you have a working VM, install a backup way to get in such as regular VNC or openssh-server, then shut it down, and switch the VM to SeaBIOS .. i left the UEFI disk in place so i could switch back and forth as needed.

  • To add the PCI Passthrough you'll need to and get a vbios rom:

  • I found a copy of the 5700G VBIOS from a similar machine here: https://rog.asus.com/us/desktops/mid-tower/rog-strix-g10dk-series/helpdesk_bios ..

  • Extract using VBiosFinder : https://github.com/coderobe/VBiosFinder

    • Install all the dependencies. Especially UEFIExtract [ binaries ] and rom-parser
  • This will output a few rom's, and vbios_1002_1638_1.rom seemed to work the best for me. (Sorry, not sure of the legality of posting the actual rom file)

  • Copy this rom onto your Host in the appropriate dir. For me on proxmox, this was in /usr/share/kvm

  • Get your PCI id's via lspci on the host, which for me are:

05:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [1002:1638] (rev c8)
05:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Device [1002:1637]
05:00.2 Encryption controller [1080]: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) Platform Security Processor [1022:15df]
05:00.3 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Renoir USB 3.1 [1022:1639]
05:00.4 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Renoir USB 3.1 [1022:1639]
05:00.5 Multimedia controller [0480]: Advanced Micro Devices, Inc. [AMD] Raven/Raven2/FireFlight/Renoir Audio Processor [1022:15e2] (rev 01)
05:00.6 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) HD Audio Controller [1022:15e3]
  • I think I only want #0 and #1 and #2 to passthrough (although again, i wonder if the others are required). Not sure about the #2 PSP (especially since i'm disabling PSP later) and 5/6 audio if they are duplicate of #1 audio. I did confirm that including the USB controllers will crash the host system, so if this is even possible you'd need the pcie_acs_override in grub to exclude those into different IOMMU groups. In your host's terminal, add your PCI id's to /etc/pve/qemu-server/100.conf (assuming this is your first VM #100) since you can't add the romfile setting via the proxmox web screens:
hostpci0: 0000:05:00.0;0000:05:00.1;0000:05:00.2,pcie=1,x-vga=1,romfile=vbios_1002_1638_1.rom
  • Note that x-vga=1 will force this to be the primary display, and proxmox's built in "noVNC" viewer will stop working.

    • Ensure you have another way to get in to your VM before this, such as passing through a usb keyboard/mouse, or openssh-server, regular VNC, etc.
  • Start your guest VM and you may get video output on your external display (i'm using the HDMI output), and various errors in the guest's dmesg if you grep for amdgpu ..

  • To fix error complaining about PSP unable to load rom.. Inside the Guest (NOT THE HOST!!!) , add these kernel boot params (for me via /etc/default/grub and then update-grub) : amgdpu.fw_load_type=0

    • This disables PSP which was failing to read the vbios rom, not sure if this has other side effects or removes needed functionality, but it gets some of the errors to go away.
GRUB_CMDLINE_LINUX_DEFAULT="amdgpu.fw_load_type=0"
  • Also, I played with disabling TMZ in the Guest's /etc/default/grub kernel params via amdgpu.tmz=0 .. not sure this did anything, so i left it out

  • reboot the guest and you should get rid of many errors. I am left with:

[    0.000000] Linux version 5.13.0-27-generic (buildd@lcy02-amd64-014) (gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0, GNU ld (GNU Binutils for Ubuntu) 2.37) #29-Ubuntu SMP Wed Jan 12 17:36:47 UTC 2022 (Ubuntu 5.13.0-27.29-generic 5.13.19)
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.13.0-27-generic root=/dev/mapper/vgubuntu-root ro amdgpu.fw_load_type=0 amdgpu.dc=1 radeon.cik_support=0 amdgpu.cik_support=1
[    0.017576] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.13.0-27-generic root=/dev/mapper/vgubuntu-root ro amdgpu.fw_load_type=0 amdgpu.dc=1 radeon.cik_support=0 amdgpu.cik_support=1
[   11.189820] [drm] amdgpu kernel modesetting enabled.
[   11.189897] amdgpu: CRAT table not found
[   11.189899] amdgpu: Virtual CRAT table created for CPU
[   11.189906] amdgpu: Topology: Add CPU node
[   11.189947] fb0: switching to amdgpudrmfb from VESA VGA
[   11.190056] amdgpu 0000:01:00.0: vgaarb: deactivate vga console
[   11.190329] amdgpu 0000:01:00.0: amdgpu: Trusted Memory Zone (TMZ) feature enabled
[   11.197046] amdgpu 0000:01:00.0: amdgpu: Fetched VBIOS from ROM BAR
[   11.197048] amdgpu: ATOM BIOS: 113-CEZANNE-017
[   11.229736] amdgpu 0000:01:00.0: amdgpu: VRAM: 2048M 0x000000F400000000 - 0x000000F47FFFFFFF (2048M used)
[   11.229738] amdgpu 0000:01:00.0: amdgpu: GART: 1024M 0x0000000000000000 - 0x000000003FFFFFFF
[   11.229739] amdgpu 0000:01:00.0: amdgpu: AGP: 267419648M 0x000000F800000000 - 0x0000FFFFFFFFFFFF
[   11.229791] [drm] amdgpu: 2048M of VRAM memory ready
[   11.229793] [drm] amdgpu: 3072M of GTT memory ready.
[   12.708341] amdgpu 0000:01:00.0: amdgpu: SMU is initialized successfully!
[   12.872471] amdgpu 0000:01:00.0: [drm:amdgpu_ring_test_helper [amdgpu]] *ERROR* ring kiq_2.1.0 test failed (-110)
[   12.872675] [drm:amdgpu_gfx_enable_kcq.cold [amdgpu]] *ERROR* KCQ enable failed
[   12.872825] [drm:amdgpu_device_ip_init [amdgpu]] *ERROR* hw_init of IP block <gfx_v9_0> failed -110
[   12.872939] amdgpu 0000:01:00.0: amdgpu: amdgpu_device_ip_init failed
[   12.872942] amdgpu 0000:01:00.0: amdgpu: Fatal error during GPU init
[   12.872993] amdgpu 0000:01:00.0: amdgpu: amdgpu: finishing device.

open issues:

  • amdgpu driver on guest still doesn't load as shown above
  • audio doesn't work, likely same issue
  • general stability. haven't tracked this thoroughly, but maybe only the first boot of the VM works.. after that, subsequent boots of the VM can freeze, and even once my proxmox host froze. again, i think the shared memory allocation may be a problem, but no clue.
  • On host. i think the USB controllers in the original IOMMU group really are tied to the APU, and there is an error trying to reset the extra audio devices after the VM shuts down. I had to remove these devices from the pci passthrough to get rid of this error.
Jan 23 17:54:55 minispve kernel: usb 1-2: reset low-speed USB device number 2 using xhci_hcd
Jan 23 17:59:30 minispve QEMU[7222]: kvm: vfio: Cannot reset device 0000:05:00.6, depends on group 17 which is not owned.
Jan 23 17:59:30 minispve QEMU[7222]: kvm: vfio: Cannot reset device 0000:05:00.5, depends on group 17 which is not owned.
  • I want to try a Windows10 VM as well to see if there's any difference
@elboogero
Copy link

damn. i've been trying without success also. thanks for taking time in logging your endevour so well and sharing!

@elboogero
Copy link

meanwhile i use the generic virtioGPU driver, and it works fairly well on windows. : |

@hqshi
Copy link

hqshi commented Apr 28, 2022

meanwhile i use the generic virtioGPU driver, and it works fairly well on windows. : |

so can virtioGPU driver support directX? i need playing some game in guest windows OS :>

@elboogero
Copy link

elboogero commented Apr 28, 2022 via email

@matt22207
Copy link
Author

meanwhile i use the generic virtioGPU driver, and it works fairly well on windows. : |

so can virtioGPU driver support directX? i need playing some game in guest windows OS :>

I am not an expert, but I've never been able to get stable AAA-gaming level performance out of anything except pure GPU Passthrough. These days, if you have a good enough computer you can definitely get decent enough performance out of virtioGPU (or similar "GPU Acceleration" in things like VMWare) for daily desktop activities. VMWare does a pretty good job of non-passthrough performance, and even running 3dmark shows good FPS, but the experience was still choppy in a few areas. Note, VMWare only supports up to DirectX11.. Some lower-end games might run acceptably.

Check out this VMWare guide from TechHut: https://www.youtube.com/watch?v=SDrbNgM6gXk .. I think he runs 1080p, and I was never able to reproduce his claims of performance, especially at 4k/60. Good guide anyway.

@Sebls135
Copy link

Sebls135 commented Jun 8, 2022

Thank you for your explication. But I have some errors (no candidates found :( ) with VBiosFinder to extract vbios_1002_1638_1.rom.
Do you have a solution? Thank you

@Naunter
Copy link

Naunter commented Aug 30, 2022

Finally I made it works! 5700G iGPU passthrough on PVE 7 is possible! Thanks for your collections and advice!

My motherboard is "B550 Phantom Gaming-ITX/ax". The PVE version is 7.2.

Few important points:

  • Motherboard set to CSM
  • Using correct vBIOS
  • Machine: Q35
  • BIOS: SeaBIOS

But there are still a issue is the AMD GPU passthrough reset bug. Every time you shut the VM off, you need to reboot the whole PVE machine to reset the GPU. Can't find a solution.

And I also made a video to show how to do 5700G iGPU passthrough on PVE 7.
The video is in Chinese, but I have marked some key points in English as much as possible.

Here is the full video: https://www.bilibili.com/video/BV11d4y1G7Nk

And the final demo is at 29:33: https://www.bilibili.com/video/BV11d4y1G7Nk?share_source=copy_web&vd_source=37c57e6564de58a018f5b76ac5bfd5e2&t=1773

untitled-f014913

@andywoooo
Copy link

AMD GPU passthrough reset bug
About AMD Ryzen 7 Renoir GPU passthrough reset bug
gnif/vendor-reset#63

@zncs520
Copy link

zncs520 commented Feb 3, 2023

The video is in Chinese, but I have marked some key points in English as much as possible.
6900hx可以用这个
{0x1002, 0x1681, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_YELLOW_CARP|AMD_IS_APU},

@DocMAX
Copy link

DocMAX commented Mar 27, 2023

It works for me with SeaBIOS. Can it be done with OVMF (UEFI)? The ROM file i got seems to have no UEFI support.
(OROM_VBIOS_Renoir_017.010.000.027.000000.bin)

@matt22207
Copy link
Author

It works for me with SeaBIOS. Can it be done with OVMF (UEFI)? The ROM file i got seems to have no UEFI support. (OROM_VBIOS_Renoir_017.010.000.027.000000.bin)

Not sure @DocMAX , I still haven't gotten this working at all, but haven't really had time to play with this since June 2022. SeaBIOS seemed to be the most promising.

Care to share where you got your ROM bin from?

@DocMAX
Copy link

DocMAX commented Mar 27, 2023

https://forum.proxmox.com/threads/amd-ryzen-7-renoir-4750g-apu-and-igpu-pass-thru-to-windows-10-guest.84849/page-3#post-418165

This ROM is BIOS and UEFI. So far it starts in UEFI, but like the thread opener i get pixelated junk on screen as soon as i load the AMD drivers.
Now checking with BIOS mode.

@isc30
Copy link

isc30 commented Oct 7, 2023

maybe the vbios is required for all 3 PCI devices (GPU, Audio, CCP). This seems to work well
image

@DocMAX
Copy link

DocMAX commented Oct 7, 2023

maybe the vbios is required for all 3 PCI devices (GPU, Audio, CCP). This seems to work well image

Oh it's fixed by a new ROM:

https://forum.proxmox.com/threads/amd-ryzen-7-renoir-4750g-apu-and-igpu-pass-thru-to-windows-10-guest.84849/post-549222

No pixel garbage anymore BUT: I can boot Windows only once, after shutdown the system gets into an unstable state!

Edit: Probably also working because i switched from Renoir to Cezanne.

@hqshi
Copy link

hqshi commented Oct 9, 2023 via email

@sergeycherepanov
Copy link

sergeycherepanov commented Oct 30, 2023

Can confirm that the config works with UEFI bios on 5600G too. But still need a solution for the unstability issue after shutdown.

@isc30
Copy link

isc30 commented Oct 31, 2023

@DocMAX
Copy link

DocMAX commented Oct 31, 2023

have a look https://github.com/isc30/ryzen-7000-series-proxmox

Thanks, but even with this i guess we will still have the crash after shutdown.

@isc30
Copy link

isc30 commented Oct 31, 2023

yes, the AMD reset bug is always there

@thermosiphonas
Copy link

Can confirm that the config works with UEFI bios on 5600G too. But still need a solution for the unstability issue after shutdown.

How did you achieve this? I am still getting error 43

@elandwg
Copy link

elandwg commented Feb 13, 2024

Will this guide work for 5700U?

Edit:
It didn't. I followed the video from few comments above but the video output was stuck on few grub messages and windows showed code 43 for gpu. I extracted vbios from PCs own bios so it must be correct. Idk what else to do with it.

@sergeycherepanov
Copy link

Can confirm that the config works with UEFI bios on 5600G too. But still need a solution for the unstability issue after shutdown.

How did you achieve this? I am still getting error 43

The error will gone if you will use proper vbios.

@augiem
Copy link

augiem commented Feb 26, 2024

Will this guide work for 5700U?

Edit: It didn't. I followed the video from few comments above but the video output was stuck on few grub messages and windows showed code 43 for gpu. I extracted vbios from PCs own bios so it must be correct. Idk what else to do with it.

I'm also unable to get a 5700U to work. I don't always get code 43, but I can tell the VM is not acquiring the GPU correctly because the HDMI out never changes from displaying the initial Proxmox boot log. On another system that successfully passes through a 3070, the instant I launch the VM that has GPU passthrough, the HDMI out goes black until Windows boots.

I do suspect the vbios is a problem. I am unable to find a vbios for the 5700U. I extracted the vbios myself using the method shown here, but I suspect this is flawed because the GPU is necessarily already initialized by the time I run this, but this and this say the vbios needs to be extracted when the GPU is not in use. Being a mini pc with no PCIE slots, I don't know if it would be possible even with an M.2 to PCIE adapter as the bios that doesn't allow selection of a boot GPU,

So far, I haven't found any evidence that anyone has gotten a 5xxx mobile APU to work. I've found a lot of fails like this, but no successes so far.

@elandwg
Copy link

elandwg commented Feb 27, 2024

Will this guide work for 5700U?
Edit: It didn't. I followed the video from few comments above but the video output was stuck on few grub messages and windows showed code 43 for gpu. I extracted vbios from PCs own bios so it must be correct. Idk what else to do with it.

I'm also unable to get a 5700U to work. I don't always get code 43, but I can tell the VM is not acquiring the CPU correctly because the HDMI out never changes from displaying the initial Proxmox boot log. On another system that successfully passes through a 3070, the instant I launch the VM that has GPU passthrough, the HDMI out goes black until Windows boots.

I do suspect the vbios is a problem. I am unable to find a vbios for the 5700U. I extracted the vbios myself using the method shown here, but I suspect this is flawed because the GPU is necessarily already initialized by the time I run this, but this and this say the vbios needs to be extracted when the GPU is not in use. Being a mini pc with no PCIE slots, I don't know if it would be possible even with an M.2 to PCIE adapter as the bios that doesn't allow selection of a boot GPU,

So far, I haven't found any evidence that anyone has gotten a 5xxx mobile APU to work. I've found a lot of fails like this, but no successes so far.

You can try with this one. vbios_lucienne.bin is what I extracted with the method you mentioned and vbios_1638.dat is what I got directly from the bios dump. The only difference between them is that vbios_1638.dat mentions cezanne gpu and vbios_lucienne.bin mentions lucienne inside. I also included bios dump in case you want to extract it yourself.

@DocMAX
Copy link

DocMAX commented Feb 28, 2024

But we still have the amd reset bug, right?

@NoahAronov
Copy link

Will this guide work for 5700U?
Edit: It didn't. I followed the video from few comments above but the video output was stuck on few grub messages and windows showed code 43 for gpu. I extracted vbios from PCs own bios so it must be correct. Idk what else to do with it.

I'm also unable to get a 5700U to work. I don't always get code 43, but I can tell the VM is not acquiring the CPU correctly because the HDMI out never changes from displaying the initial Proxmox boot log. On another system that successfully passes through a 3070, the instant I launch the VM that has GPU passthrough, the HDMI out goes black until Windows boots.

I do suspect the vbios is a problem. I am unable to find a vbios for the 5700U. I extracted the vbios myself using the method shown here, but I suspect this is flawed because the GPU is necessarily already initialized by the time I run this, but this and this say the vbios needs to be extracted when the GPU is not in use. Being a mini pc with no PCIE slots, I don't know if it would be possible even with an M.2 to PCIE adapter as the bios that doesn't allow selection of a boot GPU,

So far, I haven't found any evidence that anyone has gotten a 5xxx mobile APU to work. I've found a lot of fails like this, but no successes so far.

I've got the 5700U and made it to the error 43. So far I've tried a lot, but I have no idea what this vbios stuff is all about. Considering I have yet to see it work out... I probably won't be going down the vbios rabbithole just yet unless it works for you. I've run into this same problem with the NVIDA dGPU I passed through last year, and I ended up fixing it finally by altering something in the motherboard BIOS. I'll keep looking into that

@augiem
Copy link

augiem commented Feb 29, 2024

Will this guide work for 5700U?
Edit: It didn't. I followed the video from few comments above but the video output was stuck on few grub messages and windows showed code 43 for gpu. I extracted vbios from PCs own bios so it must be correct. Idk what else to do with it.

I'm also unable to get a 5700U to work. I don't always get code 43, but I can tell the VM is not acquiring the CPU correctly because the HDMI out never changes from displaying the initial Proxmox boot log. On another system that successfully passes through a 3070, the instant I launch the VM that has GPU passthrough, the HDMI out goes black until Windows boots.
I do suspect the vbios is a problem. I am unable to find a vbios for the 5700U. I extracted the vbios myself using the method shown here, but I suspect this is flawed because the GPU is necessarily already initialized by the time I run this, but this and this say the vbios needs to be extracted when the GPU is not in use. Being a mini pc with no PCIE slots, I don't know if it would be possible even with an M.2 to PCIE adapter as the bios that doesn't allow selection of a boot GPU,
So far, I haven't found any evidence that anyone has gotten a 5xxx mobile APU to work. I've found a lot of fails like this, but no successes so far.

You can try with this one. vbios_lucienne.bin is what I extracted with the method you mentioned and vbios_1638.dat is what I got directly from the bios dump. The only difference between them is that vbios_1638.dat mentions cezanne gpu and vbios_lucienne.bin mentions lucienne inside. I also included bios dump in case you want to extract it yourself.

Thanks for sharing your files. I didn't see any difference using your files vs mine. However, it lead me to try a bunch of other things and now IT WORKS!!! (With caveats, of course).

When it started working, the GPU output a video signal immediately when the VM started instead of showing the stale Proxmox boot log. This is what I saw with a successful Nvidia GPU passthrough as well. So don't even worry about trying to solve the Error 43 until you have a video signal output over HDMI / DP. The problem lies upstream of the Windows VM.

The vbios I had previously extracted using the method here worked fine. It was the same size as yours, but slightly different in binary. Not sure if that's important. (Edit: The vbios extracted by UBU also works.)

What seems to have been very important was to extract the correct AMDGopDriver.rom for my specific device. I downloaded the motherboard bios from the mini pc maker's website, extracted the GOP driver .efi from the bios rom file with UBU, then converted the extracted GOP .efi file to a rom with EfiRom.exe from here.

I also made a number of other changes to the grub startup line, blacklist, and vfio.conf, so I don't know yet whether any of those changes are necessary I'll post back here if I find any of those settings were important. (Edit: None of these changes I made had any effect. All have been removed and it still works.).

Generally, I used various bits of information from the following sources:
https://forum.proxmox.com/threads/pci-gpu-passthrough-on-proxmox-ve-8-installation-and-configuration.130218/
https://www.youtube.com/watch?v=iWwdf66JpxE
https://www.youtube.com/watch?v=BElSsyLSX5c
https://github.com/isc30/ryzen-7000-series-proxmox

The last link is the most complete guide, however it does not tell you how to extract AMDGopDriver.efi and convert it into a rom.

Caveats:

  1. GPU can only be initialized (a Windows VM launched) once per boot of the host machine. All subsequent attempts fail to initialize the GPU.
  2. On some boots of the Windows VM, the GPU does not initialize correctly until the device is disabled and then re-enabled in device manager. I haven't tried RadeonResetBugFixService yet.

Edit: By the way, I am using OVMF (UEFI).

@elandwg
Copy link

elandwg commented Mar 1, 2024

Thanks for sharing your files. I didn't see any difference using your files vs mine. However, it lead me to try a bunch of other things and now IT WORKS!!! (With caveats, of course).

When it started working, the GPU output a video signal immediately when the VM started instead of showing the stale Proxmox boot log. This is what I saw with a successful Nvidia GPU passthrough as well. So don't even worry about trying to solve the Error 43 until you have a video signal output over HDMI / DP. The problem lies upstream of the Windows VM.

The vbios I had previously extracted using the method here worked fine. It was the same size as yours, but slightly different in binary. Not sure if that's important. (Edit: The vbios extracted by UBU also works.)

What seems to have been very important was to extract the correct AMDGopDriver.rom for my specific device. I downloaded the motherboard bios from the mini pc maker's website, extracted the GOP driver .efi from the bios rom file with UBU, then converted the extracted GOP .efi file to a rom with EfiRom.exe from here.

I also made a number of other changes to the grub startup line, blacklist, and vfio.conf, so I don't know yet whether any of those changes are necessary I'll post back here if I find any of those settings were important. (Edit: None of these changes I made had any effect. All have been removed and it still works.).

Generally, I used various bits of information from the following sources: https://forum.proxmox.com/threads/pci-gpu-passthrough-on-proxmox-ve-8-installation-and-configuration.130218/ https://www.youtube.com/watch?v=iWwdf66JpxE https://www.youtube.com/watch?v=BElSsyLSX5c https://github.com/isc30/ryzen-7000-series-proxmox

The last link is the most complete guide, however it does not tell you how to extract AMDGopDriver.efi and convert it into a rom.

Caveats:

  1. GPU can only be initialized (a Windows VM launched) once per boot of the host machine. All subsequent attempts fail to initialize the GPU.
  2. On some boots of the Windows VM, the GPU does not initialize correctly until the device is disabled and then re-enabled in device manager. I haven't tried RadeonResetBugFixService yet.

Edit: By the way, I am using OVMF (UEFI).

My dude, you're the hero. It works for me too. Idk if AMDGopDriver is different for every PC, but I uploaded mine here. Also, here is the short guide that I made:

  1. You'll need to have the BIOS file for your PC to extract AMDGopDriver.rom, or try mine from the Google Drive link above (or if you don't have the BIOS).
  2. If you want to extract yours, then get UBU here and extract the AMDGopDriver.efi.
  3. Get EfiRom.exe from here. Run it: EfiRom.exe -f VendorId -i DeviceId -e AMDGopDriver.efi -o AMDGopDriver.rom. To get Vendor and Device ID run lspci -nn | grep -e 'AMD/ATI' on your Proxmox and you'll get (...) Renoir Radeon High Definition Audio Controller [1002:1637] (...), where 1002 is your Vendor ID and 1637 is Device ID.
  4. In Powershell scp [PATH TO FOLDER]\AMDGopDriver.rom root@[YOUR IP]:/usr/share/kvm/
  5. Follow this guide including the optional step of getting UEFI BIOS to work (obv use AMDGopDriver that we extracted). You must use OVMF (UEFI), otherwise no video output (at least on my PC).

Edit: I tried RadeonResetBugFixService and the system survived 3 VM reboots. No code 43 or instability so far.

@augiem
Copy link

augiem commented Mar 1, 2024

My dude, you're the hero. It works for me too. Idk if AMDGopDriver is different for every PC, but I uploaded mine here. Also, here is the short guide that I made:

  1. You'll need to have the BIOS file for your PC to extract AMDGopDriver.rom, or try mine from the Google Drive link above (or if you don't have the BIOS).
  2. If you want to extract yours, then get UBU here and extract the AMDGopDriver.efi.
  3. Get EfiRom.exe from here. Run it: EfiRom.exe -f VendorId -i DeviceId -e AMDGopDriver.efi -o AMDGopDriver.rom. To get Vendor and Device ID run lspci -nn | grep -e 'AMD/ATI' on your Proxmox and you'll get (...) Renoir Radeon High Definition Audio Controller [1002:1637] (...), where 1002 is your Device ID and 1637 is Vendor ID.
  4. In Powershell scp [PATH TO FOLDER]\AMDGopDriver.rom root@[YOUR IP]:/usr/share/kvm/
  5. Follow this guide including the optional step of getting UEFI BIOS to work (obv use AMDGopDriver that we extracted). You must use OVMF (UEFI), otherwise no video output (at least on my PC).

Edit: I tried RadeonResetBugFixService and the system survived 3 VM reboots. No code 43 or instability so far.

That's awesome that it worked!

I just compared your current GOP driver to mine and they're almost identical. I wonder if the difference is just because of the product id difference? It looks like you used the product id of the audio controller and I used the product id of the VGA controller. I just tested your GOP driver and it works for me too. I've also tried using the product id of the vbios_1638.dat file UBU creates and that also works.

It seems to me that if the only difference between our two GOP drivers is the product id we used, then maybe the GOP driver is the same for anything that uses the same GPU as the 5700U. That would seem to make sense.

The owner of this repo added my GOP file today, but at the time, I was under the impression that it was motherboard specific. Out of curiosity, what computer / motherboard are you using? Since your driver works for me as well, I'll ask him to change the name of the GOP driver file to _5700U rather than the name of my mini pc.

Thanks for writing the extraction guide. One small correction: the 2nd number (1002:1637) is the product/device id, in your case 1637.

I also wrote up a guide on how to extract the vbios and GOP driver here. I was thinking of making a PR and update the main readme with the instructions. The repo already has some similar tools in the Tools directory, but this isn't mentioned at all in the main readme.

As for RadeonResetBugFixService, I haven't had much luck yet getting it working correctly. It doesn't seem to be detecting the VirtIO virtual display driver so it can disable it as it's supposed to when it enables the Radeon. Also, I had the iGPU fail to initialize on one boot and the host crashed once when I tried to reset the VM. Without the bug fix, with the iGPU set as the primary GPU, I haven't seen it fail to initialize once, nor have I seen it crash on rebooting the VM. Without the bug fix, it's only when I shut down the VM and try to start it again that it fails.

@elandwg
Copy link

elandwg commented Mar 1, 2024

One small correction: the 2nd number (1002:1637) is the product/device id, in your case 1637.

Didn't see that, fixed it.

Out of curiosity, what computer / motherboard are you using?

Awoostar R7 mini PC. Bios ver.: 2.22.1282.

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