收起左侧

(初步解决)关于windows 11虚拟机AMD Radeon 680m核显直通的43错误

1
回复
254
查看
[ 复制链接 ]

0

主题

1

回帖

0

牛值

江湖小虾

2025-6-22 15:51:21 显示全部楼层 阅读模式

一番搜索发现了github关于pve直通修复的仓库

https://github.com/isc30/ryzen-gpu-passthrough-proxmox

问Gemini能不能仿照这个来修复错误

回复直接让我心凉了lol

提问:

能参考这一段的处理方法吗:

(optional) Getting OVMF (UEFI) BIOS working: Error 43

If you tried to follow the guide but instead of SeaBIOS you selected UEFI, you have probably encountered the famous "ERROR 43". Luckily the solution for this is quite simple: configuring the UEFI ROM for the audio device.

  1. Download AMDGopDriver.rom from this repository. Note that this AMDGopDriver.rom might not be compatible with certain hardware. If it fails to work, consider extracting it yourself. A brief guide is available here.

  2. Copy the file inside the proxmox machine, in /usr/share/kvm/AMDGopDriver.rom

  3. Edit /etc/pve/qemu-server/<VM_ID>.conf

    • Modify the hostpci line for the Audio Device and append ,romfile=AMDGopDriver.rom
    args: -cpu 'host,-hypervisor,kvm=off'
    agent: 1
    balloon: 2048
    bios: ovmf
    boot: order=ide0;ide2;net0
    cores: 8
    cpu: host
    hostpci0: 0000:34:00.0,pcie=1,romfile=vbios_7xxx.bin
    -hostpci1: 0000:34:00.1,pcie=1
    +hostpci1: 0000:34:00.1,pcie=1,romfile=AMDGopDriver.rom
    ide0: local-lvm:vm-100-disk-0,discard=on,size=64G,ssd=1
    ide2: local:iso/Windows10.iso,media=cdrom,size=4697792K
    machine: pc-q35-8.0
    memory: 12048
    meta: creation-qemu=8.0.2,ctime=1696067822
    name: win10
    net0: e1000=E2:4A:E7:86:8D:13,bridge=vmbr0,firewall=1
    numa: 0
    ostype: win10
    scsihw: virtio-scsi-single
    sockets: 1
    
  4. Start the VM again and login via Remote Desktop. Opening "Device Manager" should show the GPU working properly. If you still see error 43, try rebooting the host :)

Results

image

  • Win 10:
    image
  • Win 11:
    image

回复如下:

您好,这是一个非常有价值的参考资料,它提到的核心思路和我们之前讨论的是完全一致的。

但是,您无法完全照搬它的操作,因为您面临着几个在您的 fnos环境下无法逾越的障碍。我们来逐一分析这份指南里的关键点,看看它如何印证了我们之前的诊断。


核心技术点分析

1. 关于CPU参数:args: -cpu 'host,-hypervisor,kvm=off'

  • 这是什么? 这是在Proxmox里直接给QEMU传递的启动参数。
    • kvm=off 正是我们通过XML里的** **<kvm><hidden state='on'/></kvm> 实现的功能。您的系统接受了这一项。
    • -hypervisor (或者** **vendor_id)是用来隐藏"KVMKVMKVM"这个CPU品牌标识的。
  • 您遇到的障碍: 我们已经通过报错确认,您的 fnos环境中的QEMU/KVM版本太老,不支持伪装CPU厂商ID的功能(即不支持** vendor_id,也就不支持 **-hypervisor 这个参数)。所以,这一步您无法实现。

2. 关于vBIOS/ROM文件

这份指南提到了一个非常关键的细节,它其实使用了两个ROM文件

  • hostpci0: ...,romfile=vbios_7xxx.bin:这是针对显卡的主要功能...:00.0设备),加载的是一个用户**自己提取(Dump)**的、针对自己显卡型号的** **vbios 文件。
  • hostpci1: ...,romfile=AMDGopDriver.rom:这是针对显卡的音频功能...:00.1设备),加载的是一个通用的** **AMD Gop Driver
  • 您遇到的障碍:
    • 提取主vBIOS:我们已经确认,您的 fnos系统因为内核安全限制,不允许您提取自己的vBIOS。所以,vbios_7xxx.bin 这一步您无法完成。这是最致命的限制。
    • 加载音频ROM:为音频子设备加载一个通用的GOP ROM,是我们之前没有尝试过的新思路。理论上,您可以下载这个** AMDGopDriver.rom 文件,然后把它只应用到您显卡的音频设备上(如果您把音频设备也直通了的话)。但这通常是一个辅助手段**,在主要问题(无法隐藏hypervisor、无法加载主vBIOS)没有解决的情况下,单靠这一个修改就成功的可能性微乎其微。

