环境

适用于12代和13代 Intel CPU,试验CPU为 i5-1340p。

PVE系统版本8以上,Linux内核6以上。

OS: Proxmox VE bookworm 8.3.3 x86_64

Kernel: Linux 6.8.12-8-pve

步骤

更新并安装必要组件

apt update && apt install -y pve-headers proxmox-headers-$(uname -r) pve-headers-$(uname -r) dkms sysfsutils

准备使用这个库构建驱动

git clone https://github.com/strongtz/i915-sriov-dkms.git && cd i915-sriov-dkms && vim dkms.conf

修改对应条目为下面所示

PACKAGE_NAME="i915-sriov-dkms"
PACKAGE_VERSION="6.8.12-4"

执行下列命令

dkms add .
KERNEL=$(uname -r)
KERNEL=${KERNEL%-pve}
cd /usr/src/i915-sriov-dkms-$KERNEL

可以使用下面的命令查看对应版本是否已经添加

dkms status

构建驱动

dkms install -m i915-sriov-dkms -v $KERNEL -k $(uname -r) --force -j 1

**构建完成后修改 **/etc/sysfs.conf 文件内容,添加下面的配置进文件

devices/pci0000:00/0000:00:02.0/sriov_numvfs = 7

这里的 7 指的是虚拟显卡的数量,可以设定为1 到 7 的数值

修改 grub 文件

vim /etc/default/grub

修改内容如下

GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt pcie_acs_override=downstream,multifunction i915.enable_guc=3 i915.max_vfs=7"

更新配置并重启

update-grub
update-initramfs -u
reboot

验证

**重启完后执行 **lspci 列出 PCI 设备,如果看到有多个 VGA 字样则说明开启成功,如下

$lspci
00:00.0 Host bridge: Intel Corporation Raptor Lake-P/U 4p+8e cores Host Bridge/DRAM Controller
00:02.0 VGA compatible controller: Intel Corporation Raptor Lake-P [Iris Xe Graphics] (rev 04)
00:02.1 VGA compatible controller: Intel Corporation Raptor Lake-P [Iris Xe Graphics] (rev 04)
00:02.2 VGA compatible controller: Intel Corporation Raptor Lake-P [Iris Xe Graphics] (rev 04)
00:02.3 VGA compatible controller: Intel Corporation Raptor Lake-P [Iris Xe Graphics] (rev 04)
00:02.4 VGA compatible controller: Intel Corporation Raptor Lake-P [Iris Xe Graphics] (rev 04)
00:02.5 VGA compatible controller: Intel Corporation Raptor Lake-P [Iris Xe Graphics] (rev 04)
00:02.6 VGA compatible controller: Intel Corporation Raptor Lake-P [Iris Xe Graphics] (rev 04)
00:02.7 VGA compatible controller: Intel Corporation Raptor Lake-P [Iris Xe Graphics] (rev 04)
00:04.0 Signal processing controller: Intel Corporation Raptor Lake Dynamic Platform and Thermal Framework Processor Participant
00:06.0 PCI bridge: Intel Corporation Raptor Lake PCIe 4.0 Graphics Port
00:08.0 System peripheral: Intel Corporation GNA Scoring Accelerator module
00:0a.0 Signal processing controller: Intel Corporation Raptor Lake Crashlog and Telemetry (rev 01)
00:14.0 USB controller: Intel Corporation Alder Lake PCH USB 3.2 xHCI Host Controller (rev 01)
00:14.2 RAM memory: Intel Corporation Alder Lake PCH Shared SRAM (rev 01)
00:14.3 Network controller: Intel Corporation Raptor Lake PCH CNVi WiFi (rev 01)
00:15.0 Serial bus controller: Intel Corporation Alder Lake PCH Serial IO I2C Controller #0 (rev 01)
00:15.1 Serial bus controller: Intel Corporation Alder Lake PCH Serial IO I2C Controller #1 (rev 01)
00:16.0 Communication controller: Intel Corporation Alder Lake PCH HECI Controller (rev 01)
00:17.0 SATA controller: Intel Corporation Alder Lake-P SATA AHCI Controller (rev 01)
00:1c.0 PCI bridge: Intel Corporation Device 51be (rev 01)
00:1f.0 ISA bridge: Intel Corporation Raptor Lake LPC/eSPI Controller (rev 01)
00:1f.3 Audio device: Intel Corporation Raptor Lake-P/U/H cAVS (rev 01)
00:1f.4 SMBus: Intel Corporation Alder Lake PCH-P SMBus Host Controller (rev 01)
00:1f.5 Serial bus controller: Intel Corporation Alder Lake-P PCH SPI Controller (rev 01)
01:00.0 Non-Volatile memory controller: Micron/Crucial Technology P2 [Nick P2] / P3 / P3 Plus NVMe PCIe SSD (DRAM-less) (rev 01)
02:00.0 Ethernet controller: Intel Corporation Ethernet Controller I225-V (rev 03)