From be5d98000f73cb9a0761be0f776c4de577c581cb Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Tue, 13 Nov 2018 13:35:16 -0700 Subject: [PATCH] test: adjust scripts for 01.org qat driver Change-Id: I1cf9d27d05f09c199ef35066f2e62480025d3feb Signed-off-by: Seth Howell Reviewed-on: https://review.gerrithub.io/433185 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris --- scripts/qat_setup.sh | 21 +++--------------- test/common/config/vm_setup.conf | 1 + test/common/config/vm_setup.sh | 38 +++++++++++++++++++++++++++++++- 3 files changed, 41 insertions(+), 19 deletions(-) diff --git a/scripts/qat_setup.sh b/scripts/qat_setup.sh index b46351d78..622bc84a4 100755 --- a/scripts/qat_setup.sh +++ b/scripts/qat_setup.sh @@ -11,9 +11,6 @@ allowed_drivers=("igb_uio" "uio_pci_generic") bad_driver=true driver_to_bind=uio_pci_generic num_vfs=16 -firmware_download_url=http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree -qat_binary=qat_895xcc.bin -qat_mmp_binary=qat_895xcc_mmp.bin qat_pci_bdfs=( $(lspci -Dd:37c8 | awk '{print $1}') ) if [ ${#qat_pci_bdfs[@]} -eq 0 ]; then @@ -37,21 +34,9 @@ if $bad_driver; then exit 1 fi -# Fetch firmware if needed. -if [ ! -f /lib/firmware/$qat_binary ]; then - echo "installing qat firmware" - if ! wget $firmware_download_url/$qat_binary -O /lib/firmware/$qat_binary; then - echo "Cannot download the qat binary $qat_binary from <$firmware_download_url/$qat_binary>" - exit 1 - fi -fi - -if [ ! -f /lib/firmware/$qat_mmp_binary ]; then - echo "installing qat mmp firmware" - if ! wget $firmware_download_url/$qat_mmp_binary -O /lib/firmware/$qat_mmp_binary; then - echo "Cannot download the qat mmp binary $qat_mmp_binary from <$firmware_download_url/$qat_mmp_binary>" - exit 1 - fi +# 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." fi # configure virtual functions for the QAT cards. diff --git a/test/common/config/vm_setup.conf b/test/common/config/vm_setup.conf index 40acea662..e43293489 100644 --- a/test/common/config/vm_setup.conf +++ b/test/common/config/vm_setup.conf @@ -10,3 +10,4 @@ GIT_REPO_QEMU=https://github.com/spdk/qemu GIT_REPO_VPP=https://gerrit.fd.io/r/vpp GIT_REPO_LIBISCSI=https://github.com/sahlberg/libiscsi GIT_REPO_SPDK_NVME_CLI=https://github.com/spdk/nvme-cli +DRIVER_LOCATION_QAT=https://01.org/sites/default/files/downloads/intelr-quickassist-technology/qat1.7.l.4.3.0-00033.tar.gz diff --git a/test/common/config/vm_setup.sh b/test/common/config/vm_setup.sh index ce92232a2..630160a6b 100755 --- a/test/common/config/vm_setup.sh +++ b/test/common/config/vm_setup.sh @@ -24,7 +24,7 @@ VM_SETUP_PATH=$(readlink -f ${BASH_SOURCE%/*}) UPGRADE=false INSTALL=false -CONF="librxe,iscsi,rocksdb,fio,flamegraph,tsocks,qemu,vpp,libiscsi,nvmecli" +CONF="librxe,iscsi,rocksdb,fio,flamegraph,tsocks,qemu,vpp,libiscsi,nvmecli,qat" function install_rxe_cfg() { @@ -84,6 +84,40 @@ function install_iscsi_adm() fi } +function install_qat() +{ + if echo $CONF | grep -q qat; then + qat_tarball=$(basename $DRIVER_LOCATION_QAT) + kernel_maj=$(uname -r | cut -d'.' -f1) + kernel_min=$(uname -r | cut -d'.' -f2) + + sudo modprobe -r qat_c62x + if [ -d /QAT ]; then + sudo rm -rf /QAT/ + fi + + sudo mkdir /QAT + + wget $DRIVER_LOCATION_QAT + sudo cp $qat_tarball /QAT/ + (cd /QAT && sudo tar zxof /QAT/$qat_tarball) + + #The driver version 1.7.l.4.3.0-00033 contains a reference to a deprecated function. Remove it so the build won't fail. + if [ $kernel_maj -le 4 ]; then + if [ $kernel_min -le 17 ]; then + sudo sed -i 's/rdtscll(timestamp);/timestamp = rdtsc_ordered();/g' \ + /QAT/quickassist/utilities/osal/src/linux/kernel_space/OsalServices.c || true + fi + fi + + (cd /QAT && sudo ./configure --enable-icp-sriov=host && sudo make install) + + if sudo service qat_service start; then + echo "failed to start the qat service. Something may be wrong with your device or package." + fi + fi +} + function install_rocksdb() { if echo $CONF | grep -q rocksdb; then @@ -311,6 +345,7 @@ cd ~ : ${GIT_REPO_LIBISCSI=https://github.com/sahlberg/libiscsi}; export GIT_REPO_LIBISCSI : ${GIT_REPO_SPDK_NVME_CLI=https://github.com/spdk/nvme-cli}; export GIT_REPO_SPDK_NVME_CLI : ${GIT_REPO_INTEL_IPSEC_MB=https://github.com/spdk/intel-ipsec-mb.git}; export GIT_REPO_INTEL_IPSEC_MB +: ${DRIVER_LOCATION_QAT=https://01.org/sites/default/files/downloads/intelr-quickassist-technology/qat1.7.l.4.3.0-00033.tar.gz}; export DRIVER_LOCATION_QAT jobs=$(($(nproc)*2)) @@ -387,6 +422,7 @@ install_qemu& install_vpp& install_nvmecli& install_libiscsi& +install_qat& wait # create autorun-spdk.conf in home folder. This is sourced by the autotest_common.sh file.