我目前正在尝试设置我的nvidia GPU到Windows来宾的直通。我实际上正在使用拱门
以下是我到目前为止所做的以及我面临的问题:
已启用 IOMMU
dmesg|grep -i iommu
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=0b58f681-aba7-4bdd-983a-c3fb9e69201e rw cryptdevice=/dev/nvme0n1p2:cryptroot cryptkey=rootfs:/crypto/root.key intel_iommu=on iommu=pt nouveau.blacklist=1 quiet
[ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=0b58f681-aba7-4bdd-983a-c3fb9e69201e rw cryptdevice=/dev/nvme0n1p2:cryptroot cryptkey=rootfs:/crypto/root.key intel_iommu=on iommu=pt nouveau.blacklist=1 quiet
[ 0.000000] DMAR: IOMMU enabled
[ 0.039812] DMAR-IR: IOAPIC id 2 under DRHD base 0xfed91000 IOMMU 1
[ 0.608811] iommu: Adding device 0000:00:00.0 to group 0
[ 0.608819] iommu: Adding device 0000:00:01.0 to group 1
[ 0.608824] iommu: Adding device 0000:00:02.0 to group 2
[ 0.608829] iommu: Adding device 0000:00:04.0 to group 3
[ 0.608838] iommu: Adding device 0000:00:14.0 to group 4
[ 0.608842] iommu: Adding device 0000:00:14.2 to group 4
[ 0.608850] iommu: Adding device 0000:00:15.0 to group 5
[ 0.608854] iommu: Adding device 0000:00:15.1 to group 5
[ 0.608860] iommu: Adding device 0000:00:16.0 to group 6
[ 0.608865] iommu: Adding device 0000:00:17.0 to group 7
[ 0.608876] iommu: Adding device 0000:00:1c.0 to group 8
[ 0.608886] iommu: Adding device 0000:00:1c.4 to group 9
[ 0.608897] iommu: Adding device 0000:00:1c.5 to group 10
[ 0.608907] iommu: Adding device 0000:00:1d.0 to group 11
[ 0.608919] iommu: Adding device 0000:00:1f.0 to group 12
[ 0.608924] iommu: Adding device 0000:00:1f.2 to group 12
[ 0.608928] iommu: Adding device 0000:00:1f.3 to group 12
[ 0.608933] iommu: Adding device 0000:00:1f.4 to group 12
[ 0.608936] iommu: Adding device 0000:01:00.0 to group 1
[ 0.608947] iommu: Adding device 0000:3b:00.0 to group 13
[ 0.608957] iommu: Adding device 0000:3c:00.0 to group 14
[ 0.608963] iommu: Adding device 0000:3d:00.0 to group 15
GPU 的 IOMMU 组
IOMMU Group 1 00:01.0 PCI bridge [0604]: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) [8086:1901] (rev 05)
IOMMU Group 1 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile 3GB] [10de:1c20] (rev a1)
已启用虚拟集成
lspci -k
01:00.0 VGA compatible controller: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile 3GB] (rev a1)
Kernel driver in use: vfio-pci
Kernel modules: nouveau
libvirt VM 配置
<domain type='kvm'>
<name>windows10-gaming</name>
<uuid>826da537-6982-40e3-a51c-f308d2c76c85</uuid>
<memory unit='KiB'>8388608</memory>
<currentMemory unit='KiB'>8388608</currentMemory>
<vcpu placement='static'>4</vcpu>
<os>
<type arch='x86_64' machine='pc-i440fx-2.11'>hvm</type>
<loader readonly='yes' type='pflash'>/usr/share/ovmf/ovmf_code_x64.bin</loader>
<nvram>/var/lib/libvirt/qemu/nvram/windows10-gaming_VARS.fd</nvram>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<hyperv>
<relaxed state='on'/>
<vapic state='on'/>
<spinlocks state='on' retries='8191'/>
</hyperv>
<kvm>
<hidden state='off'/>
</kvm>
<vmport state='off'/>
</features>
<cpu mode='host-passthrough' check='none'/>
<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='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/home/guy/virtu/windows10-gaming.qcow2'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='hdb' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>
<controller type='usb' index='0' model='ich9-ehci1'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci1'>
<master startport='0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci2'>
<master startport='2'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci3'>
<master startport='4'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<controller type='virtio-serial' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</controller>
<interface type='network'>
<mac address='52:54:00:96:d8:8e'/>
<source network='default'/>
<model type='rtl8139'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
</target>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<channel type='spicevmc'>
<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'/>
<graphics type='spice' autoport='yes'>
<listen type='address'/>
<image compression='off'/>
</graphics>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='vga' vram='16384' heads='1' primary='yes'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<hostdev mode='subsystem' type='pci' managed='yes'>
<driver name='vfio'/>
<source>
<address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</source>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</hostdev>
<redirdev bus='usb' type='spicevmc'>
<address type='usb' bus='0' port='2'/>
</redirdev>
<redirdev bus='usb' type='spicevmc'>
<address type='usb' bus='0' port='3'/>
</redirdev>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</memballoon>
</devices>
</domain>
但是当来宾启动时,我收到此错误
2018-01-11T19:57:45.154191Z qemu-system-x86_64: vfio-pci: Cannot read device rom at 0000:01:00.0
设备选项 ROM 内容可能无效(检查 dmesg)。 跳过选项 ROM 探头,rombar=0,或从文件 romfile=
加载 我发现我应该能够转储这个罗马文件购买阅读 足够的文件
[root@pc-guy guy]# cat /sys/bus/pci/devices/0000:00:01.0/0000:01:00.0/rom
cat: '/sys/bus/pci/devices/0000:00:01.0/0000:01:00.0/rom': Erreur d'entrée/sortie
"输入/输出错误"(英文)
由于此解决方案不起作用,我尝试从内存中读取它,我应该能够转储它,但我需要在内存中他的地址位置。我应该用grep 'Video ROM'/proc/iomem找到它,但这个命令什么也没返回
我现在陷入困境,我正在寻找一种解决方案来使这个 GPU 直通工作,我不明白出了什么问题,欢迎每个建议
据我所知,您试图在笔记本上传递某些内容?这将是困难的,甚至是不可能的。 您可以从 https://www.techpowerup.com/vgabios/189965/189965 中获取 bios(也许您需要从中缩小一些起始字节,请查看 https://github.com/Matoking/NVIDIA-vBIOS-VFIO-Patcher/blob/master/nvidia_vbios_vfio_patcher.py 以供参考)。但是,即使您将启动wm,nvidia控制面板也很可能显示没有显示器连接到您的适配器。
一般来说,笔记本上的 passhtrough 是一个坏主意,由于集成 GPU 和离散 GPU 之间的屏幕共享方式,在大多数情况下,如果独立 GPU 传递到 VM,它将无法使用 HDMI 端口或笔记本屏幕。暂时算了吧。
在启动项中,选项中应该有vfio-pci.ids=10de:1c20
。我看到您的 pci-id 值从您的dmesg
输出中10de:1c20
。通过运行lcpci -nn
进行验证,并添加与显卡一起的音频设备 ID。
此外,不幸的是,您的 iommu 组可能不是每个设备唯一的。你能运行find /sys/kernel/iommu_groups/ -type l
看看你的 GPU 是否在自己独特的 iommu 上吗?
我也遇到了这个问题,但幸运的是通过 BIOS 主板更新解决了。如果您有最新的更新 BIOS,则必须使用 ACS 修补程序重新编译内核。
这里有一个由GrayBoltWolf编写的非常好的指南。我遵循了他的指导,并很好地帮助了我。在他的指南中,他用 ubuntu 做了一个视频教程,但我用运行 Arch Linux 的 gtx 1060 成功地做到了这一点。
希望这有帮助!