我正在尝试让 GPU 直通在虚拟机上工作。我一直在关注这个视频https://www.youtube.com/watch?v=6FI31QDtyy4。我和他在视频中所做的区别在于 mkinitcpio 配置中的模块,我使用“MODULES=(vfio_pci vfio vfio_iommu_type1 vfio_virqfd)”代替,因为视频有点过时。
所以我所做的是
- 在 grub 参数中添加 intel_iommu=on
- 检查我的系统是否支持 IOMMU,我运行了 'dmesg | grep -e DMAR -e IOMMU'
- 将“选项 vfio-pci ids=10de:10f0,10de:1b81”添加到 vfio.conf
- 如上所述修改 mkinitcpio.conf
- 运行“mkinitcpio -p linux”
- 修改qemu.conf(可能不相关)
- 运行“systemctl启用--now libvirtd”和“systemctl启用virtlogd.socket”
- 重新启动并返回到 Windows 10(不是双引导。我正在 USB 棒上运行 arch(不是实时 USB))(尝试添加虚拟机,但失败了,因为我没有执行 ntfs-3g 操作)
- 从 Windows 10 回来并在 fstab 中添加了“UUID=061A04D11A04C023 /media/Data/ ntfs-3g defaults 0 0”
- 将 /etc/default/grub 中的 'GRUB_CMDLINE_LINUX_DEFAULT="quiet"' 更改为 'GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"'
- 重新启动并卡在“正在加载版本 240”(当我从参数中删除 intel_iommu=on 时,它启动得很好)
iommu 工作的第一次启动,我使用 GPU 作为输出。 GPU 在上次启动时无法工作(无信号)后,我尝试了 iGPU。我还检查了Arch关于PCI直通的官方wiki,步骤非常相似
/etc/mkinitcpio.conf:
# vim:set ft=sh
# MODULES
# The following modules are loaded before any boot hooks are
# run. Advanced users may wish to specify all system modules
# in this array. For instance:
# MODULES=(piix ide_disk reiserfs)
MODULES=(vfio_pci vfio vfio_iommu_type1 vfio_virqfd)
# BINARIES
# This setting includes any additional binaries a given user may
# wish into the CPIO image. This is run last, so it may be used to
# override the actual binaries included by a given hook
# BINARIES are dependency parsed, so you may safely ignore libraries
BINARIES=()
# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in any way. This is useful for config files.
FILES=()
# HOOKS
# This is the most important setting in this file. The HOOKS control the
# modules and scripts added to the image, and what happens at boot time.
# Order is important, and it is recommended that you do not change the
# order in which HOOKS are added. Run 'mkinitcpio -H <hook name>' for
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
# 'udev' is _required_ in order to automatically load modules
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
## This setup specifies all modules in the MODULES setting above.
## No raid, lvm2, or encrypted root is needed.
# HOOKS=(base)
#
## This setup will autodetect all modules for your system and should
## work as a sane default
# HOOKS=(base udev autodetect block filesystems)
#
## This setup will generate a 'full' image which supports most systems.
## No autodetection is done.
# HOOKS=(base udev block filesystems)
#
## This setup assembles a pata mdadm array with an encrypted root FS.
## Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
# HOOKS=(base udev block mdadm encrypt filesystems)
#
## This setup loads an lvm2 volume group on a usb device.
# HOOKS=(base udev block lvm2 filesystems)
#
## NOTE: If you have /usr on a separate partition, you MUST include the
# usr, fsck and shutdown hooks.
HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)
# COMPRESSION
# Use this to compress the initramfs image. By default, gzip compression
# is used. Use 'cat' to create an uncompressed image.
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
#COMPRESSION="xz"
#COMPRESSION="lzop"
#COMPRESSION="lz4"
# COMPRESSION_OPTIONS
# Additional options for the compressor
#COMPRESSION_OPTIONS=()
/etc/modprobe.d/vfio.conf:
options vfio-pci ids=10de:10f0,10de:1b81
内核版本: 4.20.10-arch1-1-ARCH
硬件信息 (lshw):
cube-arch
description: Desktop Computer
product: B360M-HD3 (Default string)
vendor: Gigabyte Technology Co., Ltd.
version: Default string
serial: Default string
width: 4294967295 bits
capabilities: smbios-3.1 dmi-3.1 smp vsyscall32
configuration: boot=normal chassis=desktop family=Default string sku=Default string uuid=E002D503-5E04-7905-ED06-310700080009
*-core
description: Motherboard
product: B360M HD3
vendor: Gigabyte Technology Co., Ltd.
physical id: 0
version: x.x
serial: Default string
slot: Default string
*-firmware
description: BIOS
vendor: American Megatrends Inc.
physical id: 0
version: F4
date: 04/19/2018
size: 64KiB
capacity: 15MiB
capabilities: pci upgrade shadowing cdboot bootselect socketedrom edd int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int14serial int17printer acpi usb biosbootspecification uefi
*-memory
description: System Memory
physical id: 3a
slot: System board or motherboard
size: 16GiB
*-bank:0
description: DIMM DDR4 Synchronous 2133 MHz (0.5 ns)
product: F4-3000C16-8GISB
vendor: Fujitsu
physical id: 0
serial: 00000000
slot: ChannelA-DIMM0
size: 8GiB
width: 64 bits
clock: 2133MHz (0.5ns)
*-bank:1
description: [empty]
physical id: 1
slot: ChannelA-DIMM1
*-bank:2
description: DIMM DDR4 Synchronous 2133 MHz (0.5 ns)
product: F4-3000C16-8GISB
vendor: Fujitsu
physical id: 2
serial: 00000000
slot: ChannelB-DIMM0```
答案1
解决了
我很笨,我将显示器插入 GPU,插入 iGPU 后就可以了。确保将其设置为 BIOS 中的主要输出