KVM / GPU 直通

KVM / GPU 直通

我正在运行全新安装的 Ubuntu 19.04,并且我想通过 KVM 运行 Windows 客户操作系统。

我按照 YouTube 上的指南完成了所有设置:https://www.youtube.com/watch?v=C2jnUK4MSyE

我还在 Arch wiki 中阅读了一篇关于此主题的文章:https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF

因此,在设置完所有设置后,virt-manager 告诉我:“错误:主机不支持任何虚拟化选项”这不可能,因为我在 Bios 中激活了虚拟化技术和 vt-d。我正在使用的 CPU:

Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz 

YouTube 视频提供了一个脚本,该脚本成功激活了我电脑上的 immo 组和 vfio 驱动程序等。以下是我的设置:

内核参数:

#cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-5.0.0-31-generic root=UUID=201e3f7e-8635-4c23-89a1-89164302f8b2 ro quiet splash intel_iommu=on iommu=pt kvm.ignore_msrs=1 vt.handoff=1

我的 NVIDIA 显卡使用的 Vfio 驱动程序:

#lspci -k | grep -i vga -A 2
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
    Subsystem: Micro-Star International Co., Ltd. [MSI] HD Graphics 630
    Kernel driver in use: i915
--
01:00.0 VGA compatible controller: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile] (rev a1)
    Subsystem: Micro-Star International Co., Ltd. [MSI] GP106M [GeForce GTX 1060 Mobile]
    Kernel driver in use: vfio-pci
root@estov-GE62VR-7RF:/home/estov# lspci -k | grep -i vga -A 3
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
    Subsystem: Micro-Star International Co., Ltd. [MSI] HD Graphics 630
    Kernel driver in use: i915
    Kernel modules: i915
--
01:00.0 VGA compatible controller: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile] (rev a1)
    Subsystem: Micro-Star International Co., Ltd. [MSI] GP106M [GeForce GTX 1060 Mobile]
    Kernel driver in use: vfio-pci
    Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia

加载Vfio和kvm模块:


# lsmod | grep -i vfio
vfio_mdev              16384  0
mdev                   24576  2 kvmgt,vfio_mdev
vfio_pci               49152  0
vfio_virqfd            16384  1 vfio_pci
irqbypass              16384  2 vfio_pci,kvm
vfio_iommu_type1       28672  0
vfio                   32768  4 kvmgt,vfio_mdev,vfio_iommu_type1,vfio_pci


lsmod | grep -i kvm
kvmgt                  28672  0
mdev                   24576  2 kvmgt,vfio_mdev
kvm_intel             245760  0
kvm                   634880  2 kvmgt,kvm_intel
irqbypass              16384  2 vfio_pci,kvm
vfio                   32768  4 kvmgt,vfio_mdev,vfio_iommu_type1,vfio_pci

IOMMU 组:

IOMMU Group 0:
    00:00.0 Host bridge [0600]: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers [8086:5910] (rev 05)
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)
    01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile] [10de:1c20] (rev a1)
    01:00.1 Audio device [0403]: NVIDIA Corporation GP106 High Definition Audio Controller [10de:10f1] (rev a1)
IOMMU Group 10:
    02:00.0 Network controller [0280]: Intel Corporation Dual Band Wireless-AC 3168NGW [Stone Peak] [8086:24fb] (rev 10)
IOMMU Group 11:
    03:00.0 Ethernet controller [0200]: Qualcomm Atheros Killer E2500 Gigabit Ethernet Controller [1969:e0b1] (rev 10)
IOMMU Group 12:
    04:00.0 USB controller [0c03]: ASMedia Technology Inc. ASM1142 USB 3.1 Host Controller [1b21:1242]
IOMMU Group 2:
    00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 630 [8086:591b] (rev 04)
IOMMU Group 3:
    00:14.0 USB controller [0c03]: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller [8086:a12f] (rev 31)
    00:14.2 Signal processing controller [1180]: Intel Corporation 100 Series/C230 Series Chipset Family Thermal Subsystem [8086:a131] (rev 31)
IOMMU Group 4:
    00:16.0 Communication controller [0780]: Intel Corporation 100 Series/C230 Series Chipset Family MEI Controller #1 [8086:a13a] (rev 31)
IOMMU Group 5:
    00:17.0 SATA controller [0106]: Intel Corporation HM170/QM170 Chipset SATA Controller [AHCI Mode] [8086:a103] (rev 31)
IOMMU Group 6:
    00:1c.0 PCI bridge [0604]: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #1 [8086:a110] (rev f1)
IOMMU Group 7:
    00:1c.3 PCI bridge [0604]: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #4 [8086:a113] (rev f1)
IOMMU Group 8:
    00:1c.4 PCI bridge [0604]: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #5 [8086:a114] (rev f1)
IOMMU Group 9:
    00:1f.0 ISA bridge [0601]: Intel Corporation HM175 Chipset LPC/eSPI Controller [8086:a152] (rev 31)
    00:1f.2 Memory controller [0580]: Intel Corporation 100 Series/C230 Series Chipset Family Power Management Controller [8086:a121] (rev 31)
    00:1f.3 Audio device [0403]: Intel Corporation CM238 HD Audio Controller [8086:a171] (rev 31)
    00:1f.4 SMBus [0c05]: Intel Corporation 100 Series/C230 Series Chipset Family SMBus [8086:a123] (rev 31)

如果有人能帮助我摆脱痛苦,那就太好了。提前谢谢

答案1

我绝对不确定笔记本电脑是否是 IOMMU 功能的最佳选择。许多制造商仅提供 BIOS 设置,可能没有这种选项。另外,不要将用于虚拟化的 VTX-x 与用于允许处理器绕过 PCI-E 的 IOMMU 功能混用。

我帮您仔细检查了一下,很遗憾 i7-7700HQ 没有 IOMMU。恐怕找不到适合您的解决方案。

https://en.wikipedia.org/wiki/List_of_IOMMU-supporting_hardware#CPUs

编辑:你应该考虑阅读这份非常好的文档: https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF

相关内容