Commit c8bcedf4 authored by Seth Howell's avatar Seth Howell Committed by Jim Harris
Browse files

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: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/444122


Reviewed-by: default avatarPawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 7d4d22a8
Loading
Loading
Loading
Loading
+30 −12
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ function usage()
	echo "                  By default the current user will be used."
	echo "DRIVER_OVERRIDE   Disable automatic vfio-pci/uio_pci_generic selection and forcefully"
	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
}

@@ -167,22 +167,40 @@ function get_virtio_names_from_bdf {
}

function configure_linux_pci {
	if [ -z "${DRIVER_OVERRIDE}" ]; then
	local driver_path=""
	driver_name=""
	if [[ -n "${DRIVER_OVERRIDE}" ]]; then
		driver_path="${DRIVER_OVERRIDE%/*}"
		driver_name="${DRIVER_OVERRIDE##*/}"
		# path = name -> there is no path
		if [[ "$driver_path" = "$driver_name" ]]; then
			driver_path=""
		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
		if [ -z "$(ls /sys/kernel/iommu_groups)" ]; then
			# No IOMMU. If no-IOMMU mode vfio is not present, then use uio.
			if ! [ -e /sys/module/vfio/parameters/enable_unsafe_noiommu_mode ] ||
			! [ "$(cat /sys/module/vfio/parameters/enable_unsafe_noiommu_mode)" == "Y" ]
			then
	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
		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
		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
		driver_name="${DRIVER_OVERRIDE}"
		modprobe $driver_name
	fi

	# NVMe
	modprobe $driver_name
	for bdf in $(iter_all_pci_class_code 01 08 02); do
		blkname=''
		get_nvme_name_from_bdf "$bdf" blkname