inter 12代处理器PVE Sriov 流程
2023-10-03 08:14:46

一、PVE安装命令行跳过检测方法:

配置文件中创建一个设备描述

1
nano /usr/share/X11/xorg.conf.d/10-quirks.conf

 在结尾添加:

1
2
3
4
Section "Device"    
    Identifier "Card0"     
    Driver "fbdev"
EndSection

ctrl+x  y 回车保存退出

 # xinit

回车运行后会进入熟悉的PVE图形化安装界面,安装完成。

 启动PVE,进入WebUI

二、PVE换源:

1、更换为国内清华源:

将自带的源文件sources.list备份

1
cp /etc/apt/sources.list /etc/apt/sources.list_bak

 编辑sources.list

1
nano /etc/apt/sources.list

粘贴一下内容

1
2
3
4
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+x 点y 回车保存退出

编辑pve企业源:

1
nano /etc/apt/sources.list.d/pve-enterprise.list

将其中原有的proxmox句首加# 注释掉,变为:#deb https://enterprise.proxmox.com/debian/pve bullseye pve-enterprise

添加以下清华源:

1
deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bullseye pve-no-subscription

ctrl+x  y 回车保存退出

更新并升级

1
apt update && apt dist-upgrade -y

2、LXC更换为清华源:

备份APLInfo.pm

1
cp /usr/share/perl5/PVE/APLInfo.pm /usr/share/perl5/PVE/APLInfo.pm_back

更换为清华源:

1
sed -i 's|http://download.proxmox.com|https://mirrors.tuna.tsinghua.edu.cn/proxmox|g' /usr/share/perl5/PVE/APLInfo.pm

重启服务后生效

1
systemctl restart pvedaemon.service

三、升级6.2内核、headers和firmware

1
apt update
1
apt install -y pve-kernel-6.2.11-2-pve pve-headers-6.2.11-2-pve pve-firmware

重启reboot

四、编译i915-sriov驱动

安装工具

1
apt install -y build-* git dkms

拖库

1
git clone https://github.com/strongtz/i915-sriov-dkms.git
1
 cd i915-sriov-dkms
1
 nano dkms.conf

第一行改为

1
PACKAGE_NAME="i915-sriov-dkms"

第二行改为

1
PACKAGE_VERSION="6.2"

ctrl+x  y 回车保存退出

复制此文件夹到相应目录,开始编译

1
cp -r /root/i915-sriov-dkms/ /usr/src/i915-sriov-dkms-6.2

进入目录

1
cd /usr/src/i915-sriov-dkms-6.2

pve7.x执行编译命令

1
dkms install -m i915-sriov-dkms -v 6.2

pve8.0执行编译命令

1
dkms install -m i915-sriov-dkms -v 6.2 --force

 编译完成后检查状态

1
dkms status

五、设置直通和i915guc

1
nano /etc/default/grub

在quiet后添加intel_iommu=on i915.enable_guc=3 i915.max_vfs=7

改成GRUB_CMDLINE_LINUX_DEFAULT=”quiet intel_iommu=on i915.enable_guc=3 i915.max_vfs=7”

ctrl+x  y 回车保存退出

顺便把设备直通的其他操作一起做了:

1
nano /etc/modules
1
2
3
4
5
6
7
vfio

vfio_iommu_type1

vfio_pci

vfio_virqfd

更新配置

1
2
3
update-grub

update-initramfs -u

六、安装sysfsutils

1
apt install -y sysfsutils

添加以下VFs参数,N100建议最高3,可自定义数量,建议按需设置,设置1个时性能最强。

1
echo "devices/pci0000:00/0000:00:02.0/sriov_numvfs = 3" > /etc/sysfs.conf

重启reboot

lspci检查直通的虚拟显卡,显示如下:

00:02.0 VGA compatible controller: Intel Corporation Device 46d1(物理核显)

00:02.1 VGA compatible controller: Intel Corporation Device 46d1(虚拟核显1)

00:02.2 VGA compatible controller: Intel Corporation Device 46d1(虚拟核显2)

00:02.3 VGA compatible controller: Intel Corporation Device 46d1(虚拟核显3)

注意虚拟核显越多,性能越低。只需要1个时,虚拟1个核显即可。就像切西瓜,整体就这么大,人数越多每个人分到的瓜越小。

七、将虚拟核显添加到虚拟机中,如Win10/11

硬件内注意事项:

内存:4GiB (或者更多)

CPU类别:host (硬解建议给全部核心,比如N100 4cores)

BIOS:OVMF(UEFI)

显示:默认标准 核显直通后可改为无(none) *注意选择无(none)时长时间运行会出问题【VM 100 qmp command ‘set_password’ failed - Could not set password】导致虚拟Win死机时,则需改为标准VGA(std)

机型:pc-q35-7.2

PCI设备虚拟核显:安装Win时建议不添加,Win装完关机添加虚拟核显时不要勾选主GPU,安装驱动并重启后不报错工作正常后,可以更改为主GPU

Windows虚拟机

为了提高Win虚拟机的性能,建议安装VirtIO的全部驱动,iso下载地址:

https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.229-1/virtio-win-0.1.229.iso

在必须满足虚拟机配置的前提下,安装当前最新的驱动,下面2个,二选一自行测试。

英特尔® Arc™ 和锐炬® Xe 显卡 - WHQL - Windows* (intel.cn)

https://www.intel.cn/content/www/cn/zh/download/726609/intel-arc-iris-xe-graphics-whql-windows.html?

英特尔® Arc™ 和锐®炬® Xe 显卡 - BETA - Windows* (intel.cn)

https://www.intel.cn/content/www/cn/zh/download/729157/intel-arc-iris-xe-graphics-beta-windows.html

Linux虚拟机:

虚拟Ubuntu直通SRIOV核显参照以下“Linux虚拟机”部分

https://foxi.buduanwang.vip/virtualization/pve/2695.html/

虚拟Deiban直通SRIOV核显参照以下“Linux虚拟机使用pve内核–不适用全部情况”

https://foxi.buduanwang.vip/virtualization/pve/2695.html/

英特尔官网核显驱动方法https://dgpu-docs.intel.com/installation-guides/ubuntu/ubuntu-focal-legacy.html#

参考引用:

https://github.com/strongtz/i915-sriov-dkms

https://foxi.buduanwang.vip/virtualization/pve/2695.html/