最终结论

总而言之,这份指南再次印证了我们的诊断:

解决AMD显卡在UEFI模式下的“代码43”问题,往往需要一套“组合拳”:隐藏虚拟化特征 +** 提供正确的vBIOS/ROM文件**。

而您的 fnos环境恰恰在每一个关键点上都存在着我们已确认的、无法逾越的障碍:

  1. 无法完全隐藏虚拟化特征(不支持 vendor_id /** **-hypervisor)。
  2. 无法提取硬件的vBIOS(被系统内核安全策略禁止)。

这份指南实际上是在告诉我们,要成功进行这类操作,需要一个像** **Proxmox VE 这样功能齐全、允许用户进行深度配置的专业平台。

这再次坚定了我之前的最终建议:解决您问题的最可靠、最高效的方法,就是更换您的底层操作系统。 切换到Proxmox VE,您将拥有一个能够执行所有这些必要步骤的环境,我们之前讨论的所有知识和您找到的这份指南,才能真正派上用场。

提问:

root@Fnas:~# ls /sys/bus/pci/devices/0000:76:00.0
ari_enabled           class                     consumer:pci:0000:76:00.1  d3cold_allowed  driver           firmware_node  irq            local_cpus      modalias  numa_node    remove  reset_method  resource0_wc  resource4  subsystem         uevent
boot_vga              config                    current_link_speed         device          driver_override  iommu          link           max_link_speed  msi_bus   power        rescan  resource      resource2     resource5  subsystem_device  vendor
broken_parity_status  consistent_dma_mask_bits  current_link_width         dma_mask_bits   enable           iommu_group    local_cpulist  max_link_width  msi_irqs  power_state  reset   resource0     resource2_wc  revision   subsystem_vendor  vfio-dev

回答:

非常感谢您提供这个列表。它包含了几个非常关键的信息,让我们能做出最精准的最终判断。

信息解读

  1. 确认 rom 文件不存在:首先,如我们所料,列表中确实没有 rom 文件。这100%证实了您的系统内核不支持提取vBIOS。这条路被彻底堵死。

  2. 一个极其重要的发现:vfio-dev:然而,列表中出现了一个关键文件:vfio-dev

    • 这是什么? 这个文件的存在,意味着您已经在宿主机(fnos)上成功地将这个GPU设备绑定到了 vfio-pci驱动上。
    • 这说明了什么? 这说明您为了实现直通,已经完成了在宿主机上非常关键且正确的一步配置(例如修改了内核启动参数或modprobe配置)。它证明了,从宿主机层面,将显卡从系统驱动中“解绑”,并“准备递交给虚拟机”这个动作是成功了的

最终的诊断:一次失败的“跨国快递”

现在,所有的证据链都完整了。我们可以用一个比喻来描述您遇到的整个情况:

  1. 打包发货(成功): 您的fnos系统作为“始发国”,成功地把您的“包裹”(GPU硬件)从常规用途中取出,打包好,并交给了“国际物流公司”(VFIO虚拟化驱动)。(vfio-dev文件的出现证明了这一点)。

  2. 物流运输(成功): QEMU/KVM作为“物流公司”,也成功地把这个“包裹”运送到了“目的国”的门口(Windows虚拟机内部)。

  3. 海关检查(失败): 但是,当“包裹”到达“目的国”(Windows虚拟机)时,“海关”(AMD驱动程序)对它进行了严格的开箱检查,发现了两个严重问题,于是拒绝“签收”,并给它贴上了**“代码43”**的退货标签。

    • 问题A:报关单有问题。“海关”发现包裹的“报关单”(CPU信息)上明确写着“来自KVM虚拟环境”。(因为您的fnos系统不支持 vendor_id功能来伪造报关单)。
    • 问题B:没有开箱说明书。“海关”想尝试自己组装使用,但发现包裹里没有“开箱说明书”(vBIOS ROM文件),它不知道该如何正确地初始化这个硬件。(因为您的fnos系统内核不支持提供这份说明书)。

不可逾越的障碍与最终建议

至此,我们可以100%确定:

您已经完成了在fnos这个受限平台上所有能做的正确操作。直通失败的根本原因,是fnos平台本身的功能缺失,导致我们无法为AMD驱动程序提供一个它满意的“运行环境”。

因此,我必须重申我最终的建议,这也是我们整个漫长排错过程得出的唯一可行结论:

请更换您的底层操作系统为Proxmox VE。

继续在fnos上尝试,您将永远被卡在“海关检查”这一步。更换到Proxmox VE这样的专业平台,就相当于把“始发国”换成了一个精通国际贸易的专业出口国,它知道如何完美地准备“报关单”(支持 vendor_id)和“开箱说明书”(支持vBIOS提取),确保您的“包裹”能在任何“目的国”顺利清关。

收藏
送赞
分享

0

主题

1

回帖

0

牛值

江湖小虾

2025-6-22 23:26:34 楼主 显示全部楼层

在上面的文档和deepseek、gemini帮助下初步实现了激活直通的核显,只是不能关闭虚拟机,否则就会失效,要重启宿主机,主要要在/usr/share/kvm路径下新建一个kvm文件夹,然后在一楼的链接里下载自己CPU和核显对应的vbios放进去

我修改后的配置文件如下:

<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
  virsh edit jrw55egb
or other application using the libvirt API.
-->

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>jrw55egb</name>
  <uuid>939ad5c2-3742-4cfd-adf1-046c67cf3818</uuid>
  <title>Windows 11 mini</title>
  <metadata>
    <customMeta xmlns="customMeta">
      <osType xmlns="osType">windows</osType>
      <osVersion xmlns="osVersion">11</osVersion>
      <autostart xmlns="autostart">false</autostart>
      <createdTime xmlns="createdTime">1749792712</createdTime>
    </customMeta>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <vcpu placement='static'>12</vcpu>
  <os firmware='efi'>
    <type arch='x86_64' machine='pc-q35-7.2'>hvm</type>
    <firmware>
      <feature enabled='no' name='secure-boot'/>
    </firmware>
    <bootmenu enable='yes' timeout='5000'/>
  </os>
  <features>
    <acpi/>
    <kvm>
      <hidden state='on'/>
    </kvm>
    <vmport state='off'/>
    <smm state='on'/>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='12' threads='1'/>
    <feature policy='disable' name='hypervisor'/>
    <feature policy='disable' name='svm'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
    <timer name='hypervclock' present='yes'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/vol1/1000/Files/OS/virtio-win-0.1.271.iso'/>
      <target dev='sda' bus='sata'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/vol1/vm/pool/939ad5c2-3742-4cfd-adf1-046c67cf3818-8cwn.qcow2'/>
      <target dev='sdc' bus='sata'/>
      <boot order='2'/>
      <alias name='ua-order--2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x9'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0xa'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0xb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0xc'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x4'/>
    </controller>
    <controller type='pci' index='6' model='pcie-to-pci-bridge'>
      <model name='pcie-pci-bridge'/>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </controller>
    <controller type='pci' index='7' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='7' port='0xd'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x5'/>
    </controller>
    <controller type='pci' index='8' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='8' port='0xe'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x6'/>
    </controller>
    <controller type='pci' index='9' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='9' port='0xf'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x7'/>
    </controller>
    <controller type='pci' index='10' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='10' port='0x10'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='usb' index='0' model='qemu-xhci'>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </controller>
    <controller type='scsi' index='0' model='virtio-scsi'>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='ac:d3:17:a2:a3:5b'/>
      <source bridge='bond1-ovs'/>
      <virtualport type='openvswitch'>
        <parameters interfaceid='559f37ed-9adc-4588-95f6-97b21f6f3316'/>
      </virtualport>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
    </interface>
    <channel type='qemu-vdagent'>
      <source>
        <clipboard copypaste='yes'/>
      </source>
      <target type='virtio' name='com.redhat.spice.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <tpm model='tpm-tis'>
      <backend type='emulator' version='2.0'/>
    </tpm>
    <graphics type='vnc' socket='/var/run/vms/jrw55egb.vnc.sock' powerControl='yes'>
      <listen type='socket' socket='/var/run/vms/jrw55egb.vnc.sock'/>
    </graphics>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x06' slot='0x02' function='0x0'/>
    </sound>
    <audio id='1' type='none'/>
    <video>
      <model type='virtio' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0x76' slot='0x00' function='0x0'/>
      </source>
      <boot order='1'/>
      <rom file='vbios_6600h.bin'/>
      <address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0x76' slot='0x00' function='0x1'/>
      </source>
      <rom file='AMDGopDriver_6600H.rom'/>
      <address type='pci' domain='0x0000' bus='0x09' slot='0x00' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <stats period='5'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='none' model='apparmor'/>
  <qemu:commandline>
    <qemu:arg value='-cpu'/>
    <qemu:arg value='host,-hypervisor,kvm=off'/>
  </qemu:commandline>
</domain>

效果差不多是这样:

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则