PVE8.2下N100的SRIOV核显虚拟化步骤存档

前言

满久前买了一个N100的工控机回来玩,昨天给我玩崩了,所以重装了整个机器,然后丢失了SRIOV虚拟核显。正好blog上个月恢复了,那就在这里留一个存档 防止我以后玩崩了,又要去网上翻。

删除原有文件(可选)

#如果原来已经安装过相关虚拟核显的 需要删除后重建
#主要是内核更新了 或者作者版本更新
#根据自己的路径删除dkms文件、usr src文件以及源文件
rm -rf /var/lib/dkms/i915-sriov-dkms*
rm -rf /usr/src/i915-sriov-dkms*
rm -rf ~/i915-sriov-dkms

安装依赖

apt update
apt install build-* dkms git mokutil 

升级或降级内核 并固定内核(可选)

#由于驱动作者并不一定会随着PVE的更新而适配最新的内核版本
#所以需要查看作者在github贴出来的适配范围
#2024-08-03
目前适配pve-kernel-6.1.0-1-pve ~ 6.2.9-1-pve, proxmox-kernel-6.5.13-3-pve ~ 6.8.8-2-pve


apt install -y proxmox-kernel-6.8.8-2-pve-signed pve-headers-6.8.8-2-pve pve-firmware

#若当前内核已在支持列表则需要安装对应版本头
KERNEL_VERSION=$(uname -r)
sudo apt install proxmox-kernel-headers-${KERNEL_VERSION}

编译i915-sriov驱动

cd ~
git clone https://github.com/strongtz/i915-sriov-dkms.git
cd ~/i915-sriov-dkms
cp -a ~/i915-sriov-dkms/dkms.conf{,.bak}
dkms add .

#开始编译
dkms install -m i915-sriov-dkms -v $(cat VERSION) --force

#检查是否安装
dkms status

修改GRUB启动参数 打开iommu组 直通PCI

vim /etc/default/grub
#修改GRUB_CMDLINE_LINUX_DEFAULT内容如下
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt i915.enable_guc=3 i915.max_vfs=7"

#添加驱动 实现PCI直通
vim /etc/modules
#添加如下
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd

#更新GRUB
update-grub
update-initramfs -u

启动VFs

apt install sysfsutils -y

#查看核显iommu组序列 如:00:02.0
lspci | grep VGA

#根据组序列以及需求配置需要虚拟的核心数量 N100最多3
echo "devices/pci0000:00/0000:00:02.0/sriov_numvfs = 3" > /etc/sysfs.conf

重启检查是否虚拟成功

reboot

root@pve:~# lspci
00:00.0 Host bridge: Intel Corporation Device 461c
00:02.0 VGA compatible controller: Intel Corporation Alder Lake-N [UHD Graphics] #主物理核显
00:02.1 VGA compatible controller: Intel Corporation Alder Lake-N [UHD Graphics] #虚拟核显1
00:02.2 VGA compatible controller: Intel Corporation Alder Lake-N [UHD Graphics] #虚拟核显2
00:02.3 VGA compatible controller: Intel Corporation Alder Lake-N [UHD Graphics] #虚拟核显3
00:14.0 USB controller: Intel Corporation Device 54ed
00:14.2 RAM memory: Intel Corporation Device 54ef
00:16.0 Communication controller: Intel Corporation Device 54e0
00:1a.0 SD Host controller: Intel Corporation Device 54c4
00:1c.0 PCI bridge: Intel Corporation Device 54b8
00:1c.6 PCI bridge: Intel Corporation Device 54be
00:1d.0 PCI bridge: Intel Corporation Device 54b0
00:1d.1 PCI bridge: Intel Corporation Device 54b1
00:1d.2 PCI bridge: Intel Corporation Device 54b2
00:1f.0 ISA bridge: Intel Corporation Device 5481
00:1f.3 Audio device: Intel Corporation Device 54c8
00:1f.4 SMBus: Intel Corporation Device 54a3
00:1f.5 Serial bus controller: Intel Corporation Device 54a4
01:00.0 Non-Volatile memory controller: Toshiba Corporation XG6 NVMe SSD Controller
02:00.0 Ethernet controller: Intel Corporation Ethernet Controller I226-V (rev 04)
03:00.0 Ethernet controller: Intel Corporation Ethernet Controller I226-V (rev 04)
04:00.0 Ethernet controller: Intel Corporation Ethernet Controller I226-V (rev 04)
05:00.0 Ethernet controller: Intel Corporation Ethernet Controller I226-V (rev 04)

注意

在直通虚拟核显时不要把主物理核显直通进去 否则虚拟核显会消失
注意直通虚拟核显不要勾选全部功能选项,会导致所有虚拟核显消失
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