PVE - allinone教程:OpenWrt, 核显SR-IOV, 飞牛fnOS, Windows10

一,准备工作

1,一台小主机和安装启动U盘

主机可以是n100及以后版本,我的是n150,安装时搭配显示器,键盘和鼠标,安装完PVE留网线即可

2,bois设置

  • intel主板开启VT,VT-D,来电自启动和选择U盘启动
  • AMD主板开启IOMMU,SVM,来电自启动和选择U盘启动
  • 开启硬盘热拔插
  • 开启Above4G,SR-IOV
  • 开启网络唤醒
  • 打开UEFI引导,关闭CSM兼容模式(DG1等纯UEFI类的显卡需要)

3,软件

二,安装PVE

安装简单,都是下一步下一步的操作,注意国家选china,邮箱修改一下,假如多网卡记录一下网卡的mac地址,这能避免以后用错。

我的配置

  • PVE IP:192.168.200.6/24 (网段和IP按照自己的喜好设置即可)

    子网掩码:255.255.255.0
    网关:192.168.200.1
    DNS:192.168.200.1

    密码:123456

安装后登陆地址(登录电脑需在同网段):https://192.168.200.6:8006
用户名:root
密码:123456

安装完成后拔出启动U盘

三,给PVE的扩容(可忽略此项)

前提是网线需两位,与自己电脑在同网段

移除local-lvm可能会影响PVE的部分快照功能。

在PVE的shell里边输入:

1
lvremove pve/data

点击y后,再输入:

1
lvextend -l +100%FREE -r pve/root

再点击PVE左侧栏的数据中心存储local-lvm移除,再双击local,把内容里的所有选项都选中确定后保存即可。

四,去除PVE无有效订阅提示(可忽略此项)

这个提示就是进入PVE后台后的那个弹窗,嫌碍事就去除它。

pve8+版本执行:

1
sed -i.backup -z "s/res === null || res === undefined || \!res || res\n\t\t\t.data.status.toLowerCase() \!== 'active'/false/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js && systemctl restart pveproxy.service

五,PVE换国内源

目前使用DG1直通硬解的目前不要进行换源,更新PVE配置后DG1直通后无法驱动!!

换源需要联网,要确保在联网状态 , 用ping测试网络,ping google.com ,如果ping不通,就修改PVE的网关和DNS

国内较快的源地址:

1,简单方式换国内源

  • 备份源文件

    1
    cp /etc/apt/sources.list /etc/apt/sources.list.backup
  • 添加源,复制粘贴下边一整段,敲回车

    1
    2
    3
    4
    5
    6
    7
    8
    9
    cat <<EOF > /etc/apt/sources.list
    deb http://mirrors.ustc.edu.cn/debian/ bookworm main non-free-firmware
    deb-src http://mirrors.ustc.edu.cn/debian/ bookworm main non-free-firmware

    deb https://mirrors.ustc.edu.cn/debian-security bookworm-security main contrib

    deb http://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free-firmware
    deb-src http://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free-firmware
    EOF

    接着复杂粘贴下边这段敲回车

    1
    echo "deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bookworm pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
  • 屏蔽企业源

    1
    sed -i 's/^deb https:\/\/enterprise.proxmox.com\/debian\/pve/#deb https:\/\/enterprise.proxmox.com\/debian\/pve/' /etc/apt/sources.list.d/pve-enterprise.list
  • 屏蔽 Ceph 源

    1
    sed -i 's/^deb https:\/\/enterprise.proxmox.com\/debian\/ceph-quincy/#deb https:\/\/enterprise.proxmox.com\/debian\/ceph-quincy/' /etc/apt/sources.list.d/ceph.list
  • 更新源

    1
    apt-get update

完成后注意检查有没报错

更新生效:

1
apt update && apt dist-upgrade -y

重启服务:

1
systemctl restart pvedaemon.service

重启PVE

1
reboot

