Arch Linux PCI Passtrough


2

我安装了Arch(Antergos)来为KVM Vms启用PCI passtrough,但如果我启动VM它就会崩溃。我按照本教程

我的硬件:

  • 主板:Asrock H97M Pro4
  • 处理器:英特尔®酷睿™i5-4690 CPU @ 3.50GHz×4
  • GPU MSI GTX760 Twin Frozr
  • 拉姆:16GB
  • 操作系统:Antergos 64Bit

首先,我

  • 在uefi中启用了VT-d
  • 将intel_iommu =“on”添加到/ etc / default // grub中的GRUB_CMDLINE_LINUX_DEFAULT =“”
  • 更新了grub

我的IOMMU团体:

00:00.0 Host bridge [0600]: Intel Corporation 4th Gen Core Processor DRAM Controller [8086:0c00] (rev 06)
00:02.0 VGA compatible controller [0300]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller [8086:0412] (rev 06)
00:03.0 Audio device [0403]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller [8086:0c0c] (rev 06)
00:14.0 USB controller [0c03]: Intel Corporation 9 Series Chipset Family USB xHCI Controller [8086:8cb1]
00:16.0 Communication controller [0780]: Intel Corporation 9 Series Chipset Family ME Interface #1 [8086:8cba]
00:19.0 Ethernet controller [0200]: Intel Corporation Ethernet Connection (2) I218-V [8086:15a1]
00:1a.0 USB controller [0c03]: Intel Corporation 9 Series Chipset Family USB EHCI Controller #2 [8086:8cad]
00:1b.0 Audio device [0403]: Intel Corporation 9 Series Chipset Family HD Audio Controller [8086:8ca0]
00:1c.0 PCI bridge [0604]: Intel Corporation 9 Series Chipset Family PCI Express Root Port 1 [8086:8c90] (rev d0)
00:1c.3 PCI bridge [0604]: Intel Corporation 82801 PCI Bridge [8086:244e] (rev d0)
00:1c.4 PCI bridge [0604]: Intel Corporation 9 Series Chipset Family PCI Express Root Port 5 [8086:8c98] (rev d0)
00:1d.0 USB controller [0c03]: Intel Corporation 9 Series Chipset Family USB EHCI Controller #1 [8086:8ca6]
00:1f.0 ISA bridge [0601]: Intel Corporation 9 Series Chipset Family H97 Controller [8086:8cc6]
00:1f.2 SATA controller [0106]: Intel Corporation 9 Series Chipset Family SATA Controller [AHCI Mode] [8086:8c82]
00:1f.3 SMBus [0c05]: Intel Corporation 9 Series Chipset Family SMBus Controller [8086:8ca2]
02:00.0 PCI bridge [0604]: ASMedia Technology Inc. ASM1083/1085 PCIe to PCI Bridge [1b21:1080] (rev 03)
04:00.0 VGA compatible controller [0300]: NVIDIA Corporation GK104 [GeForce GTX 760] [10de:1187] (rev a1)
04:00.1 Audio device [0403]: NVIDIA Corporation GK104 HDMI Audio Controller [10de:0e0a] (rev a1)

所以我的GPU包括:

  • VGA控制器:04:00.0(10de:1187)
  • 音频控制器:04:00.1(10de:0e0a)

然后我创建了文件:/etc/modprobe.d/vfio.conf并写了

options vfio-pci ids=10de:1187,10de:0e0a

然后我创建了/etc/mkinitcpio.conf并附加到MODULES =“”

vfio vfio_iommu_type1 vfio_pci vfio_virqfd

重新启动我的机器并检查gpu是否有vfio驱动程序

lspci -k

04:00.0 VGA compatible controller: NVIDIA Corporation GK104 [GeForce GTX 760] (rev a1)
    Subsystem: Micro-Star International Co., Ltd. [MSI] Device 2847
    Kernel driver in use: vfio-pci
    Kernel modules: nouveau
04:00.1 Audio device: NVIDIA Corporation GK104 HDMI Audio Controller (rev a1)
    Subsystem: Micro-Star International Co., Ltd. [MSI] Device 2847
    Kernel driver in use: vfio-pci
    Kernel modules: snd_hda_intel

安装了一些包:

pacman -S qemu libvirt virt-manager
yaourt -S ovmf-git

编辑/etc/libvirt/qemu.conf

nvram = [
    "/usr/share/ovmf/x64/ovmf_x64.bin:/usr/share/ovmf/x64/ovmf_vars_x64.bin"
]

启动/启用libvirt

systemctl enable --now libvirtd
systemctl enable virtlogd.socket

最后我创建了一个VM:

  • 固件:UEFI
  • CPU:选中“复制主机CPU配置”
  • 插入Windows磁盘

现在它开始在虚拟控制台中,一切都很好!然后我添加了我的GPU(PCI设备)并再次启动它。现在它崩溃了,我不知道为什么!没有错误消息。

我希望你能帮助我,谢谢你的努力

Answers:


0

您没有链接您的XML,但我会假设您没有为您的视频卡加载rom(假设您的视频卡支持UEFI)。

  1. 验证您的视频卡是否支持UEFI
  2. 获取卡的视频ROM

您可以使用https://www.techpowerup.com/vgabios/来执行这两项操作。如果您的卡未列出或ROM不可用,您只需在制造商的论坛上询问即可。这就是我为我的视频卡获取ROM副本以解决您遇到的同样问题的方法。

获得rom文件后,使用virsh编辑,尝试将以下内容添加到xml配置中

   <hostdev>
     ...
     <rom file='/etc/fake/boot.bin'/>
     ...
   </hostdev>
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.