scripts/qat_setup: Make sure the out-of-tree intel_qat driver is in use

Change-Id: I8869b42cd42a1f18cbbde79d59e1a95df9316d4e
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5451
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Michal Berger 2020-12-04 11:08:46 +01:00 committed by Tomasz Zawadzki
parent d495c9b222
commit fb732cb782

View File

@ -1,9 +1,55 @@
#!/usr/bin/env bash
shopt -s nullglob
rootdir=$(readlink -f $(dirname $0))/..
igb_driverdir=$rootdir/dpdk/build/build/kernel/igb_uio/
allowed_drivers=("igb_uio" "uio_pci_generic")
reload_intel_qat() {
# We need to make sure the out-of-tree intel_qat driver, provided via vm_setup.sh, is in
# use. Otherwise, some dependency modules loaded by qat_service may fail causing some
# disturbance later on during the tests - in particular, it's been seen that the adf_ctl
# was returning inconsistent data (wrong pci addresses), confusing the service into
# believing SR-IOV is not enabled.
# If this file doesn't exist, then either intel_qat is a kernel built-in or is not loaded.
# Nothing to do in such cases, qat_service will load the module for us.
[[ -e /sys/module/intel_qat/taint ]] || return 0
local t v
t=$(< /sys/module/intel_qat/taint)
v=$(< /sys/module/intel_qat/version)
# OE - out-of-tree, unsigned. By the very default, drivers built via vm_setup.sh are not
# signed.
[[ -z $t || $t != *"OE"* ]] || return 0
# Check the version of loaded module against the version of the same module as seen
# from .dep. perspective. if these are the same the most likely something is broken
# with the dependencies. We report a failure in such a case since reloading the module
# won't do any good anyway.
if [[ $(modinfo -F version intel_qat) == "$v" ]]; then
cat <<- WARN
Upstream intel_qat driver detected. Same version of the driver is seen
in modules dependencies: $v. This may mean QAT build didn't update
dependencies properly. QAT setup may fail, please, rebuild the QAT
driver.
WARN
return 0
fi
# Ok, intel_qat is an upstream module, replace it with the out-of-tree one.
echo "Reloading intel_qat module"
local h=(/sys/module/intel_qat/holders/*)
h=("${h[@]##*/}")
modprobe -r "${h[@]}" intel_qat
# qat_service does that too, but be vigilant
modprobe -a intel_qat "${h[@]}"
}
# This script requires an igb_uio kernel module binary located at $igb_driverdir/igb_uio.ko
# Please also note that this script is not intended to be comprehensive or production quality.
# It supports configuring a single card (the Intel QAT 8970) for use with the SPDK
@ -34,6 +80,8 @@ if $bad_driver; then
exit 1
fi
reload_intel_qat
# try starting the qat service. If this doesn't work, just treat it as a warning for now.
if ! service qat_service start; then
echo "failed to start the qat service. Something may be wrong with your 01.org driver."