Upgrade qat driver to latest version for CentOS 7.6

1. Update qat driver version from QAT1.7.Upstream.L.1.0.3-42
   to QAT1.7.L.4.5.0-00034;
2. StarlingX need the specific qat_service, which is in qat17/files/qat_service
3. qat_service patch file "0001-Install-config-file-for-each-VF_new.patch"
   is not neeeded.
4. Delete qat_service patching process in qat17.spec

Story: 2004901
Task: 29235

Depends-On: https://review.opendev.org/#/c/654830
Change-Id: Id675512a522d88c9a0378e367a87f81d1bde2703
Signed-off-by: Long.Li <longx.li@intel.com>
This commit is contained in:
Long.Li 2019-04-23 16:28:07 +08:00
parent 3cbee7c788
commit d73ad2bc8d
5 changed files with 108 additions and 162 deletions

View File

@ -1,6 +1,6 @@
COPY_LIST=" \
$PKG_BASE/files/* \
$STX_BASE/downloads/qat1.7.upstream.l.1.0.3-42.tar.gz \
$STX_BASE/downloads/qat1.7.l.4.5.0-00034.tar.gz \
"
TIS_PATCH_VER=4
TIS_PATCH_VER=1
BUILD_IS_SLOW=3

View File

@ -7,8 +7,8 @@
Summary: Intel(r) QuickAssist Technology API
%define pkgname qat17
Name: %{pkgname}%{?bt_ext}
Version: 1.0.3
%define upstream_release 42
Version: 4.5.0
%define upstream_release 00034
Release: %{upstream_release}%{?_tis_dist}.%{tis_patch_ver}
License: GPLv2
Group: base
@ -30,12 +30,12 @@ BuildRequires: openssl
%define qat_unpack_dir %{_builddir}/%{name}-%{version}
%define qat_src_dir %{qat_unpack_dir}
Source: qat1.7.upstream.l.%{version}-%{upstream_release}.tar.gz
Source: qat1.7.l.%{version}-%{upstream_release}.tar.gz
Source1: qat
# Use our own service script rather than massively patching theirs
Source2: qat_service
Patch1: 0001-Install-config-file-for-each-VF.patch
#Patch1: 0001-Install-config-file-for-each-VF.patch
Patch2: Get-and-report-the-return-code-on-firmware-load-fail.patch
%description
@ -46,12 +46,12 @@ rm -rf %{qat_unpack_dir}
mkdir -p %{qat_unpack_dir}
cd %{qat_unpack_dir}
gzip -dc %{_sourcedir}/qat1.7.upstream.l.%{version}-%{upstream_release}.tar.gz | tar -xvvf -
gzip -dc %{_sourcedir}/qat1.7.l.%{version}-%{upstream_release}.tar.gz | tar -xvvf -
if [ $? -ne 0 ]; then
exit $?
fi
%patch1 -p1
#%patch1 -p1
%patch2 -p1
%build
@ -63,7 +63,7 @@ ICP_BUILD_OUTPUT=%{qat_src_dir}/build
export ICP_ROOT KERNEL_SOURCE_ROOT ICP_BUILD_OUTPUT
cd %{qat_src_dir}
%configure
%configure --enable-icp-sriov=host
make -C %{qat_src_dir}/

View File

