赞
踩
VT-D
gurb
,非systemd-boot
systemd-boot
,在0x02步骤中需要参考 [3] Proxmox VE Administration Guide 开启iommu功能编辑文件*/etc/default/grub*,修改GRUB_CMDLINE_LINUX_DEFAULT
字段值
如果为Intel的CPU
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"
如果为AMD的CPU
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"
VT-D
功能的内核模块打开文件/etc/modules
,新增以下4行内容
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
# 屏蔽镭龙显卡驱动
echo "blacklist radeon" >> /etc/modprobe.d/pve-blacklist.conf
# 屏蔽英伟达显卡的开源nouveau驱动
echo "blacklist nouveau" >> /etc/modprobe.d/pve-blacklist.conf
# 屏蔽英伟达显卡驱动
echo "blacklist nvidia" >> /etc/modprobe.d/pve-blacklist.conf
# 允许不安全的中断
echo "options vfio_iommu_type1 allow_unsafe_interrupts=1" > /etc/modprobe.d/iommu_unsafe_interrupts.conf
# 忽略异常,防止虚拟机异常导致宿主机崩溃
# ignore_msrs : 忽略异常
# report_ignored_msrs : 是否报告异常
echo "options kvm ignore_msrs=1 report_ignored_msrs=0" > /etc/modprobe.d/kvm.conf
ps:执行此操作后可能无法输出到外接显示器,若出现此情况,请撤回该步骤
1、查看显卡ID
root@pve:~# lspci -nn | grep VGA
# 前缀02:00.0是设备编号,最后*.0为子编号
# 末尾[10de:2489]是设备ID
02:00.0 VGA compatible controller [0300]: NVIDIA Corporation Device [10de:2489] (rev a1)
08:00.0 VGA compatible controller [0300]: Matrox Electronics Systems Ltd. G200eR2 [102b:0534] (rev 01)
root@pve:~#
N卡编号为02:00,搜索对应的设备ID和音频设备ID
root@pve:~# lspci -n -s 02:00
02:00.0 0300: 10de:2489 (rev a1)
02:00.1 0403: 10de:228b (rev a1)
root@pve:~#
或者直接以NVIDIA
为关键词搜索相关的设备,其中一个是音频
root@pve:~# lspci -nn | grep NVIDIA
02:00.0 VGA compatible controller [0300]: NVIDIA Corporation Device [10de:2489] (rev a1)
02:00.1 Audio device [0403]: NVIDIA Corporation GA104 High Definition Audio Controller [10de:228b] (rev a1)
root@pve:~#
得到显卡的设备ID和显卡内置音频设备ID为:
显卡ID
: 10de:2489音频ID
: 10de:228b2、将设备ID添加到vfio.conf
# 添加PCI设备
echo "options vfio-pci ids=10de:2489,10de:228b disable_vga=1" > /etc/modprobe.d/vfio.conf
如果无法输出到外接显示器,取消disable_vga=1
参数试试
echo "options vfio-pci ids=10de:2489,10de:228b" > /etc/modprobe.d/vfio.conf
update-grub
update-initramfs -u -k all
reboot
root@pve:~# lspci -nnk
02:00.0 VGA compatible controller [0300]: NVIDIA Corporation Device [10de:2489] (rev a1)
Subsystem: CardExpert Technology Device [10b0:153c]
Kernel driver in use: vfio-pci
Kernel modules: nvidiafb, nouveau
02:00.1 Audio device [0403]: NVIDIA Corporation GA104 High Definition Audio Controller [10de:228b] (rev a1)
Subsystem: CardExpert Technology Device [10b0:153c]
Kernel driver in use: vfio-pci
Kernel modules: snd_hda_intel
root@pve:~#
Kernel driver in use: vfio-pci
,表示应用成功完成上述步骤配置后,在PVE-web图形化端添加PCI-E设备到虚拟机中即可
ps:
1、我同时添加显卡和音频之后,开机遇报错:TASK ERROR: start failed: QEMU exited with code 1
,如果遇到同样的报错,尝试把音频设备从硬件中移除
2、我本次安装的win11,好像msdn i'tell u
下载的无法安装,建议下载官方镜像尝试,或者下载2021年8月份版本
[1] Proxmox VE 直通显卡方案及解决N卡Code43
[2] Stopped start failed: QEMU exited with code 1
[3] Proxmox VE Administration Guide
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。