前提条件
打开bios的vt-d
修改/etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt"
更新grup
update-grub
加载相应的内核模块
echo vfio >> /etc/modules
echo vfio_iommu_type1 >> /etc/modules
echo vfio_pci >> /etc/modules
echo vfio_virqfd >> /etc/modules
重启机器
reboot
验证
root@node:~# dmesg | grep iommu
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.15.102-1-pve root=/dev/mapper/pve-root ro quiet intel_iommu=on iommu=pt
[ 0.527364] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.15.102-1-pve root=/dev/mapper/pve-root ro quiet intel_iommu=on iommu=pt
[ 2.158233] iommu: Default domain type: Passthrough (set via kernel command line)
[ 2.203284] pci 0000:00:00.0: Adding to iommu group 0
[ 2.203331] pci 0000:00:04.0: Adding to iommu group 1
[ 2.203374] pci 0000:00:04.1: Adding to iommu group 2
[ 2.203415] pci 0000:00:04.2: Adding to iommu group 3
[ 2.203458] pci 0000:00:04.3: Adding to iommu group 4
[ 2.203500] pci 0000:00:04.4: Adding to iommu group 5
[ 2.203541] pci 0000:00:04.5: Adding to iommu group 6
[ 2.203582] pci 0000:00:04.6: Adding to iommu group 7
[ 2.203623] pci 0000:00:04.7: Adding to iommu group 8
[ 2.203665] pci 0000:00:05.0: Adding to iommu group 9
[ 2.203705] pci 0000:00:05.2: Adding to iommu group 10
[ 2.203746] pci 0000:00:05.4: Adding to iommu group 11
# find /sys/kernel/iommu_groups/ -type l | wc -l
242
出现很多直通组,就代表成功了。如果没有任何东西,就是没有开启
给虚拟机添加磁盘
磁盘信息
4k随机写
参考:
https://foxi.buduanwang.vip/virtualization/pve/561.html/
推荐本站淘宝优惠价购买喜欢的宝贝:
本文链接:https://www.hqyman.cn/post/7048.html 非本站原创文章欢迎转载,原创文章需保留本站地址!
打赏微信支付宝扫一扫,打赏作者吧~
休息一下~~