Commit 515ec7e7 authored by Gang Cao's avatar Gang Cao Committed by Tomasz Zawadzki
Browse files

Script: add the support of vfio_pci driver for QAT

parent a95bbf23
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ shopt -s nullglob
set -e

rootdir=$(readlink -f $(dirname $0))/..
allowed_drivers=("igb_uio" "uio_pci_generic")
allowed_drivers=("igb_uio" "uio_pci_generic" "vfio_pci")

reload_intel_qat() {
	# We need to make sure the out-of-tree intel_qat driver, provided via autotest_setup.sh,
@@ -127,16 +127,19 @@ if ((expected_num_vfs != set_num_vfs || ${#qat_vf_bdfs[@]} != expected_num_vfs))
	exit 1
fi

modprobe uio

# Insert the dpdk uio kernel module.
if [ $driver_to_bind == "igb_uio" ]; then
	modprobe uio
	if ! modprobe igb_uio; then
		echo "Unable to insert the igb_uio kernel module. Aborting."
		exit 1
	fi
elif [ "$driver_to_bind" == "uio_pci_generic" ]; then
	modprobe uio
	modprobe uio_pci_generic
elif [ "$driver_to_bind" == "vfio_pci" ]; then
	modprobe vfio
	modprobe vfio_pci
else
	echo "Unsure how to work with driver $driver_to_bind. Please configure it in qat_setup.sh"
	exit 1
@@ -152,8 +155,13 @@ for vf in "${qat_vf_bdfs[@]}"; do
			echo "${vf##*/}" > "/sys/bus/pci/drivers/$old_driver/unbind"
		fi
	fi
	# Bind new driver
	if [ "$driver_to_bind" == "vfio_pci" ]; then
		"$rootdir/dpdk/usertools/dpdk-devbind.py" -b vfio-pci $vf
	else
		echo "$driver_to_bind" > "$vf/driver_override"
		echo "${vf##*/}" > /sys/bus/pci/drivers_probe
	fi
done

echo "Properly configured the qat device with driver $driver_to_bind."