qat17: add initial version for debian

Add qat17 4.14.0-00031 driver of debian packaging.

The source code package is from:
https://downloadmirror.intel.com/30178/eng/QAT1.7.L.4.14.0-00031.tar.gz

The patches and files (qat/qat_service) in debian/extra folder are
carried over from the 5.10 kernel with stx CentOS by 20211108
(original files' path: kernel-modules/qat17/files).
Added a new patch to fix the linking error related to gcc used in stx
Debian.

Verification:
As we are only getting the Debian work bootstrapped there is quite a few
restrictions as far as what can be tested.
- source code/patch/config are aligned with stx centos 20211108;
- output packages' contents are aligned with stx centos 20211108;
- build image ok with the module;
- qemu boot up ok with the module.

Test on hardware will be done when the integration of the debian
platform is done.

Story: 2009221
Task: 43413
Signed-off-by: Li Zhou <li.zhou@windriver.com>
Change-Id: Id5a75341fd7a1b335b5525e3bfd288c7816e7ef3
This commit is contained in:
Li Zhou
2021-09-24 03:05:13 -04:00
committed by Jim Somerville
parent 9f11519ae0
commit 3a55c24491
13 changed files with 745 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
qat1.7.l (4.14.0-00031) unstable; urgency=medium
* Initial release
-- Li Zhou <li.zhou@windriver.com> Wed, 24 Nov 2021 17:31:55 +0800

View File

@@ -0,0 +1,14 @@
Source: qat1.7.l
Section: kernel
Priority: optional
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
Build-Depends: debhelper-compat (= 13), autotools-dev, pkg-config, libudev-dev, yasm, libssl-dev, libz-dev, pciutils, libboost-dev, perl, openssl, linux-headers-5.10.0-6-amd64, linux-kbuild-5.10
Standards-Version: 4.5.1
Rules-Requires-Root: no
Package: qat1.7.l
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Intel(r) QuickAssist Technology API
Intel® QuickAssist Technology provides security and compression acceleration
capabilities used to improve performance and efficiency across the data center.

View File

@@ -0,0 +1,29 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: QAT
Upstream-Contact: Intel Corporation
Source: https://downloadmirror.intel.com/30178/eng/QAT1.7.L.4.14.0-00031.tar.gz
Files: *
Copyright: (C) Intel Corporation 2008
License:
The Licensing of the files within this project splits under various set of
licenses which are listed below.
- Dual BSD/GPLv2 License
- BSD License
- GPLv2 License
- OpenSSL License
- ZLIB License
For full GPLv2 License, please see the file LICENSE.GPL contained in the top
level folder.
For full OpenSSL License, please see the file LICENSE.OPENSSL contained in
the top level folder.
For Dual BSD/GPLv2, BSD and ZLIB Licenses, please see the file headers of
the relevant files.
Binary files are provided under the binary redistribution license. Please see
the file binary-redistribution-license.txt contained in the top level folder.
On Debian-based systems: the full text of GPLv2 license can be found in
'/usr/share/common-licenses/GPL-2'; the full text of BSD license can be
found in '/usr/share/common-licenses/BSD'.

View File

@@ -0,0 +1 @@
SRIOV_ENABLE=1

View File

@@ -0,0 +1,384 @@
#!/bin/bash
#################################################################
#
# BSD LICENSE
#
# 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
# are met:
#
# * 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
# distribution.
# * 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
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# version: QAT1.7.L.4.5.0-00034
#
#################################################################
#
### BEGIN INIT INFO
# Provides: QAT
# Required-Start: $ALL
# Required-Stop:
# Default-Start: 2 3 5
# Default-Stop: 0 1 4 6
# Description: Intel QAT service
### END INIT INFO
#
# qat_service Start/Stop the Intel QAT.
#
# chkconfig: 345 99 99
# description: modprobe the QAT modules, which loads dependant \
# 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 --------------------------------------------------------
echo USAGE:
echo --------------------------------------------------------
echo "# $0 start||stop||status||restart||shutdown"
echo --------------------------------------------------------
echo " Note: If there is more devices in the system"
echo " you can start, stop or restart separate device by "
echo " passing the dev to be restarted or stopped as a"
echo " parameter for instance: "
echo " $0 stop qat_dev<N>"
echo " where N is device number."
echo " To see all devices in the system use:"
echo " $0 status"
echo --------------------------------------------------------
exit 1
}
inventory_the_devices() {
# dynamically inventory the devices by looking at the pci bus
# store the total number of each type of device seen
numDh895xDevicesPF=$(lspci -n | egrep -c "${INTEL_VENDORID}:${DH895_DEVICE_PCI_ID}")
numDh895xDevicesVF=$(lspci -n | egrep -c "${INTEL_VENDORID}:${DH895_DEVICE_PCI_ID_VM}")
numC62xDevicesPF=$(lspci -n | egrep -c "${INTEL_VENDORID}:${C62X_DEVICE_PCI_ID}")
numC62xDevicesVF=$(lspci -n | egrep -c "${INTEL_VENDORID}:${C62X_DEVICE_PCI_ID_VM}")
numC3xxDevicesPF=$(lspci -n | egrep -c "${INTEL_VENDORID}:${C3XX_DEVICE_PCI_ID}")
numC3xxDevicesVF=$(lspci -n | egrep -c "${INTEL_VENDORID}:${C3XX_DEVICE_PCI_ID_VM}")
numD15xxDevicesPF=$(lspci -n | egrep -c "${INTEL_VENDORID}:${D15XX_DEVICE_PCI_ID}")
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 $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/${D}:${B}:${S}.${F}
if [ ! -e ${SYSFS_DIR}/sriov_numvfs ]; then
echo "Cannot enable SRIOV for ${PF_DEV}. No sriov_numvs file"
exit 1
fi
NUMVFS=`cat ${SYSFS_DIR}/sriov_numvfs`
if [ ${NUMVFS} != 0 ]; then
echo "SRIOV is already enabled for ${PF_DEV}"
exit 1
fi
cat ${SYSFS_DIR}/sriov_totalvfs > ${SYSFS_DIR}/sriov_numvfs
if [ $? != 0 ]; then
echo "Could not enable SRIOV for ${PF_DEV}"
exit 1;
fi
# Get a list of all the VFs for this PF and bring then 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 && ${ADF_CTL} ${VF_DEV} up
done
done
}
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 ] && [ ${LEGACY_LOADED} == 0 ]; then
modprobe qat_dh895xcc
fi
if [ ${numC62xDevicesPF} != 0 ]; then
modprobe qat_c62x
fi
if [ ${numC3xxDevicesPF} != 0 ]; then
modprobe qat_c3xxx
fi
if [ ${numD15xxDevicesPF} != 0 ]; then
modprobe qat_d15xx
fi
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 ] && [ ${LEGACY_LOADED} == 0 ]; then
modprobe qat_dh895xccvf
fi
if [ ${numC62xDevicesPF} != 0 -o ${numC62xDevicesVF} != 0 ]; then
modprobe qat_c62xvf
fi
if [ ${numC3xxDevicesPF} != 0 -o ${numC3xxDevicesVF} != 0 ]; then
modprobe qat_c3xxxvf
fi
if [ ${numD15xxDevicesPF} != 0 -o ${numD15xxDevicesVF} != 0 ]; then
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() {
local num_devices=${1}
local device_file_prefix=${2}
local source_file_suffix="${3}"
if [ ${num_devices} != 0 ]; then
for (( dev=0; dev<${num_devices}; dev++ ))
do
if [ -e /etc/qat/conf_files/${device_file_prefix}_dev${dev}.conf${source_file_suffix} ]; then
cp /etc/qat/conf_files/${device_file_prefix}_dev${dev}.conf${source_file_suffix} /etc/${device_file_prefix}_dev${dev}.conf
else
echo "QAT: ${device_file_prefix}: using dev0 device config for device ${dev}, settings may be suboptimal"
cp /etc/qat/conf_files/${device_file_prefix}_dev0.conf${source_file_suffix} /etc/${device_file_prefix}_dev${dev}.conf
fi
done
fi
}
establish_the_device_PF_config_files() {
copy_in_config_files ${numDh895xDevicesPF} 'dh895xcc' ''
copy_in_config_files ${numC62xDevicesPF} 'c6xx' ''
copy_in_config_files ${numC3xxDevicesPF} 'c3xxx' ''
copy_in_config_files ${numD15xxDevicesPF} 'd15xx' ''
}
establish_the_device_VF_config_files() {
copy_in_config_files $(( ${numDh895xDevicesPF} * ${QAT_DH895XCC_NUM_VFS} )) 'dh895xccvf' '.vm'
copy_in_config_files $(( ${numC62xDevicesPF} * ${QAT_DHC62X_NUM_VFS} )) 'c6xxvf' '.vm'
copy_in_config_files $(( ${numC3xxDevicesPF} * ${QAT_DHC3XXX_NUM_VFS} )) 'c3xxxvf' '.vm'
copy_in_config_files $(( ${numD15xxDevicesPF} * ${QAT_DHD15XX_NUM_VFS} )) 'd15xxvf' '.vm'
}
establish_the_guest_VF_config_files() {
copy_in_config_files ${numDh895xDevicesVF} 'dh895xccvf' '.vm'
copy_in_config_files ${numC62xDevicesVF} 'c6xxvf' '.vm'
copy_in_config_files ${numC3xxDevicesVF} 'c3xxxvf' '.vm'
copy_in_config_files ${numD15xxDevicesVF} 'd15xxvf' '.vm'
}
############### Mainline Begins ################
# Set the SRIOV_ENABLE variable by sourcing the qat file
test -f /etc/default/qat && . /etc/default/qat
INTEL_VENDORID="8086"
DH895_DEVICE_PCI_ID="0435"
DH895_DEVICE_PCI_ID_VM="0443"
C62X_DEVICE_PCI_ID="37c8"
C62X_DEVICE_PCI_ID_VM="37c9"
C3XX_DEVICE_PCI_ID="19e2"
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
ADF_CTL=/usr/sbin/adf_ctl
inventory_the_devices
case $1 in
Start|start)
load_the_required_modules
# Make sure the devices are off
${ADF_CTL} $2 down
establish_the_device_PF_config_files
${ADF_CTL} $2 status | grep -e "^ *qat_dev" | grep -v vf > /dev/null
if [ $? == 0 ]; then
PHYS_FUNCTIONS=1
else
PHYS_FUNCTIONS=0
fi
${ADF_CTL} $2 status | grep -e "^ *qat_dev" | grep vf > /dev/null
if [ $? == 0 ]; then
VIRT_FUNCTIONS=1
else
VIRT_FUNCTIONS=0
fi
# Check if sriov should be enabled.
if [ ${SRIOV_ENABLE} == 1 ]; then
if [ ${PHYS_FUNCTIONS} == 1 ]; then
# We have physical functions
DO_ENABLE_SRIOV=1
else
# No physical functions
DO_ENABLE_SRIOV=0
fi
else
DO_ENABLE_SRIOV=0
fi
if [ ${DO_ENABLE_SRIOV} == 1 ]; then
echo "enabling sriov"
establish_the_device_VF_config_files
enable_sriov $2
else
if [ ${PHYS_FUNCTIONS} == 0 ]; then
if [ ${VIRT_FUNCTIONS} == 1 ]; then
establish_the_guest_VF_config_files
fi
fi
fi
# Turn the devices on
${ADF_CTL} $2 up
# Show device status
${ADF_CTL} $2 status
;;
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
modprobe -q -r qat_c3xxxvf
modprobe -q -r qat_dh895xcc
modprobe -q -r qat_c62x
modprobe -q -r qat_c3xxx
modprobe -q -r qat_d15xx
modprobe -q -r qat_d15xxvf
modprobe -q -r intel_qat
;;
Stop|stop)
check_sriov $2
if [ ${DO_ENABLE_SRIOV} == 1 ]; then
echo disable sriov
disable_sriov $2
fi
${ADF_CTL} $2 down
;;
Restart|restart)
${ADF_CTL} $2 down && ${ADF_CTL} $2 up
;;
Status|status)
${ADF_CTL} status
if [ "$?" -ne 0 ]
then
echo "No devices found. Please start the driver using:"
echo "$0 start"
fi
;;
*)
usage
;;
esac
exit 0