2,稍微复杂的方式换国内源

  • 备份源文件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
    5
    #清华源:
    deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
    deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
    deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
    deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
    1
    2
    3
    4
    5
    #中科大源:
    deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
    deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
    deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
    deb https://mirrors.ustc.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware

    按Ctrl+X -> Y – >回车退出。

  • 编辑企业源

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

    原句前加#注释掉自带源(注意二选一,不是全选):

    1
    2
    #清华源
    deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bookworm pve-no-subscription
    1
    2
    #中科大源
    deb https://mirrors.ustc.edu.cn/proxmox/debian bookworm pve-no-subscription

    按Ctrl+X -> Y – >回车退出。

修复源401错误,原句前加#注释掉(若无401错误可忽略):

1
nano /etc/apt/sources.list.d/ceph.list

添加中科大ceph源:

1
deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-quincy bookworm no-subscription

按Ctrl+X -> Y – >回车退出。

更新生效:

1
apt update && apt dist-upgrade -y

重启服务:

1
systemctl restart pvedaemon.service

重启PVE

1
reboot

六,开启核显SR-IOV

开启SR-IOV项目地址:https://github.com/strongtz/i915-sriov-dkms

开始下边工作前需要检查PVE的版本号,因为项目对PVE的版本有要求

查询版本

1
pveversion

输出内容如下

1
pve-manager/8.2.4/faa83925c9641325(running kernel: 6.8.4-3-pve)   # 看到内核版本是6.8.4,是在项目能运行的范围内

假如版本太新,不在范围内,看自己能运行的版本,看下边代码

1
proxmox-boot-tool kernel list

输出

1
2
3
4
5
Automatically selected kernels:
6.5.13-5-pve
6.8.4-3-pve
6.8.8-2-pve
root@VUModule:~#

假如输出内容有达到要求的内核,那就固化一下就可以,不是话就要降级内核了,这方面可以看这节的C部分

A,准备工作

1,开启IOMMU直通功能

1
sed -i '/^GRUB_CMDLINE_LINUX_DEFAULT/c\GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt pcie_acs_override=downstream i915.enable_guc=3 i915.max_vfs=4"' /etc/default/grub

“4”表示我添加4个虚拟核显,最多可以7个

或者使用下边代码

1
sed -i '/^GRUB_CMDLINE_LINUX_DEFAULT/c\GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt pcie_acs_override=downstream,multifunction i915.enable_guc=3 i915.max_vfs=4"' /etc/default/grub

intel_iommu=on 开启intel的iommu

pcie_acs_override=downstream IOMMU分组补丁,用于将设备分组分的更开一点,如果使用这段代码仍然无法分开iommu组,可以尝试使用这段:pcie_acs_override=downstream,multifunction

2,增加虚拟化驱动,加载vifo系统模块

1
echo -e "vfio\nvfio_iommu_type1\nvfio_pci\nvfio_virqfd" | tee -a /etc/modules

3,屏蔽显卡驱动

1
nano  /etc/modprobe.d/blacklist.conf 

如果你之前配置过这步,进去全部删除,如果没有配置过就不管

4,更新Grub引导配置和initramfs

1
2
update-grub
update-initramfs -u -k all

5,重启PVE

1
reboot

B,配置开启SR-IOV虚拟化核显

1,安装编译环境依赖

1
apt-get install --no-install-recommends git mokutil sysfsutils -y
1
apt install --reinstall dkms -y

2,添加一个临时的KERNEL环境变量

1
KERNEL=$(uname -r); KERNEL=${KERNEL%-pve}

3,克隆项目

1
git clone https://github.com/strongtz/i915-sriov-dkms.git
1
cd i915-sriov-dkms/
1
sed -i 's/"@_PKGBASE@"/"i915-sriov-dkms"/g' ~/i915-sriov-dkms/dkms.conf
1
sed -i "s/^PACKAGE_VERSION=.*/PACKAGE_VERSION=\"$KERNEL\"/" ~/i915-sriov-dkms/dkms.conf

4,检查dkms.conf 配置文件中是否配置正确的内核版本和i915-sriov-dkms

1
cat ~/i915-sriov-dkms/dkms.conf

5,创建目录的符号链接到/usr/src/目录下

1
dkms add .

6,进入到链接到的目录

1
cd /usr/src/i915-sriov-dkms-$KERNEL

7,查看已安装的 DKMS 模块及其状态

1
dkms status

8,开始编译内核加入i915-sriov驱动

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

编译过程时间稍长,需要等待

9,完成后再次检查编译是否成功

