原创文章,转载请注明出处
https://qiedd.com/
0x00 简介
在 PVE 直通时, 即使在 grub 中设置了 pcie_acs_override=downstream 或者 pcie_acs_override=downstream,multifunction
还是会出现多个设备在同一个 iommu 组中, 这时候直通了设备, 会导致同组的设备失联, 这时候只能去编译内核

0x01 内核编译
我这里的版本上 PVE 8.0.3
# 如果你现在是 root 用户, 请先创建一个 user useradd -m -g users -s /bin/bash pve # 如果没有 sudo 请安装 apt install sudo -y # 设置的你的用户密码 passwd pve # 进入用户组 su pve # 进入用户文件夹 cd # 安装依赖 sudo apt install devscripts asciidoc-base automake bc bison cpio dh-python bison flex git kmod libdw-dev libelf-dev libiberty-dev libnuma-dev libpve-common-perl libslang2-dev lintian lz4 perl-modules rsync sphinx-common xmlto zlib1g-dev dwarves net-tools htop vnstat libpve-common-perl python3-dev -y # 下载源码, 记得挂梯子 git clone --recursive https://git.proxmox.com/git/pve-kernel.git # 修改补丁 vim patches/kernel/0004-pci-Enable-overrides-for-missing-ACS-capabilities-4..patch ## 修改 159 行的代码, 由于删除了一行, 你需要加多一行, 另外注意括号 ## 原代码 + if (!pci_is_pcie(dev) || + pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS)) + return -ENOTTY; ## 修改后 + if (!pci_is_pcie(dev)) + return -ENOTTY; + # 直接编译, 有自动检测线程, 编译时间基于机器性能 make # 安装内核 dpkg -i *.deb
0x02 Grub 修改
# 你的 gurb 配置应该长这样, intel 的记得自己修改 GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on iommu=pt pcie_acs_override=downstream,multifunction"

# 更新 grub update-grub # 更新 initramfs update-initramfs -u -k all # 重启 reboot # 查看内核版本 uname -a ## 输出 Linux PVE 6.5.3-1-pve #1 SMP PREEMPT_DYNAMIC PMX 6.5.3-1 (2023-10-23T08:03Z) x86_64 GNU/Linux ## 刷新一下 web

0x03 懒狗版
# (optional) install wget apt install wget -y # (optional) create a folder mkdir pve-kernel # (optional) cd to the floder cd pve-kernel # download the file wget https://dl.qiedd.com/Linux/pve-kernel/6.5.3-1.tar.gz # extract the file tar xvf 6.5.3-1.tar.gz # install the modified kernel dpkg -i *.deb # reboot the system reboot # check the kernel uanme -a ## output Linux PVE 6.5.3-1-pve #1 SMP PREEMPT_DYNAMIC PMX 6.5.3-1 (2023-10-23T08:03Z) x86_64 GNU/Linux
0 条评论