View File

@@ -0,0 +1,70 @@
From 7065771c416d80bcd3cff7cb390602dc8e893b97 Mon Sep 17 00:00:00 2001
From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Date: Tue, 23 Jul 2019 07:24:01 +0000
Subject: [PATCH 1/3] crypto: qat - Silence smp_processor_id() warning
[ commit 1b82feb6c5e1996513d0fb0bbb475417088b4954 upstream ]
It seems that smp_processor_id() is only used for a best-effort
load-balancing, refer to qat_crypto_get_instance_node(). It's not feasible
to disable preemption for the duration of the crypto requests. Therefore,
just silence the warning. This commit is similar to e7a9b05ca4
("crypto: cavium - Fix smp_processor_id() warnings").
Silences the following splat:
BUG: using smp_processor_id() in preemptible [00000000] code: cryptomgr_test/2904
caller is qat_alg_ablkcipher_setkey+0x300/0x4a0 [intel_qat]
CPU: 1 PID: 2904 Comm: cryptomgr_test Tainted: P O 4.14.69 #1
...
Call Trace:
dump_stack+0x5f/0x86
check_preemption_disabled+0xd3/0xe0
qat_alg_ablkcipher_setkey+0x300/0x4a0 [intel_qat]
skcipher_setkey_ablkcipher+0x2b/0x40
__test_skcipher+0x1f3/0xb20
? cpumask_next_and+0x26/0x40
? find_busiest_group+0x10e/0x9d0
? preempt_count_add+0x49/0xa0
? try_module_get+0x61/0xf0
? crypto_mod_get+0x15/0x30
? __kmalloc+0x1df/0x1f0
? __crypto_alloc_tfm+0x116/0x180
? crypto_skcipher_init_tfm+0xa6/0x180
? crypto_create_tfm+0x4b/0xf0
test_skcipher+0x21/0xa0
alg_test_skcipher+0x3f/0xa0
alg_test.part.6+0x126/0x2a0
? finish_task_switch+0x21b/0x260
? __schedule+0x1e9/0x800
? __wake_up_common+0x8d/0x140
cryptomgr_test+0x40/0x50
kthread+0xff/0x130
? cryptomgr_notify+0x540/0x540
? kthread_create_on_node+0x70/0x70
ret_from_fork+0x24/0x50
Fixes: ed8ccaef52 ("crypto: qat - Add support for SRIOV")
Cc: stable@vger.kernel.org
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: zhao.shuai <zhaos@neusoft.com>
---
quickassist/qat/drivers/crypto/qat/qat_common/adf_common_drv.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/adf_common_drv.h b/quickassist/qat/drivers/crypto/qat/qat_common/adf_common_drv.h
index f2343b9..e7799fb 100644
--- a/quickassist/qat/drivers/crypto/qat/qat_common/adf_common_drv.h
+++ b/quickassist/qat/drivers/crypto/qat/qat_common/adf_common_drv.h
@@ -58,7 +58,7 @@ struct service_hndl {
static inline int get_current_node(void)
{
- return topology_physical_package_id(smp_processor_id());
+ return topology_physical_package_id(raw_smp_processor_id());
}
int adf_service_register(struct service_hndl *service);
--
2.17.1

View File

@@ -0,0 +1,69 @@
From 2b3bfdfb4383eaf11f4b3ca9cb81d82251bb82a7 Mon Sep 17 00:00:00 2001
From: "M. Vefa Bicakci" <vefa.bicakci@windriver.com>
Date: Fri, 2 Jul 2021 13:08:50 -0400
Subject: [PATCH 2/3] build: Don't override KERNELVERSION in a wrong way
Prior to this commit, the build system would fail with the following
error message when building the qat kernel modules on a host with a
3.10.y-based kernel, targeting kernel version 5.10.y:
ld -m elf_x86_64 -whole-archive -whole-archive -r \
-o .../quickassist/.../performance/cpa_sample_code.o
ld: no input files
This occurs because the Makefile in question uses the major kernel
version of the build host's running kernel, as opposed to the target
kernel's version.
This commit fixes this issue as follows:
* Do not redefine KERNELVERSION; use a new make variable named
KVER_MAJOR instead.
* Use the target kernel's version from the KERNELVERSION variable to
define the KVER_MAJOR variable's value.
* Add helpful debugging output.
Note: This patch is for qat17-4.13.0, and even though qat17-4.14.0 has
slightly improved this Makefile to check for kernel major versions
greater than '5' as well, the same fix is necessary there too.
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
.../src/sample_code/performance/Makefile | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/quickassist/lookaside/access_layer/src/sample_code/performance/Makefile b/quickassist/lookaside/access_layer/src/sample_code/performance/Makefile
index 9ac31dd..0468892 100644
--- a/quickassist/lookaside/access_layer/src/sample_code/performance/Makefile
+++ b/quickassist/lookaside/access_layer/src/sample_code/performance/Makefile
@@ -310,7 +310,15 @@ endif
ifeq ($(ICP_OS_LEVEL),kernel_space)
SOURCES += qae/$(OS)/$(ICP_OS_LEVEL)/qae_mem_utils.c
ifeq ($(OS),linux)
- KERNELVERSION=$(shell uname -r | cut -d'.' -f1)
+ ifeq ($(KERNELVERSION),)
+ KVER_MAJOR=$(shell uname -r | cut -d'.' -f1)
+ else
+ KVER_MAJOR=$(shell echo "$(KERNELVERSION)" | cut -d'.' -f1)
+ endif
+ $(info Debug: KERNELRELEASE=$(KERNELRELEASE))
+ $(info Debug: KERNELVERSION=$(KERNELVERSION))
+ $(info Debug: VERSION=$(VERSION) PATCHLEVEL=$(PATCHLEVEL))
+ $(info Debug: KVER_MAJOR=$(KVER_MAJOR))
endif
endif
@@ -390,7 +398,7 @@ endif
RM=rm -f
ifeq ($(OS),linux)
ifeq ($(ICP_OS_LEVEL),kernel_space)
- ifeq ($(shell test $(KERNELVERSION) -ge 5; echo $$?), 0)
+ ifeq ($(shell test $(KVER_MAJOR) -ge 5; echo $$?), 0)
ADDITIONAL_KERNEL_LIBS=$(patsubst %.c, %.o, $(SOURCES))
endif
endif
--
2.17.1

View File

@@ -0,0 +1,35 @@
From a41966a2056b6bc873b7314457c4c965f1b7d59b Mon Sep 17 00:00:00 2001
From: Li Zhou <li.zhou@windriver.com>
Date: Mon, 28 Jun 2021 11:37:20 +0800
Subject: [PATCH 3/3] Add mcx16 cflag to solve linking issue
Linking error is reported as:
MODPOST .../quickassist/lookaside/access_layer/src/Module.symvers
ERROR: modpost: "__sync_bool_compare_and_swap_16"
[.../quickassist/lookaside/access_layer/src/qat_api.ko] undefined!
Add -mcx16 option to enables GCC to generate CMPXCHG16B instructions
in 64-bit code to implement compare-and-exchange operations on 16-byte
aligned 128-bit objects.
Signed-off-by: Li Zhou <li.zhou@windriver.com>
---
quickassist/lookaside/access_layer/src/common/utils/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/quickassist/lookaside/access_layer/src/common/utils/Makefile b/quickassist/lookaside/access_layer/src/common/utils/Makefile
index 1f24380..6948f8c 100644
--- a/quickassist/lookaside/access_layer/src/common/utils/Makefile
+++ b/quickassist/lookaside/access_layer/src/common/utils/Makefile
@@ -112,6 +112,8 @@ ifdef KPT
EXTRA_CFLAGS+=-DKPT
endif
+EXTRA_CFLAGS+=-mcx16
+
#common includes between all supported OSes
INCLUDES+=-I$(LAC_DIR)/src/common/include\
-I$(LAC_DIR)/src/common/compression/include\
--
2.17.1

View File

@@ -0,0 +1,3 @@
0001-crypto-qat-Silence-smp_processor_id-warning.patch
0002-build-Don-t-override-KERNELVERSION-in-a-wrong-way.patch
0003-Add-mcx16-cflag-to-solve-linking-issue.patch

View File

@@ -0,0 +1,93 @@
#!/usr/bin/make -f
#
# Copyright (c) 2021 Wind River Systems, Inc.
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1
%:
dh $@
WITH_MOD_SIGN ?= 0
kheaders_name=$(shell ls /usr/src | grep linux-headers | grep amd64)
export KERNEL_SOURCE_ROOT=/usr/src/$(kheaders_name)
kernel_version=$(shell echo $(kheaders_name) | sed 's/linux-headers-//g')
pkg_name=qat1.7.l
qat_src_dir=./
_sysconfdir=/etc/
_sbindir=/usr/sbin
_libdir=/usr/lib64
buildroot=./debian/$(pkg_name)/
ifeq ($(WITH_MOD_SIGN),1)
_keydir ?= /usr/src/kernels/$(kernel_version)/
privkey ?= $(_keydir)/signing_key.priv
pubkey ?= $(_keydir)/signing_key.x509
endif
override_dh_auto_configure:
./configure --enable-icp-sriov=host
override_dh_auto_build:
make
make sample-all
override_dh_auto_install:
dh_installdirs -p$(pkg_name) $(_sysconfdir)/default
install -m 750 ./debian/extra/qat $(buildroot)/$(_sysconfdir)/default
dh_installdirs -p$(pkg_name) $(_sysconfdir)/qat/conf_files
install -m 640 $(qat_src_dir)/build/*.conf $(buildroot)$(_sysconfdir)/qat/conf_files
install -m 640 $(qat_src_dir)/build/*.vm $(buildroot)$(_sysconfdir)/qat/conf_files
dh_installdirs -p$(pkg_name) $(_sbindir)
install -m 750 $(qat_src_dir)/build/adf_ctl $(buildroot)$(_sbindir)
dh_installdirs -p$(pkg_name) $(_sysconfdir)/init.d/
install -m 750 ./debian/extra/qat_service $(buildroot)$(_sysconfdir)/init.d/
dh_installdirs -p$(pkg_name) $(_libdir)
install -m 750 $(qat_src_dir)/build/*.so $(buildroot)$(_libdir)
dh_installdirs -p$(pkg_name) lib/modules/$(kernel_version)/kernel/drivers/crypto/qat/
install -m 750 $(qat_src_dir)/build/*qat*.ko $(buildroot)/lib/modules/$(kernel_version)/kernel/drivers/crypto/qat/
install -m 750 $(qat_src_dir)/build/usdm_drv.ko $(buildroot)/lib/modules/$(kernel_version)/kernel/drivers/crypto/qat
# intel test sample
dh_installdirs -p$(pkg_name) usr/lib/firmware
install -m 750 $(qat_src_dir)/quickassist/lookaside/access_layer/src/sample_code/build/cpa_sample_code $(buildroot)$(_sbindir)/
install -m 640 $(qat_src_dir)/quickassist/lookaside/access_layer/src/sample_code/performance/compression/calgary $(buildroot)/usr/lib/firmware
install -m 640 $(qat_src_dir)/quickassist/lookaside/access_layer/src/sample_code/performance/compression/calgary32 $(buildroot)/usr/lib/firmware
install -m 640 $(qat_src_dir)/quickassist/lookaside/access_layer/src/sample_code/performance/compression/canterbury $(buildroot)/usr/lib/firmware
# device firmware
# install to the updates directory so this firmware will get grabbed ahead of
# anything supplied by the linux-firmware package
dh_installdirs -p$(pkg_name) usr/lib/firmware/updates
install -m 640 $(qat_src_dir)/build/*.bin $(buildroot)/usr/lib/firmware/updates
override_dh_strip:
dh_strip
find debian -name '*.ko' | xargs strip -g
ifeq ($(WITH_MOD_SIGN),1)
@echo "Sign the modules!"
./debian/sign_modules $(buildroot) $(privkey) $(pubkey)
endif

View File

@@ -0,0 +1,31 @@
#!/bin/bash
# parameters:
# (1) modules' path; (2) privkey for signing; (3) pubkey for signing
privkey=$2
pubkey=$3
if [ ! -f /usr/lib/linux-kbuild-*/scripts/sign-file ]; then
echo "Tool sign-file doesn't exist!"
exit 1
fi
found=0
for module in $(find $1 -type f -name \*.ko); do
found=1
echo ${module}
/usr/lib/linux-kbuild-*/scripts/sign-file sha256 \
${privkey} ${pubkey} ${module}
if [ $? -eq 1 ]; then
echo "Fail to sign!"
exit 1
fi
done
if [ ${found} -eq 1 ]; then
echo "Signed successfully!"
else
echo "No ko found!"
exit 1
fi

View File

@@ -0,0 +1 @@
3.0 (quilt)

View File

@@ -0,0 +1,10 @@
---
debver: 4.14.0-00031
debname: qat1.7.l
dl_path:
name: QAT1.7.L.4.14.0-00031.tar.gz
url: https://downloadmirror.intel.com/30178/eng/QAT1.7.L.4.14.0-00031.tar.gz
md5sum: a6ff665184159583542dac89b9226f09
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true