1
dkms status

10,查询当前核显ID

1
lspci | grep VGA

正常应该输出以下内容

1
00:02.0 VGA compatible controller: Intel Corporation Alder Lake-N (UHD Graphics)

输出显示00:02.0,完整的PCI地址0000:00:02.0

11,修改下面代码的核显ID和虚拟核显数

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

​ # 0000:00:02.0 这个修改为你的ID

# sriov_numvfs = 4,默认最大值是7,可以小于7,不要超过7,我写4足够用了

12,重启PVE

1
reboot

13,重启后检查是否开启成功

1
lspci | grep VGA

正常应该输出下边内容

1
2
3
4
5
0000:00:02.0 VGA compatible controller: Intel Corporation Alder Lake-N (UHD Graphics)  # 这是实际显卡,添加pcie设备的时候不要选这个,其它的都可以选,但每个虚拟机只能选一个
0000:00:02.1 VGA compatible controller: Intel Corporation Alder Lake-N (UHD Graphics)
0000:00:02.2 VGA compatible controller: Intel Corporation Alder Lake-N (UHD Graphics)
0000:00:02.3 VGA compatible controller: Intel Corporation Alder Lake-N (UHD Graphics)
0000:00:02.4 VGA compatible controller: Intel Corporation Alder Lake-N (UHD Graphics)

硬件那里添加pcie设备的时候不要选实际显卡,其它的都可以选,但每个虚拟机只能选一个

备注:

1
2
3
4
sudo -i # 输入密码切换到root账户
dmesg | grep i915 # 看看是否有报错等输出
ls /dev/dri # 看看是否有 card0 renderD128 这种节点
lspci -vd 8086:4908 # 看看是否所有的BAR都分配了地址,如果有BAR没有分配到地址,请回bios中开启Above4G选项。

C,其它,可以不理会

1,PVE直通(如果是直接安装飞牛的可以忽略这一步)

PVE环境下DG1直通不是很稳定,容易出现机器死机等情况,建议更换皮蛋熊定制的PVE内核,皮蛋熊修改过两款内核,一个针对PVE7.4,一个针对于PVE8.2

2,安装指定内核

其中第一个就是更换为皮蛋熊修改过的内核,为了防止之前系统或存在同样的内核,所以先将其卸载:

1
dpkg --purge linux-tools-5.15 linux-tools-5.15-dbgsym pve-headers-5.15.131-1-pve pve-kernel-5.15.131-1-pve

卸载后我们进行安装,请注意,皮蛋熊这里提供了5.15.1316.8.4两个内核,请根据实际使用情况替换掉这里的内核地址,这里皮蛋熊使用的目录是/root/kernel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 准备内核
mkdir /root/kernel
cd /root/kernel
curl https://blog.kkk.rs/upload/5.15.131-pve-pdbear.tar.gz -o 5.15.131-pdbear.tar.gz

# 解压内核,如果是6.8.4请使用 unzip命令解压
tar -xf 5.15.131-pdbear.tar.gz

# 安装内核
cd ./5.15.131-pve
dpkg -i *.deb

# 固定启动内核版本
root@pve:~# pve-efiboot-tool kernel list
Manually selected kernels:
None.

Automatically selected kernels:
5.15.102-1-pve
5.15.131-1-pve

# 这里 5.15.131-1-pve 内核是皮蛋熊修改过的
# 这里固定内核内核为 5.15.131-1-pve
pve-efiboot-tool kernel pin 5.15.131-1-pve

# 更新下引导和ramfs
update-initramfs -u -k all
update-grub
reboot

内核安装完毕后,重启检查是否内核启动完成:

1
2
root@pve:~# uname -a
Linux pve 5.15.131-1-pve #1 SMP PVE 5.15.131-2 (2023-11-14T11:32Z) x86_64 GNU/Linux

可以看到上面内核已经修改成功了,接下来我们将修改内核参数。

3,修改内核参数

下面开始修改内核参数:

1
2
# vim /etc/default/grub
# 修改 GRUB_CMDLINE_LINUX_DEFAULT
1
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on spectre_v2=off spectre_v1=off pcie_acs_override=downstream pcie_aspm=off"