@ -1,118 +0,0 @@
From ab216edc24f2fb9d8c28662f069b027c6479d277 Mon Sep 17 00:00:00 2001
From: eric zhang <eric.zhang@windriver.com>
Date: Fri, 17 Nov 2017 15:41:35 -0500
Subject: [PATCH 1/1] Install config file for each VF
Signed-off-by: eric zhang <eric.zhang@windriver.com>
---
quickassist/build_system/build_files/qat_service | 60 +++++++++++++++++++++---
1 file changed, 54 insertions(+), 6 deletions(-)
diff --git a/quickassist/build_system/build_files/qat_service b/quickassist/build_system/build_files/qat_service
index 168413b..8e2b838 100755
--- a/quickassist/build_system/build_files/qat_service
+++ b/quickassist/build_system/build_files/qat_service
@@ -65,6 +65,12 @@ C3XX_DEVICE_PCI_ID_VM="19e3"
D15XX_DEVICE_PCI_ID="6f54"
D15XX_DEVICE_PCI_ID_VM="6f55"
+QAT_DH895XCC_NUM_VFS=32
+QAT_DHC62X_NUM_VFS=16
+QAT_DHD15XX_NUM_VFS=16
+QAT_DHC3XXX_NUM_VFS=16
+
+
usage() {
echo
echo --------------------------------------------------------
@@ -84,7 +90,7 @@ echo --------------------------------------------------------
exit 1
}
-ADF_CTL=/usr/sbin/adf_ctl
+ADF_CTL=/usr/bin/adf_ctl
# store the total number of each type of device
numDh895xDevicesPF=$(lspci -n | egrep -c "$INTEL_VENDORID:$DH895_DEVICE_PCI_ID")
@@ -193,15 +199,57 @@ case $1 in
if [ $DO_ENABLE_SRIOV == 1 ]; then
echo enable sriov
+
+ if [ $numDh895xDevicesPF != 0 ];then
+ for (( dev=0; dev<$numDh895xDevicesPF; dev++ ))
+ do
+ for (( vf_dev = 0; vf_dev < $QAT_DH895XCC_NUM_VFS; vf_dev++ ))
+ do
+ vf_dev_num=$(($dev * $numDh895xDevicesPF + $vf_dev))
+ cp /etc/qat/dh895xccvf_dev0.conf.vm /etc/dh895xccvf_dev$vf_dev_num.conf
+ done
+ done
+ fi
+ if [ $numC62xDevicesPF != 0 ];then
+ for (( dev=0; dev<$numC62xDevicesPF; dev++ ))
+ do
+ for (( vf_dev = 0; vf_dev<$QAT_DHC62X_NUM_VFS; vf_dev++ ))
+ do
+ vf_dev_num=$(($dev * $numC62xDevicesPF + $vf_dev))
+ cp /etc/qat/c6xxvf_dev0.conf.vm /etc/c6xxvf_dev$vf_dev_num.conf
+ done
+ done
+ fi
+ if [ $numC3xxDevicesPF != 0 ];then
+ for (( dev=0; dev<$numC3xxDevicesPF; dev++ ))
+ do
+ for (( vf_dev = 0; vf_dev<$QAT_DHC3XXX_NUM_VFS; vf_dev++ ))
+ do
+ vf_dev_num=$(($dev * $numC3xxDevicesPF + $vf_dev))
+ cp /etc/qat/c3xxvf_dev0.conf.vm /etc/c3xxvf_dev$vf_dev_num.conf
+ done
+ done
+ fi
+ if [ $numD15xxDevicesPF != 0 ];then
+ for (( dev=0; dev<$numD15xxDevicesPF; dev++ ))
+ do
+ for (( vf_dev = 0; vf_dev<$QAT_DHD15XX_NUM_VFS; vf_dev++ ))
+ do
+ vf_dev_num=$(($dev * $numD15xxDevicesPF + $vf_dev))
+ cp /etc/qat/D15xxvf_dev0.conf.vm /etc/D15xxvf_dev$vf_dev_num.conf
+ done
+ done
+ fi
+
enable_sriov $2
fi
# Show device status
- /usr/sbin/adf_ctl $2 status
+ /usr/bin/adf_ctl $2 status
;;
Shutdown|shutdown)
- /usr/sbin/adf_ctl down
+ /usr/bin/adf_ctl down
modprobe -q -r usdm_drv
modprobe -q -r qat_dh895xccvf
modprobe -q -r qat_c62xvf
@@ -215,15 +263,15 @@ case $1 in
;;
Stop|stop)
- /usr/sbin/adf_ctl $2 down
+ /usr/bin/adf_ctl $2 down
;;
Restart|restart)
- /usr/sbin/adf_ctl $2 down && /usr/sbin/adf_ctl $2 up
+ /usr/bin/adf_ctl $2 down && /usr/bin/adf_ctl $2 up
;;
Status|status)
- /usr/sbin/adf_ctl status
+ /usr/bin/adf_ctl status
if [ "$?" -ne 0 ]
then
echo "No devices found. Please start the driver using:"
--
1.8.3.1

View File

