For the records of passthrough AMD Ryzen 5600G embedded GPU to Windows 11 VM in Proxmox VE(pve) 8. Many extra parameters found in guides on the internet are eliminated.
網上找到的guide很多參數是不必要的,參數儘量精簡化:
# cat /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on iommu=pt pcie_acs_override=downstream,multifunction initcall_blacklist=sysfb_init"
# cat /etc/modules
vfio
vfio_iommu_type1
vfio_pci
# cat /etc/modprobe.d/blacklist.conf
blacklist amdgpu
blacklist snd_hda_intel
blacklist snd_hda_codec_hdmi
# cat /etc/modprobe.d/vfio.conf
options vfio-pci ids=1002:1638,1002:1637
options vfio-pci disable_idle_d3=1
VM的設定,112是ID可以改,其中vbios_1002_1638.bin、AMDGopDriver_5600G.rom可以由BIOS檔匯出,匯出過程有點複雜,我的匯出如檔案下載連結供參。如果Windows裡面裝置管理員出現錯誤代碼43(code 43),大概就是AMDGopDriver沒裝好的問題。
# cat /etc/pve/qemu-server/112.conf
agent: 1
bios: ovmf
boot: order=scsi0;ide0
cores: 4
cpu: host
efidisk0: local-lvm:vm-112-disk-0,efitype=4m,pre-enrolled-keys=1,size=4M
hostpci0: 0000:07:00.0,pcie=1,romfile=vbios_1002_1638.bin,x-vga=1
hostpci1: 0000:07:00.1,pcie=1,romfile=AMDGopDriver_5600G.rom
hostpci2: 0000:05:00.0,pcie=1
ide0: local:iso/virtio-win-0.1.266.iso,media=cdrom,size=707456K
machine: pc-q35-9.0
memory: 8192
meta: creation-qemu=9.0.2,ctime=1734695425
name: Windows11
net0: virtio=BC:24:11:65:BA:F7,bridge=vmbr0
numa: 0
ostype: win11
scsi0: local-lvm:vm-112-disk-2,iothread=1,size=128G
scsihw: virtio-scsi-single
smbios1: uuid=6f7ec7b7-71d3-4b41-88ba-6f25a54ab1ee
sockets: 1
tpmstate0: local-lvm:vm-112-disk-1,size=4M,version=v2.0
usb0: host=8087:0029
usb1: host=046d:c52b
vga: none
vmgenid: 3cca918f-b5a9-430a-9646-b58ec5646a9a
有關AMD vendor-reset bug,可以參考AMD Ryzen 5600G iGPU code 43 error,約略是:
-
下載vendor-reset source。
在 src/device-db.h裡
#define _AMD_NAVI10(op) \: 後加一行 {PCI_VENDOR_ID_ATI, 0x1638, op, DEVICE_INFO(AMD_NAVI10)}, \
在 udev/99-vendor-reset.rules 加一行
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x1002", ATTR{device}=="0x1638", RUN+="/bin/sh -c '/sbin/modprobe vendor-reset; echo device_specific > /sys$env{DEVPATH}/reset_method'"
,手動複製到/etc/udev/rules.d/。dkms install .
理論上,AMD 5700G、7xxx、8xxx、9xxx都可用這個方法,參考看看。
也可參考https://github.com/isc30/ryzen-7000-series-proxmox。
最後:
而且重新啟動VM沒問題,不會卡住,不用整台機器重開。