上面的选项解释如下:

  1. intel_iommu=on 开启intel的iommu,这里如果是amd的处理需要修改为:amd_iommu=on
  2. spectre_v2=off spectre_v1=off两个CPU BUG的修补,是侧信道攻击,安全类BUG,但修复会导致CPU性能下降,这里我选择不修补,可根据自己情况进行选择。
  3. pcie_acs_override=downstream IOMMU分组补丁,用于将设备分组分的更开一点,如果使用这段代码仍然无法分开iommu组,可以尝试使用这段:pcie_acs_override=downstream,multifunction
  4. pcie_aspm=off 关闭PCIe硬件链路节能机制,DG1的PCIe IP不太兼容这个,建议关闭,关闭后可以运行的更为稳定。

上面选项修改完毕后,使用update-grub更新引导,并重新启动PVE系统;

重新启动后将下面脚本保存为iommu.sh,给与可执行权限chmod +x iommu.sh,并执行,即可查看iommu分组:

1
2
3
4
5
6
7
#!/bin/bash
for g in `find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V`; do \
echo "IOMMU Group ${g##*/}:"; \
for d in $g/devices/*; do \
echo -e "\t$(lspci -nns ${d##*/})"; \
done; \
done;

这里我的查看结果是:

1
./iommu.sh

回车

1
2
3
4
5
6
7
.......
IOMMU Group 17:
05:00.0 VGA compatible controller [0300]: Intel Corporation DG1 [Iris Xe Graphics] [8086:4908] (rev 01)
IOMMU Group 18:
06:00.0 Audio device [0403]: Intel Corporation Device [8086:490d]
IOMMU Group 19:
07:00.0 Memory controller [0580]: Intel Corporation Device [8086:490e]

可以发现iommu分组都划分的很开,我们需要的DG1被单独划分到17组里面。

大佬参考教程

D,官方的方式

官方地址:https://github.com/strongtz/i915-sriov-dkms

PVE主机安装步骤(测试内核6.8)

  1. 安装构建工具:

    1
    apt install build-* dkms
  2. 安装所需版本的内核和头文件:(对于未签名的内核)。

    1
    apt install proxmox-headers-6.8 proxmox-kernel-6.8
  3. 从发布页面下载 deb 包

    1
    wget -O /tmp/i915-sriov-dkms_2025.05.18_amd64.deb "https://github.com/strongtz/i915-sriov-dkms/releases/download/2025.05.18/i915-sriov-dkms_2025.05.18_amd64.deb"
  4. 使用 dpkg 安装 deb 包:dpkg -i /tmp/i915-sriov-dkms_2025.05.18_amd64.deb

    1
    dpkg -i /tmp/i915-sriov-dkms_2025.05.18_amd64.deb
  5. 一旦完成后,需要调整内核命令行:

    1
    nano /etc/default/grub

    并将更改GRUB_CMDLINE_LINUX_DEFAULTintel_iommu=on i915.enable_guc=3 i915.max_vfs=7 module_blacklist=xe,或者如果已经有其他参数则添加到它。

  6. 通过执行grub和来更新和initramfs``update-grub``update-initramfs -u

    1
    update-grub
    1
    update-initramfs -u
  7. 可选择固定内核版本并通过 更新启动配置proxmox-boot-tool

  8. 为了启用 VF,sysfs必须设置一个属性。安装sysfsutils,然后执行

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

    假设你的 iGPU 位于 00:02 总线上。如果不是,请使用

    1
    lspci | grep VGA

    来查找你的 iGPU 所在的 PCIe 总线。

  9. 重新启动系统。

    1
    reboot
  10. 当系统重新启动后,您应该会看到 02:00.1 - 02:00.7 下的 VF 数量。同样,假设您的核显位于 00:02 总线上。

  11. 您可以将 VF 直通到 LXC 或 VM。但是,切勿将PF (02:00.0)传递给VM,因为这会导致所有其他 VF 崩溃。

E,番茄科技大佬的方式

大佬地址

逐条运行下边代码

1
apt install build-* dkms git sysfsutils -y
1
apt install proxmox-headers-$(uname -r) proxmox-kernel-$(uname -r)
1
cd ~

clone代码库(此处需要pve连接github,可试试修改DNS,比如8.8.8.8,8.8.4.4等)

