支持列表
请参阅下表:
注意,11代Alchemist代号并不支持SR-IOV,也不支持GVT-g
前提条件
推荐安装pve8版本,如要正常使用11-14代核显SR-IOV,需要将内核更新到6.1以上。并在BIOS提前开启VT-d,SR-IOV,Above 4GB(如有可以开)
提示
更新日期:2024.11.24
作者的项目已经更新到支持内核 6.8 ,所以,推荐大家下载 PVE 8.3.1 最新版本安装
至于内核小于 6.5 的,这边教程就不显示了!
已经测试的支持内核范围 6.5.13-3-pve ~ 6.8.12-4-pve ,具体看项目支持情况
2024 11 24 测试情况:教程支持最新 PVE 8.3.1 内核版本: 6.8.12-4-pve
更换系统源
推荐使用pve-source一键脚本,参考这篇文章
https://www.iigeek.com/archives/1181
直通 PCIe 设备
若你是想开启核显的 SR-IOV (需要 CPU 的支持,博主使用的 i5-13600T),请使用如下命令直通 PCIE 设备:
i915.max_vfs=3 这里的 3 是需要虚拟的核显数量,需要和下面的数量相同
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=7"' /etc/default/grub
echo -e "vfio\nvfio_iommu_type1\nvfio_pci\nvfio_virqfd" | tee -a /etc/modules
update-grub
update-initramfs -u -k all
reboot
若你的 CPU 不支持 SR-IOV,或是不想开启 SR-IOV,请使用如下命令直通 PCIE 设备:
sed -i '/^GRUB_CMDLINE_LINUX_DEFAULT/c\GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt pcie_acs_override=downstream"' /etc/default/grub
echo -e "vfio\nvfio_iommu_type1\nvfio_pci\nvfio_virqfd" | tee -a /etc/modules
update-grub
update-initramfs -u -k all
reboot
检验 PCIE 直通结果
Shell 窗口输入 lspci ,回显如下(里面包含你所有的 PCIe 设备列表):
root@pve:~# lspci
0000:00:00.0 Host bridge: Intel Corporation Device 4640 (rev 02)
0000:00:01.0 PCI bridge: Intel Corporation 12th Gen Core Processor PCI Express x16 Controller #1 (rev 02)
0000:00:02.0 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
0000:00:06.0 System peripheral: Intel Corporation RST VMD Managed Controller
0000:00:0a.0 Signal processing controller: Intel Corporation Platform Monitoring Technology (rev 01)
0000:00:0e.0 RAID bus controller: Intel Corporation Volume Management Device NVMe RAID Controller
0000:00:14.0 USB controller: Intel Corporation Alder Lake-S PCH USB 3.2 Gen 2x2 XHCI Controller (rev 11)
0000:00:14.2 RAM memory: Intel Corporation Alder Lake-S PCH Shared SRAM (rev 11)
0000:00:15.0 Serial bus controller: Intel Corporation Alder Lake-S PCH Serial IO I2C Controller #0 (rev 11)
0000:00:15.1 Serial bus controller: Intel Corporation Alder Lake-S PCH Serial IO I2C Controller #1 (rev 11)
0000:00:15.2 Serial bus controller: Intel Corporation Alder Lake-S PCH Serial IO I2C Controller #2 (rev 11)
0000:00:16.0 Communication controller: Intel Corporation Alder Lake-S PCH HECI Controller #1 (rev 11)
0000:00:17.0 System peripheral: Intel Corporation RST VMD Managed Controller
0000:00:1a.0 System peripheral: Intel Corporation RST VMD Managed Controller
0000:00:1b.0 PCI bridge: Intel Corporation Device 7ac0 (rev 11)
0000:00:1c.0 PCI bridge: Intel Corporation Alder Lake-S PCH PCI Express Root Port #1 (rev 11)
0000:00:1c.2 PCI bridge: Intel Corporation Device 7aba (rev 11)
0000:00:1d.0 PCI bridge: Intel Corporation Alder Lake-S PCH PCI Express Root Port #9 (rev 11)
0000:00:1f.0 ISA bridge: Intel Corporation Z690 Chipset LPC/eSPI Controller (rev 11)
0000:00:1f.3 Audio device: Intel Corporation Alder Lake-S HD Audio Controller (rev 11)
0000:00:1f.4 SMBus: Intel Corporation Alder Lake-S PCH SMBus Controller (rev 11)
0000:00:1f.5 Serial bus controller: Intel Corporation Alder Lake-S PCH SPI Controller (rev 11)
0000:01:00.0 Ethernet controller: Intel Corporation Ethernet Controller X710 for 10GbE SFP+ (rev 02)
0000:01:00.1 Ethernet controller: Intel Corporation Ethernet Controller X710 for 10GbE SFP+ (rev 02)
0000:01:00.2 Ethernet controller: Intel Corporation Ethernet Controller X710 for 10GbE SFP+ (rev 02)
0000:01:00.3 Ethernet controller: Intel Corporation Ethernet Controller X710 for 10GbE SFP+ (rev 02)
0000:05:00.0 Ethernet controller: Intel Corporation Ethernet Controller I225-V (rev 03)
0000:06:00.0 PCI bridge: ASMedia Technology Inc. Device 1806 (rev 01)
0000:07:00.0 PCI bridge: ASMedia Technology Inc. Device 1806 (rev 01)
0000:07:02.0 PCI bridge: ASMedia Technology Inc. Device 1806 (rev 01)
0000:07:06.0 PCI bridge: ASMedia Technology Inc. Device 1806 (rev 01)
0000:07:0e.0 PCI bridge: ASMedia Technology Inc. Device 1806 (rev 01)
0000:08:00.0 Ethernet controller: Intel Corporation Ethernet Controller I226-V (rev 04)
0000:09:00.0 Ethernet controller: Intel Corporation Ethernet Controller I226-V (rev 04)
0000:0a:00.0 Ethernet controller: Intel Corporation Ethernet Controller I226-V (rev 04)
0000:0b:00.0 Ethernet controller: Intel Corporation Ethernet Controller I226-V (rev 04)
10000:e0:06.0 PCI bridge: Intel Corporation 12th Gen Core Processor PCI Express x4 Controller #0 (rev 02)
10000:e0:17.0 SATA controller: Intel Corporation Alder Lake-S PCH SATA Controller [AHCI Mode] (rev 11)
10000:e0:1a.0 PCI bridge: Intel Corporation Alder Lake-S PCH PCI Express Root Port #25 (rev 11)
10000:e0:1b.0 System peripheral: Intel Corporation RST VMD Managed Controller
10000:e0:1b.4 PCI bridge: Intel Corporation Device 7ac4 (rev 11)
10000:e1:00.0 Non-Volatile memory controller: MAXIO Technology (Hangzhou) Ltd. NVMe SSD Controller MAP1202 (rev 01)
10000:e2:00.0 Non-Volatile memory controller: MAXIO Technology (Hangzhou) Ltd. NVMe SSD Controller MAP1602 (rev 01)
10000:e3:00.0 Non-Volatile memory controller: MAXIO Technology (Hangzhou) Ltd. NVMe SSD Controller MAP1202 (rev 01)
root@pve:~#
新建虚拟机,参数随意,用于检测 PCIE 是否直通成功。
来到虚拟机的硬件界面,点击添加 PCI 设备,选择 原始设备,参看 PCIE 设备列表,查看网口是否被划分为单个设备。
开启核显的 SR-IOV
什么是SR-IOV?这里引用 Oracle 的说明
SR-IOV 技术是一种基于硬件的虚拟化解决方案,可提高性能和可伸缩性。SR-IOV 标准允许在虚拟机之间高效共享 PCIe(Peripheral Component Interconnect Express,快速外设组件互连)设备,并且它是在硬件中实现的,可以获得能够与本机性能媲美的 I/O 性能。SR-IOV 规范定义了新的标准,根据该标准,创建的新设备可允许将虚拟机直接连接到 I/O 设备。
简单来说,允许将一个PCIe设备虚拟化成多个设备,且每个虚拟化出来的设备都可以获得与物理设备相近的性能
如果显卡开启SR-IOV就可以给多台虚拟机同时配上显卡
网卡之类的设备也支持SR-IOV,但是不如显卡这么有用(毕竟虚拟化出来的网卡性能也没差多少,还不需要自己安装驱动)
在以下的 SR – IOV 设置中,请开启 PVE 的外网访问(需要访问 GitHub )
具体命令如下
# 2024-09-04 支持内核 6.8
proxmox-kernel-6.5.13-3-pve ~ 6.8.12-4-pve
uname -r # 已经测试的支持内核范围 6.5.13-3-pve ~ 6.8.12-4-pve ,具体看项目支持情况
# 2024 11 24 测试情况:教程支持最新 PVE 8.3.1 内核版本:6.8.12-4-pve
# 更换源(可选,但是推荐更换)
wget https://www.iigeek.com/wp-content/uploads/yuan.sh -O yuan.sh && chmod +x yuan.sh && ./yuan.sh
# 更新源
apt update -y
# 更新内核,若刚才 uname -r 的内核版本过小,可以更新内核!更新后,内核大于 6.8.12-4 的情况还未尝试
apt upgrade -y # 更新内核以后,必须重新启动!(大的更新,都是推荐重启)
reboot
# 更新到最新,但是前提内核不能超过GitHub项目的最新版本。6.8.12-4
# 后续避免升级内核
apt install build-* dkms git sysfsutils -y
apt install proxmox-headers-$(uname -r) proxmox-kernel-$(uname -r)
cd ~
git clone https://github.com/strongtz/i915-sriov-dkms.git
cd ~/i915-sriov-dkms
dkms add .
dkms install -m i915-sriov-dkms -v $(cat VERSION) --force
lspci | grep VGA # 请记录当前的核显ID,修改下行的ID后执行下面的代码。
echo "devices/pci0000:00/0000:00:02.0/sriov_numvfs = 7" > /etc/sysfs.conf
reboot
重启之后,在 SHELL 窗口输入 lspci | grep VGA ,回显如下所示,SR-IOV 开启成功,成功虚拟出了 7 个核显。
root@pve:~# lspci | grep VGA
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)
0000:00:02.4 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
0000:00:02.5 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
0000:00:02.6 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
0000:00:02.7 VGA compatible controller: Intel Corporation AlderLake-S GT1 (rev 0c)
root@pve:~#
上图中的 26 — 32 为 SR-IOV 虚拟出来的 7 个核显。
后记
那以上就是目前最新 PVE 8.1.4 版本的安装、PCIe 以及 SR-IOV 核显直通的最简单的调试办法了。
若是按照教程的操作来,相信你一定也是成功安装并已经完成调试了。
暂无评论内容