PVE passthrough 的配置

一、确认主板和CPU是否支持VT-D

查询intel主板是否支持VT-D:https://www.intel.co.uk/content/www/uk/en/support/articles/000005758/boards-and-kits/desktop-boards.html
查询intel CPU是否支持VT-D:https://ark.intel.com/content/www/cn/zh/ark/products/136436/intel-xeon-d-2177nt-processor-19-25m-cache-1-90-ghz.html

二、修改bios配置

查看bios中CPU与PCI相关配置,CPU开启VT相关配置,PCI开启IOMMU相关配置

三、修改配置

3.1、启动引导处修改配置

vi /etc/default/grub
#intel cpu,开启了iommu,pt模式,加入了acs帮助某些使用不良ACS实现的设置。

GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on  iommu=pt pci=realloc,assign-busses pcie_acs_override=downstream"

3.2、更新grub

update-grub

3.3、添加模块支持,写入如下配置

vi /etc/modules
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd

3.4、添加允许不安全的中断的配置

echo "options vfio_iommu_type1 allow_unsafe_interrupts=1" > /etc/modprobe.d/iommu_unsafe_interrupts.conf

3.5、刷新内核

update-initramfs -u

3.6、重启,验证

验证IOMMU隔离,官方文档中出现如下内容,即验证成功

# find /sys/kernel/iommu_groups/ -type l
/sys/kernel/iommu_groups/0/devices/0000:00:00.0
/sys/kernel/iommu_groups/1/devices/0000:00:01.0
/sys/kernel/iommu_groups/1/devices/0000:01:00.0
/sys/kernel/iommu_groups/1/devices/0000:01:00.1
/sys/kernel/iommu_groups/2/devices/0000:00:02.0
/sys/kernel/iommu_groups/3/devices/0000:00:16.0
/sys/kernel/iommu_groups/4/devices/0000:00:1a.0
/sys/kernel/iommu_groups/5/devices/0000:00:1b.0
/sys/kernel/iommu_groups/6/devices/0000:00:1c.0
/sys/kernel/iommu_groups/7/devices/0000:00:1c.5
/sys/kernel/iommu_groups/8/devices/0000:00:1c.6
/sys/kernel/iommu_groups/9/devices/0000:00:1c.7
/sys/kernel/iommu_groups/9/devices/0000:05:00.0
/sys/kernel/iommu_groups/10/devices/0000:00:1d.0
/sys/kernel/iommu_groups/11/devices/0000:00:1f.0
/sys/kernel/iommu_groups/11/devices/0000:00:1f.2
/sys/kernel/iommu_groups/11/devices/0000:00:1f.3
/sys/kernel/iommu_groups/12/devices/0000:02:00.0
/sys/kernel/iommu_groups/12/devices/0000:02:00.1
/sys/kernel/iommu_groups/13/devices/0000:03:00.0
/sys/kernel/iommu_groups/14/devices/0000:04:00.0

IOMMU中断重新映射验证

# dmesg | grep 'remapping'

3.7、直通

vi /etc/modprobe.d/vfio.conf
#8086:37d0是在lspci -nnk中括号中的内容
options vfio-pci ids=8086:37d0

参考:https://pve.proxmox.com/wiki/Pci_passthrough

猜你喜欢

转载自blog.51cto.com/jiayimeng/2542025
今日推荐