1
git clone https://github.com/strongtz/i915-sriov-dkms.git
1
安装sriov模块,请逐条运行:

安装sriov模块,请逐条运行:

1
cd ~/i915-sriov-dkms
1
dkms add .

这里记录出现的i915-sriov-dkms版本号,比如此时示范时如上图所示版本号为“2025.05.18(该版本号会变,请以你的实际版本为准),将下面这行代码中的汉字替换为你的版本号再运行代码:

1
dkms install -m i915-sriov-dkms -v 把这里换成版本号 --force

修改后

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

回车后编辑,需要一些时间

完成后编辑 grub 配置文件

1
nano /etc/default/grub

quiet 后添加i915.enable_guc=3 i915.max_vfs=7的“7”表示可以添加7个虚拟核显(最多7个):

1
i915.enable_guc=3 i915.max_vfs=7

键盘组合键ctrl+x再输入y 回车保存退出

更新grub和initramfs

1
update-grub 
1
update-initramfs -u

查看当前核显ID,并记录:

1
lspci | grep VGA

将上面记录的核显ID替换下面代码中的0000:00:02.0(有可能没有显示0000:,下面的代码中补全即可),sriov_numvfs = 3 中的 3 是需要虚拟的核显数量,不能大于7(前边设置的7),添加数量越多同时使用时核显性能越弱,大家按需选择,我这里设置为3:

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

重启在PVE的Shell中输入以下命令查看SR-IOV核显直通是否成功:

1
lspci | grep VGA

1
lspci | grep -i vga

输出以下数据,表示成功

1
2
3
4
0000:00:02.0 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
0000:00:02.1 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
0000:00:02.2 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
0000:00:02.3 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)

⚠️ ⚠️ 也可输入以下代码包含pci ID 信息

1
lspci -nn | grep -i vga

结果 含 pci ID (8086:46d4)

1
2
3
4
5
00:02.0 VGA compatible controller [0300]: Intel Corporation Alder Lake-N [Intel Graphics] [8086:46d4]
00:02.1 VGA compatible controller [0300]: Intel Corporation Alder Lake-N [Intel Graphics] [8086:46d4]
00:02.2 VGA compatible controller [0300]: Intel Corporation Alder Lake-N [Intel Graphics] [8086:46d4]
00:02.3 VGA compatible controller [0300]: Intel Corporation Alder Lake-N [Intel Graphics] [8086:46d4]
00:02.4 VGA compatible controller [0300]: Intel Corporation Alder Lake-N [Intel Graphics] [8086:46d4]

⚠️ 正如你看到的,PCI ID 是一样的,可以用下边的方法改变一下,让它们不同

⚠️ pic ID改成不一样的值

创建脚本:list-i915-vfs.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash

# 默认 PF 设备地址(你可以按需修改为你自己的)
PF="0000:00:02.0"

echo "👉 正在枚举与 PF $PF 关联的 Virtual Functions..."
echo ""

for i in /sys/bus/pci/devices/$PF/virtfn*; do
[[ -e "$i" ]] || continue

# 获取 VF 的 PCI 地址
vf_path=$(readlink "$i")
vf_pci=$(basename "$vf_path")
vf_num=$(basename "$i" | sed 's/virtfn//')

# 获取 lspci 描述
lspci_desc=$(lspci -s $vf_pci | cut -d ' ' -f 1-3 --complement)

# 获取 IOMMU group
iommu_group=$(readlink /sys/bus/pci/devices/$vf_pci/iommu_group | awk -F'/' '{print $NF}')

echo "🔹 VF$vf_num:"
echo " PCI 地址 : $vf_pci"
echo " IOMMU Group : $iommu_group"
echo " 设备描述 : $lspci_desc"
echo " qm.conf 示例 : hostpci$vf_num: $vf_pci,pcie=1"
echo ""
done

将上面的内容保存为脚本文件,例如:

1
nano /usr/local/bin/list-i915-vfs.sh

给与权限

1
chmod +x /usr/local/bin/list-i915-vfs.sh

测试运行:

1
list-i915-vfs.sh

或执行脚本:

1
./list-i915-vfs.sh

实例输出如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
👉 正在枚举与 PF 0000:00:02.0 关联的 Virtual Functions...

