使用 Unraid 6.6.6 时 GPU 直通失败

使用 Unraid 6.6.6 时 GPU 直通失败

不久前,我构建了一个新的 Ryzen 设置。我目前正在尝试使用 Unraid 6.6.6,并尝试使用来自 Inno3D 的 GTX 1060 设置我的日常 Ubuntu VM。不幸的是,我收到了与 GPU 相关的错误消息。

- 设置 -

主板:华擎 - B450M Pro4

CPU:AMD Ryzen 5 2600 六核 @ 3400

GPU:Inno3d 的 GTX 1060 6Gb

HVM 和 IOMMU:已启用(根据 Unraid 的信息面板)

我尝试过使用许多不同的图形 ROM Bioses 来传递 GPU。一个直接来自 Techpowerup,一个是第一个,但根据 SpaceinvaderOne 的这些说明进行了修改,一个取自 Spaceinvaders 帖子,其中包含社区转储列表(我从 EVGA 那里获得了 1060 可用的转储)。所有这些操作都失败了,并显示以下错误消息:

2018-12-16T22:17:35.335767Z qemu-system-x86_64: -device vfio-pci,host=23:00.0,id=hostdev0,bus=pci.4,addr=0x0,romfile=/mnt/disk1/isos/vbios/GTX1060.Inno3D.rom: Failed to mmap 0000:23:00.0 BAR 3. Performance may be slow
2018-12-16T22:17:35.410501Z qemu-system-x86_64: vfio: Cannot reset device 0000:23:00.0, depends on group 22 which is not owned.
2018-12-16T22:17:36.818822Z qemu-system-x86_64: vfio: Cannot reset device 0000:23:00.0, depends on group 22 which is not owned.

编号为 0000:23:00 的 PCI 设备就是上述 GPU。关闭虚拟机后,我在日志中看到以下错误,再次表明 GPU 出现了问题(只复制了一次,但在日志中出现了多次):

2018-12-16T22:18:08.354094Z qemu-system-x86_64: vfio_region_write(0000:23:00.0:region3+0x1098, 0x0,8) failed: Device or resource busy

所以我认为问题在于我的显卡被系统的其他部分使用。在网上寻找答案时,我找到了这篇关于这个问题的帖子。我理解作者的解释,但修复方法对我没有用。

我的虚拟机配置如下。由于我对 Unraid 还很陌生,因此我宁愿发布完整配置,并在一些更有经验的社区成员告诉哪些部分最重要时删除一些部分。

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' id='5'>
  <name>Ubuntu New</name>
  <uuid>f6167326-d81b-2eb2-c0f4-4c5d33c40eee</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Ubuntu" icon="ubuntu.png" os="ubuntu"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>4</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='4'/>
    <vcpupin vcpu='1' cpuset='5'/>
    <vcpupin vcpu='2' cpuset='8'/>
    <vcpupin vcpu='3' cpuset='9'/>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-3.0'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/f6167326-d81b-2eb2-c0f4-4c5d33c40eee_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough' check='none'>
    <topology sockets='1' cores='4' threads='1'/>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Ubuntu New/vdisk1.img'/>
      <backingStore/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk2'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/ubuntu-18.04.1-desktop-amd64.iso'/>
      <backingStore/>
      <target dev='hda' bus='sata'/>
      <readonly/>
      <boot order='2'/>
      <alias name='sata0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <alias name='usb'/>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <alias name='usb'/>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <alias name='usb'/>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x8'/>
      <alias name='pci.1'/>
      <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'/>
      <alias name='pci.2'/>
      <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'/>
      <alias name='pci.3'/>
      <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'/>
      <alias name='pci.4'/>
      <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'/>
      <alias name='pci.5'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x4'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0xd'/>
      <alias name='pci.6'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x5'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:47:af:f1'/>
      <source bridge='br0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/0'/>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/0'>
      <source path='/dev/pts/0'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-5-Ubuntu New/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='mouse' bus='ps2'>
      <alias name='input0'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input1'/>
    </input>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x23' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev0'/>
      <rom file='/mnt/user/isos/vbios/GTX1060.Inno3D.rom'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x046d'/>
        <product id='0xc52b'/>
        <address bus='1' device='2'/>
      </source>
      <alias name='hostdev1'/>
      <address type='usb' bus='0' port='1'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x06a3'/>
        <product id='0x0cfa'/>
        <address bus='3' device='2'/>
      </source>
      <alias name='hostdev2'/>
      <address type='usb' bus='0' port='2'/>
    </hostdev>
    <memballoon model='none'/>
  </devices>
  <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+0:+100</label>
    <imagelabel>+0:+100</imagelabel>
  </seclabel>
</domain>

我还检查了我的组件的兼容性,但没有发现任何确凿的证据表明存在任何硬件限制。

Unraid 论坛上的相应问题是

我有点绝望并且愿意接受任何想法......

答案1

PCIe 直通不是基于设备,而是基于组。系统会告诉您,您的 GPU 与另一台设备位于同一组中,您不会直通该设备,而是从主机使用该设备。

启动内核日志将告诉您有关这些组的信息,如果您发布相关部分,我们也许能够进一步帮助您。

答案2

我的建议是:

首先,使用 VNC 安装操作系统

然后,更新您的 VM 设置,加载图形卡 BIOS,然后 BOOM,它就可以工作了。

相关内容