setup.sh: enable using the igb_uio driver
On some platforms, especially AWS, uio_pci_generic is not readily available, and we don't have access to an IOMMU, so using the DPDK igb_uio driver is a valid workaround. Change-Id: Ic96776f925d9bbbcab625f5adb7642ca6bd4033d Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.gerrithub.io/c/444122 Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
7d4d22a846
commit
c8bcedf4df
@ -55,7 +55,7 @@ function usage()
|
|||||||
echo " By default the current user will be used."
|
echo " By default the current user will be used."
|
||||||
echo "DRIVER_OVERRIDE Disable automatic vfio-pci/uio_pci_generic selection and forcefully"
|
echo "DRIVER_OVERRIDE Disable automatic vfio-pci/uio_pci_generic selection and forcefully"
|
||||||
echo " bind devices to the given driver."
|
echo " bind devices to the given driver."
|
||||||
echo " E.g. DRIVER_OVERRIDE=uio_pci_generic or DRIVER_OVERRIDE=vfio-pci"
|
echo " E.g. DRIVER_OVERRIDE=uio_pci_generic or DRIVER_OVERRIDE=/home/public/dpdk/build/kmod/igb_uio.ko"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,22 +167,40 @@ function get_virtio_names_from_bdf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function configure_linux_pci {
|
function configure_linux_pci {
|
||||||
if [ -z "${DRIVER_OVERRIDE}" ]; then
|
local driver_path=""
|
||||||
driver_name=vfio-pci
|
driver_name=""
|
||||||
if [ -z "$(ls /sys/kernel/iommu_groups)" ]; then
|
if [[ -n "${DRIVER_OVERRIDE}" ]]; then
|
||||||
# No IOMMU. If no-IOMMU mode vfio is not present, then use uio.
|
driver_path="${DRIVER_OVERRIDE%/*}"
|
||||||
if ! [ -e /sys/module/vfio/parameters/enable_unsafe_noiommu_mode ] ||
|
driver_name="${DRIVER_OVERRIDE##*/}"
|
||||||
! [ "$(cat /sys/module/vfio/parameters/enable_unsafe_noiommu_mode)" == "Y" ]
|
# path = name -> there is no path
|
||||||
then
|
if [[ "$driver_path" = "$driver_name" ]]; then
|
||||||
driver_name=uio_pci_generic
|
driver_path=""
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
elif [[ -n "$(ls /sys/kernel/iommu_groups)" || \
|
||||||
|
(-e /sys/module/vfio/parameters/enable_unsafe_noiommu_mode && \
|
||||||
|
"$(cat /sys/module/vfio/parameters/enable_unsafe_noiommu_mode)" == "Y") ]]; then
|
||||||
|
driver_name=vfio-pci
|
||||||
|
elif modinfo uio_pci_generic >/dev/null 2>&1; then
|
||||||
|
driver_name=uio_pci_generic
|
||||||
|
elif [[ -r "$rootdir/dpdk/build/kmod/igb_uio.ko" ]]; then
|
||||||
|
driver_path="$rootdir/dpdk/build/kmod/igb_uio.ko"
|
||||||
|
driver_name="igb_uio"
|
||||||
|
modprobe uio
|
||||||
|
echo "WARNING: uio_pci_generic not detected - using $driver_name"
|
||||||
else
|
else
|
||||||
driver_name="${DRIVER_OVERRIDE}"
|
echo "No valid drivers found [vfio-pci, uio_pci_generic, igb_uio]. Please either enable the vfio-pci or uio_pci_generic"
|
||||||
|
echo "kernel modules, or have SPDK build the igb_uio driver by running ./configure --with-igb-uio-driver and recompiling."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# modprobe assumes the directory of the module. If the user passes in a path, we should use insmod
|
||||||
|
if [[ -n "$driver_path" ]]; then
|
||||||
|
insmod $driver_path || true
|
||||||
|
else
|
||||||
|
modprobe $driver_name
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# NVMe
|
# NVMe
|
||||||
modprobe $driver_name
|
|
||||||
for bdf in $(iter_all_pci_class_code 01 08 02); do
|
for bdf in $(iter_all_pci_class_code 01 08 02); do
|
||||||
blkname=''
|
blkname=''
|
||||||
get_nvme_name_from_bdf "$bdf" blkname
|
get_nvme_name_from_bdf "$bdf" blkname
|
||||||
|
Loading…
Reference in New Issue
Block a user