@ -10,18 +10,18 @@ Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/adf_accel_engine.c b/quickassist/qat/drivers/crypto/qat/qat_common/adf_accel_engine.c
index 6d96fd6..522cbf0 100644
index 5a5d42b..9c109e3 100755
--- a/quickassist/qat/drivers/crypto/qat/qat_common/adf_accel_engine.c
+++ b/quickassist/qat/drivers/crypto/qat/qat_common/adf_accel_engine.c
@@ -57,6 +57,7 @@ int adf_ae_fw_load(struct adf_accel_dev *accel_dev)
@@ -64,6 +64,7 @@ int adf_ae_fw_load(struct adf_accel_dev *accel_dev)
struct adf_hw_device_data *hw_device = accel_dev->hw_device;
void *uof_addr, *mmp_addr;
u32 uof_size, mmp_size;
+ int rc;
#ifdef QAT_UIO
char uofname[ADF_CFG_MAX_VAL_LEN_IN_BYTES];
struct adf_accel_pci *pci_info = &accel_dev->accel_pci_dev;
unsigned long storage_enabled = 0;
@@ -72,10 +73,11 @@ int adf_ae_fw_load(struct adf_accel_dev *accel_dev)
struct adf_mmp_version_s mmp_ver = { {0} };
@@ -77,10 +78,11 @@ int adf_ae_fw_load(struct adf_accel_dev *accel_dev)
if (!hw_device->fw_name)
return 0;
@ -38,5 +38,5 @@ index 6d96fd6..522cbf0 100644
}
if (request_firmware(&loader_data->uof_fw, hw_device->fw_name,
--
1.8.3.1
2.7.4

View File

@ -3,36 +3,36 @@
#
# BSD LICENSE
#
# Copyright(c) 2007-2016 Intel Corporation. All rights reserved.
# Copyright(c) 2007-2018 Intel Corporation. All rights reserved.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Intel Corporation nor the names of its
# contributors may be used to endorse or promote products derived
# * Neither the name of Intel Corporation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# version: QAT1.7.Upstream.L.1.0.3-42
# version: QAT1.7.L.4.5.0-00034
#
#################################################################
#
@ -52,6 +52,20 @@
# modules, before calling the user space \
# utility to pass configuration parameters
test -f /etc/default/qat && . /etc/default/qat
SRIOV_ENABLE=${SRIOV_ENABLE-0}
LEGACY_LOADED=${LEGACY_LOADED-0}
DO_ENABLE_SRIOV=${DO_ENABLE_SRIOV-0}
ENABLE_KAPI=${ENABLE_KAPI-0}
# to protect parallel qat-service run instances
for pid in $(pidof -x qat_service ); do
if [ $pid != $$ ]; then
echo "[$(date)] : qat_service : Process is already running with PID $pid"
exit 1
fi
done
usage() {
echo
echo --------------------------------------------------------
@ -84,18 +98,38 @@ inventory_the_devices() {
numD15xxDevicesVF=$(lspci -n | egrep -c "${INTEL_VENDORID}:${D15XX_DEVICE_PCI_ID_VM}")
}
disable_sriov() {
PF_LIST=`${ADF_CTL} $1 status | grep -e "^ *qat_dev" | grep -v "vf," | awk '{print $1}'`
for PF_DEV in ${PF_LIST}
do
# Extract the BSF to build the path to /sys/bus/.../sriov)_numvfs
BSF=`${ADF_CTL} ${PF_DEV} status | tail -1 | awk '{print $10}' | awk 'BEGIN{FS=","}{print $1}'`
D=`echo $BSF | awk 'BEGIN{FS=":"}{print $1}'`
B=`echo $BSF | awk 'BEGIN{FS=":"}{print $2}'`
# Get a list of all the VFs for this PF and bring them down
VF_LIST=`${ADF_CTL} status | grep "bsf: ${D}:${B}" | grep "vf," | awk '{print $1}'`
for VF_DEV in ${VF_LIST}
do
${ADF_CTL} ${VF_DEV} down
done
done
}
enable_sriov() {
PF_LIST=`${ADF_CTL} $1 status | grep -e "^ *qat_dev" | grep -v "vf," | awk '{print $1}'`
for PF_DEV in ${PF_LIST}
do
# Extract the BSF to build the path to /sys/bus/.../sriov)_numvfs
BSF=`${ADF_CTL} ${PF_DEV} status | tail -1 | awk '{print $8}' | awk 'BEGIN{FS=","}{print $1}'`
B=`echo ${BSF} | awk 'BEGIN{FS=":"}{print $1}'`
SF=`echo ${BSF} | awk 'BEGIN{FS=":"}{print $2}'`
BSF=`${ADF_CTL} ${PF_DEV} status | tail -1 | awk '{print $10}' | awk 'BEGIN{FS=","}{print $1}'`
D=`echo ${BSF} | awk 'BEGIN{FS=":"}{print $1}'`
B=`echo ${BSF} | awk 'BEGIN{FS=":"}{print $2}'`
SF=`echo ${BSF} | awk 'BEGIN{FS=":"}{print $3}'`
S=`echo ${SF} | awk 'BEGIN{FS="."}{print $1}'`
F=`echo ${SF} | awk 'BEGIN{FS="."}{print $2}'`
SYSFS_DIR=/sys/bus/pci/devices/0000:${B}:${S}.${F}
SYSFS_DIR=/sys/bus/pci/devices/${D}:${B}:${S}.${F}
if [ ! -e ${SYSFS_DIR}/sriov_numvfs ]; then
echo "Cannot enable SRIOV for ${PF_DEV}. No sriov_numvs file"
@ -115,19 +149,32 @@ enable_sriov() {
fi
# Get a list of all the VFs for this PF and bring then down
VF_LIST=`${ADF_CTL} status | grep "bsf: ${B}" | grep "vf," | awk '{print $1}'`
VF_LIST=`${ADF_CTL} status | grep "bsf: ${D}:${B}" | grep "vf," | awk '{print $1}'`
for VF_DEV in ${VF_LIST}
do
${ADF_CTL} ${VF_DEV} down
${ADF_CTL} ${VF_DEV} down && ${ADF_CTL} ${VF_DEV} up
done
done
}
${ADF_CTL} up
check_sriov() {
# Check if sriov should be enabled.
if [ ${SRIOV_ENABLE} == 1 ]; then
# If a specific device ($2), or any (empty $2) is specified that is a pf, then enable sriov.
${ADF_CTL} $1 status | grep -e "^ *qat_dev" | grep -v vf > /dev/null
if [ $? == 0 ]; then
DO_ENABLE_SRIOV=1
else
DO_ENABLE_SRIOV=0
fi
else
DO_ENABLE_SRIOV=0
fi
}
load_the_required_modules() {
# Using the collected inventory, install the modules. No harm done if already installed.
if [ ${numDh895xDevicesPF} != 0 ]; then
if [ ${numDh895xDevicesPF} != 0 ] && [ ${LEGACY_LOADED} == 0 ]; then
modprobe qat_dh895xcc
fi
if [ ${numC62xDevicesPF} != 0 ]; then
@ -142,12 +189,13 @@ load_the_required_modules() {
if [ `lsmod | grep "usdm_drv" | wc -l` == "0" ]; then
modprobe usdm_drv
fi
# Loading VF drivers as necessary
# The VF devices only appear after SRIOV is enabled on the PF,
# therefore we can't use lspci to determine that the VF driver should be loaded.
# Instead, if we want SRIOV, and we have a specific PF device, then load the driver.
if [ ${SRIOV_ENABLE} == 1 ]; then
if [ ${numDh895xDevicesPF} != 0 -o ${numDh895xDevicesVF} != 0 ]; then
if [ ${numDh895xDevicesPF} != 0 -o ${numDh895xDevicesVF} != 0 ] && [ ${LEGACY_LOADED} == 0 ]; then
modprobe qat_dh895xccvf
fi
if [ ${numC62xDevicesPF} != 0 -o ${numC62xDevicesVF} != 0 ]; then
@ -160,6 +208,10 @@ load_the_required_modules() {
modprobe qat_d15xxvf
fi
fi
if [ `lsmod | grep "qat_api" | wc -l` == "0" ] && [ ${ENABLE_KAPI} == 1 ]; then
modprobe qat_api
fi
}
copy_in_config_files() {
@ -282,7 +334,13 @@ case $1 in
;;
Shutdown|shutdown)
check_sriov $2
if [ ${DO_ENABLE_SRIOV} == 1 ]; then
echo disable sriov
disable_sriov $2
fi
${ADF_CTL} down
modprobe -q -r qat_api
modprobe -q -r usdm_drv
modprobe -q -r qat_dh895xccvf
modprobe -q -r qat_c62xvf
@ -296,6 +354,11 @@ case $1 in
;;
Stop|stop)
check_sriov $2
if [ ${DO_ENABLE_SRIOV} == 1 ]; then
echo disable sriov
disable_sriov $2
fi
${ADF_CTL} $2 down
;;
@ -318,3 +381,4 @@ case $1 in
esac
exit 0