1306025608 发表于 2023-9-4 15:51:33

n6000在pve下实现win核显直通

一、PVE换源:
1、更换为国内清华源:
将自带的源文件sources.list备份
cp /etc/apt/sources.list /etc/apt/sources.list_bak

编辑sources.list
nano /etc/apt/sources.list

粘贴一下内容
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
ctrl+xy 回车保存退出

编辑pve企业源:
nano /etc/apt/sources.list.d/pve-enterprise.list
将其中原有的proxmox句首加# 注释掉,变为:#deb https://enterprise.proxmox.com/debian/pve bullseye pve-enterprise
添加以下清华源:
deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bullseye pve-no-subscription
ctrl+xy 回车保存退出

更新并升级
apt update && apt dist-upgrade -y

二、安装依赖
apt install iucode-tool -y

三、安装英特尔微码intel-microcode
打开清华镜像服务器,找到最新的intel-microcode
https://mirrors.tuna.tsinghua.ed ... /i/intel-microcode/

我用的的是:3月26日发布的intel-microcode_3.20230214.1~deb11u1_amd64.deb最新的可以自己下载

下载并安装
wget https://mirrors.tuna.tsinghua.ed ... 1~deb11u1_amd64.deb
dpkg -i intel-microcode_3.20230214.1~deb11u1_amd64.deb

重启reboot

查看安装结果
dpkg -l intel-microcode
安装位置
dpkg -L intel-microcode

查看安装微码版本:
dmesg -T | grep microcode或者grep 'stepping\|model\|microcode' /proc/cpuinfo

——————————————————————————————————————————————————————————————————
升级6.2内核、headers和firmware
apt update
apt install -y pve-kernel-6.2.9-1-pve pve-headers-6.2.9-1-pve pve-firmware
重启reboot
——————————————————————————————————————————————————————————————————

四、PVE直通设置(在PVE-Shell中运行)
nano /etc/default/grub
修改以下内容
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"
ctrl+x 点y 回车保存退出

update-grub 更新grub配置

nano /etc/modules
添加以下内容,做好直通及其他相关设置准备
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
ctrl+x 点y 回车保存退出

创建配置文件:
echo "options vfio-pci disable_vga=1" > /etc/modprobe.d/vfio.conf

刷新initramfs
update-initramfs -u -k all

reboot 重启PVE

五、虚拟机Windows设置
建立Win虚拟机,BIOS设置为Seabios,机型i440fx(注意:安装Win系统时不要直通核显和声卡)
Win系统安装完成后,安装VirtIO驱动(最新版VirtIO的驱动ISO文件 https://fedorapeople.org/groups/ ... oads/latest-virtio/)
开启远程桌面,并测试可以正常远程桌面登录虚拟Win。先做好Windows更新补丁然后重启虚拟Win,确保进入系统不再需要更新补丁后关闭虚拟Win。

核显直通设置
修改Win虚拟机设置,添加直通核显、声卡(如仅需核显硬解,则无需添加usb键盘鼠标等)
n6000的核显和声卡id分别为 0000:00:02.0 和 0000:00:1f.3(具体可以查看PCI设备列表,如无名称显示可以输入lspci命令查看)
显示设置为 无none

下载 vbios文件(链接:https://pan.baidu.com/s/1QKeJMM_uOgRPPCTULJldog
提取码:6666)
使用Shell工具(FinalShell,WinSCP等)将此vbios文件上传至PVE目录 /usr/share/kvm/ 下

编辑conf
nano /etc/pve/qemu-server/100.conf

添加命令:
args: -set device.hostpci0.addr=02.0 -set device.hostpci0.x-igd-gms=1 -set device.hostpci0.x-igd-opregion=on
修改直通核显一行如下:
hostpci0: 0000:00:02.0,legacy-igd=1,romfile=vbios_gvt_n6000.efi
(注意:即便是不需要HDMI显示输出,也要添加以上vbios和args设置,否则直通核显不成功)


在成功登录虚拟Win远程桌面后,设备管理器中查看到直通过来的核显(此时未装驱动),通过下载更新来安装核显驱动(链接:https://pan.baidu.com/s/1Hj9NOAkRVZkedWqer0XLjA
提取码:6666),安装完成后重启虚拟Win,如核显驱动安装成功插上HDMI显示器可以看到画面(出现花屏的情况需要重启虚拟机,第二次不行再重启几次,如果还是不行,“conf添加命令”这步删除原来配置的命令重新添加)。

风之藏马 发表于 2024-2-5 14:06:34

想问一下大佬,这样的方式核显可以直通,那声卡能直通吗?声卡是否可以工作正常?
页: [1]
查看完整版本: n6000在pve下实现win核显直通