🔹 VF0:
PCI 地址 : 0000:00:02.1
IOMMU Group : 15
设备描述 : Intel Corporation Alder Lake-N [Intel Graphics]
qm.conf 示例 : hostpci0: 0000:00:02.1,pcie=1

🔹 VF1:
PCI 地址 : 0000:00:02.2
IOMMU Group : 16
设备描述 : Intel Corporation Alder Lake-N [Intel Graphics]
qm.conf 示例 : hostpci1: 0000:00:02.2,pcie=1

...

有可以先排查是否启用了 SR-IOV 并创建了 VF

1
cat /sys/bus/pci/devices/0000:00:02.0/sriov_numvfs

如果返回的是 0,说明你还没有创建任何 VF。你可以手动创建:

1
echo 4 > /sys/bus/pci/devices/0000:00:02.0/sriov_numvfs

⚠️ 前提:内核、BIOS、驱动必须支持 SR-IOV,且已开启 IOMMU。

确认 VF 是否已创建

1
ls -l /sys/bus/pci/devices/0000:00:02.0/ | grep virtfn

如果没有任何 virtfn0, virtfn1 等项,说明 VF 尚未创建成功。

我的是成功了

1
2
3
lrwxrwxrwx 1 root root         0 Jun  1 20:49 virtfn0 -> ../0000:00:02.1
lrwxrwxrwx 1 root root 0 Jun 1 20:49 virtfn1 -> ../0000:00:02.2
lrwxrwxrwx 1 root root 0 Jun 1 20:49 virtfn2 -> ../0000:00:02.3

再次运行脚本

当你确认创建了 VF 后,再次运行脚本应该就能看到:

1
list-i915-vfs.sh

成功的结果如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
👉 正在枚举与 PF 0000:00:02.0 关联的 Virtual Functions...

🔹 VF0:
PCI 地址 : 0000:00:02.1
IOMMU Group : 15
设备描述 : controller: Intel Corporation Alder Lake-N [Intel Graphics]
qm.conf 示例 : hostpci0: 0000:00:02.1,pcie=1

🔹 VF1:
PCI 地址 : 0000:00:02.2
IOMMU Group : 16
设备描述 : controller: Intel Corporation Alder Lake-N [Intel Graphics]
qm.conf 示例 : hostpci1: 0000:00:02.2,pcie=1

🔹 VF2:
PCI 地址 : 0000:00:02.3
IOMMU Group : 17
设备描述 : controller: Intel Corporation Alder Lake-N [Intel Graphics]
qm.conf 示例 : hostpci2: 0000:00:02.3,pcie=1

运行下边代码查询释放成功

1
lspci | grep -i vga

成功的话输出以下内容

1
2
3
4
00:02.0 VGA compatible controller: Intel Corporation Alder Lake-N [Intel Graphics]
00:02.1 VGA compatible controller: Intel Corporation Alder Lake-N [Intel Graphics]
00:02.2 VGA compatible controller: Intel Corporation Alder Lake-N [Intel Graphics]
00:02.3 VGA compatible controller: Intel Corporation Alder Lake-N [Intel Graphics]

七,虚拟机安装

1,安装OpenWRT

2,安装飞牛OS

下载fnOS,官网地址:https://www.fnnas.com/

若为SR-IOV核显直通则需要借用DG1的驱动,先不带核显安装好fnOS,再手动安装驱动:

1
2
3
sudo -i # 切换root权限 
wget https://blog.kkk.rs/upload/intel-i915.deb # 下载驱动
dpkg -i intel-i915.deb # 安装驱动

驱动安装完成后关机,添加SR-IOV虚拟的核显(切记不可直通主显卡,否则所有虚拟核显消失),再开机测试硬解情况。

ssh登陆抓取如下信息:

1
2
3
4
sudo -i # 输入密码切换到root账户
dmesg | grep i915 # 看看是否有报错等输出
ls /dev/dri # 看看是否有 card0 renderD128 这种节点
lspci -vd 8086:4908 # 看看是否所有的BAR都分配了地址,如果有BAR没有分配到地址,请回bios中开启Above4G选项。

3,安装Windows 10

————————————还在测试,没完成,以后再说——————————————