一 VFIO
1 . VFIO是强大而安全的,基于IOMMU保护的驱动.
加载:
modprobe vfio-pci
To make use of full VFIO functionality, both kernel and BIOS must support and be configured to use IO virtualization (such as Intel® VT-d).
Linux versions earlier than version 3.6 do not support VFIO.
In most cases, specifying “iommu=on” as kernel parameter should be enough to configure the Linux kernel to use IOMMU.
参考:http://doc.dpdk.org/guides/linux_gsg/linux_drivers.html
- VFIO-no-IOMMU
modprobe vfio enable_unsafe_noiommu_mode=1
或在内核中启动这个选项:
echo 1 > /sys/module/vfio/parameters/enable_unsafe_noiommu_mode
二 UIO
sudo modprobe uio_pci_generic
dpdk里面也有:
sudo modprobe uio
sudo insmod igb_uio.ko
If UEFI secure boot is enabled, the Linux kernel may disallow the use of UIO on the system. Therefore, devices for use by DPDK should be bound to the
vfio-pci
kernel module rather than any UIO-based module. For more details see Binding and Unbinding Network Ports to/from the Kernel Modules below.
If the devices used for DPDK are bound to the uio_pci_generic kernel module, please make sure that the IOMMU is disabled or is in passthrough mode. One can add intel_iommu=off or amd_iommu=off or intel_iommu=on iommu=pt in GRUB command line on x86_64 systems, or add iommu.passthrough=1 on aarch64 systems.
Using UIO drivers is inherently unsafe due to this method lacking IOMMU protection, and can only be done by root user.
./usertools/dpdk-devbind.py --bind=uio_pci_generic 04:00.1
或
./usertools/dpdk-devbind.py --bind=uio_pci_generic eth1
没开启IOMMU 不支持vfio
cat /boot/config-$(uname -r) | grep NOIOMMU
# CONFIG_VFIO_NOIOMMU is not set
网友评论