QAT: Update QAT driver to version 2.0

Intel 4th generation Xeon Scalable Processor (Sapphire Rapids) support
has been introduced for the platform. In order to leverage the
integrated QAT device of the SP-MCC SKUs, QAT driver need to be
upgraded to version 2.0.
To upgrade to version 2.0, the following items have been done:
	1. Update qat related patches for code context change;
	2. Update control, rules and such things for QAT version 2.0.

Test plan:
	- PASS: build-pkgs -a && build-image
	- PASS: lsmod |grep qat
	- PASS: /etc/init.d/qat_service status/start/stop
	- PASS: ./cpa_sample_code

Story: 2010796
Task: 48248

Change-Id: I1cba1660a13d1f28eee2b35713a54d31c048c609
Signed-off-by: Peng Zhang <Peng.Zhang2@windriver.com>
This commit is contained in:
Peng Zhang 2023-08-30 16:53:35 +08:00
parent b541465cc3
commit 137e5b38b1
27 changed files with 185 additions and 1294 deletions

View File

@ -85,9 +85,9 @@ mlnx-ofed-kernel-modules
mlnx-ofed-kernel-modules-rt
mlnx-ofed-kernel-utils
#qat17
qat1.7.l
qat1.7.l-rt
#qat20
qat2.0.l
qat2.0.l-rt
#rdma-core
ibacm
@ -111,3 +111,4 @@ srptools
#mstflint
mstflint

View File

@ -13,7 +13,7 @@ kernel-modules/intel-igb_uio
kernel-modules/intel-opae-fpga
kernel-modules/intel-qv
kernel-modules/mlnx-ofa_kernel
kernel-modules/qat17
kernel-modules/qat
kernel-modules/octeon_ep
userspace/broadcom/libbnxt_re
userspace/mellanox/rdma-core

View File

@ -13,5 +13,5 @@ kernel-modules/intel-igb_uio
kernel-modules/intel-opae-fpga
kernel-modules/intel-qv
kernel-modules/mlnx-ofa_kernel
kernel-modules/qat17
kernel-modules/qat
kernel-modules/octeon_ep

View File

@ -0,0 +1,11 @@
qat2.0.l (1.0.20-00008) unstable; urgency=medium
* Upgrade to version 2.0
-- Peng Zhang2 <peng.zhang2@windriver.com> Wed, 24 May 2023 07:42:06 +0000
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

@ -1,19 +1,19 @@
Source: qat1.7.l
Source: qat2.0.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@KERNEL_TYPE@-headers-5.10.0-6@KERNEL_TYPE@-amd64, linux@KERNEL_TYPE@-kbuild-5.10, linux@KERNEL_TYPE@-keys-5.10
Build-Depends: debhelper-compat (= 13), autotools-dev, pkg-config, libudev-dev, yasm, libssl-dev, libz-dev, pciutils, libboost-dev, perl, openssl, libboost-regex-dev,linux@KERNEL_TYPE@-headers-5.10.0-6@KERNEL_TYPE@-amd64, linux@KERNEL_TYPE@-kbuild-5.10, linux@KERNEL_TYPE@-keys-5.10
Standards-Version: 4.5.1
Rules-Requires-Root: no
Package: qat1.7.l@KERNEL_TYPE@
Package: qat2.0.l@KERNEL_TYPE@
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, qat1.7.l-common
Depends: ${shlibs:Depends}, ${misc:Depends}, qat2.0.l-common
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.
Package: qat1.7.l-common
Package: qat2.0.l-common
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: This package provides the common files of Intel(r) QuickAssist Technology API

View File

@ -2,9 +2,9 @@ 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
Source: https://downloadmirror.intel.com/777529/QAT20.L.1.0.20-00008.tar.gz
Files: *
Copyright: (C) Intel Corporation 2008
Copyright: (C) Intel Corporation 2022
License:
The Licensing of the files within this project splits under various set of
licenses which are listed below.

View File

@ -48,23 +48,25 @@ 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>
[zp: Adapted the patch for context changes.]
Signed-off-by: Peng Zhang <Peng.Zhang2@windriver.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
index abab8db..16cdc58 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 {
@@ -74,7 +74,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
int adf_service_register(struct service_hndl *service);
--
2.25.1

View File

@ -13,23 +13,25 @@ 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>
[zp: Adapted the patch for context changes.]
Signed-off-by: Peng Zhang <Peng.Zhang2@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
index f286394..a131a2e 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
@@ -77,6 +77,8 @@ ifdef ICP_DC_RETURN_COUNTERS_ON_ERROR
EXTRA_CFLAGS += -DICP_DC_RETURN_COUNTERS_ON_ERROR
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
--
2.25.1

View File

@ -0,0 +1,2 @@
0001-crypto-qat-Silence-smp_processor_id-warning.patch
0002-Add-mcx16-cflag-to-solve-linking-issue.patch

View File

@ -0,0 +1,130 @@
#!/usr/bin/make -f
#
# Copyright (c) 2022-2023 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 ?= 1
export DEB_BUILD_OPTIONS=noddebs
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
kheaders_name=$(shell ls /usr/src | grep linux@KERNEL_TYPE@-headers | grep amd64)
export KERNEL_SOURCE_ROOT=/usr/src/$(kheaders_name)
kernel_version=$(shell echo $(kheaders_name) | sed 's/linux@KERNEL_TYPE@-headers-//g')
pkg_name=qat2.0.l@KERNEL_TYPE@
pkg_name_common=qat2.0.l-common
qat_src_dir=./
_sysconfdir=/etc/
_sbindir=/usr/sbin
_libdir=/usr/lib/$(DEB_HOST_MULTIARCH)
_qatsrcdir=/usr/src/qat/quickassist/
buildroot=./debian/$(pkg_name)/
ifeq ($(WITH_MOD_SIGN),1)
_keydir ?= /usr/src/kernels/$(kernel_version)/
privkey ?= $(_keydir)/signing_key.pem
pubkey ?= $(_keydir)/signing_key.x509
endif
override_dh_auto_configure:
# The ./configure script parameters were acquired via the use of
# dh_auto_configure -- --enable-icp-sriov=host
# and looking at the build logs.
#
# dh_auto_configure passes to ./configure the --runstatedir=/run
# argument, but this is not supported by QAT's ./configure script.
# Hence, use a manually prepared ./configure command line.
./configure \
--build=$(DEB_HOST_MULTIARCH) --prefix=/usr --includedir="\$${prefix}/include" --mandir="\$${prefix}/share/man" \
--infodir="\$${prefix}/share/info" --sysconfdir=/etc --localstatedir=/var --libdir="\$${prefix}/lib/$(DEB_HOST_MULTIARCH)" \
--enable-icp-sriov=host
override_dh_auto_build:
$(MAKE)
$(MAKE) sample-all
override_dh_auto_install:
dh_installdirs -p$(pkg_name_common) $(_sysconfdir)default
install -m 750 ./debian/extra/qat debian/$(pkg_name_common)$(_sysconfdir)default
dh_installdirs -p$(pkg_name_common) $(_sysconfdir)qat/conf_files
install -m 640 $(qat_src_dir)build/*.conf debian/$(pkg_name_common)$(_sysconfdir)qat/conf_files
install -m 640 $(qat_src_dir)build/*.vm debian/$(pkg_name_common)$(_sysconfdir)qat/conf_files
dh_installdirs -p$(pkg_name_common) $(_sysconfdir)qat/script_files
install -m 750 $(qat_src_dir)*.sh debian/$(pkg_name_common)$(_sysconfdir)qat/script_files
dh_installdirs -p$(pkg_name_common) $(_sbindir)
install -m 750 $(qat_src_dir)build/adf_ctl debian/$(pkg_name_common)$(_sbindir)
dh_installdirs -p$(pkg_name_common) $(_sysconfdir)init.d/
install -m 750 $(qat_src_dir)quickassist/build_system/build_files/qat_service debian/$(pkg_name_common)$(_sysconfdir)init.d/
dh_installdirs -p$(pkg_name_common) $(_libdir)
install -m 750 $(qat_src_dir)build/*.so debian/$(pkg_name_common)$(_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_common) usr/lib/firmware
install -m 750 $(qat_src_dir)quickassist/lookaside/access_layer/src/sample_code/build/cpa_sample_code debian/$(pkg_name_common)$(_sbindir)/
install -m 640 $(qat_src_dir)quickassist/lookaside/access_layer/src/sample_code/performance/compression/calgary debian/$(pkg_name_common)/usr/lib/firmware
install -m 640 $(qat_src_dir)quickassist/lookaside/access_layer/src/sample_code/performance/compression/calgary32 debian/$(pkg_name_common)/usr/lib/firmware
install -m 640 $(qat_src_dir)quickassist/lookaside/access_layer/src/sample_code/performance/compression/canterbury debian/$(pkg_name_common)/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_common) /usr/lib/firmware/updates
install -m 640 $(qat_src_dir)build/*.bin debian/$(pkg_name_common)/usr/lib/firmware/updates
# Add the driver's header files for qatzip's configuration. We use
# /usr/src/qat/quickassist (i.e., _qatsrcdir) instead of /usr/include,
# because qatlib also installs similar headers to /usr/include, and we
# would like to avoid conflicts. Note that the qatzip build uses the
# headers in /usr/src/qat/quickassist (_qatsrcdir).
dh_installdirs -p$(pkg_name_common) $(_qatsrcdir)/include
install -m 640 $(qat_src_dir)quickassist/include/*.h debian/$(pkg_name_common)/$(_qatsrcdir)/include
dh_installdirs -p$(pkg_name_common) $(_qatsrcdir)/include/dc
install -m 640 $(qat_src_dir)quickassist/include/dc/*.h debian/$(pkg_name_common)/$(_qatsrcdir)/include/dc
dh_installdirs -p$(pkg_name_common) $(_qatsrcdir)/utilities/libusdm_drv
install -m 640 $(qat_src_dir)quickassist/utilities/libusdm_drv/*.h debian/$(pkg_name_common)/$(_qatsrcdir)/utilities/libusdm_drv
dh_installdirs -p$(pkg_name_common) $(_qatsrcdir)/lookaside/access_layer/include
install -m 640 $(qat_src_dir)quickassist/lookaside/access_layer/include/*.h debian/$(pkg_name_common)/$(_qatsrcdir)/lookaside/access_layer/include
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
override_dh_auto_test:
true

View File

@ -0,0 +1,12 @@
---
debver: 1.0.20-00008
debname: qat2.0.l
dl_path:
name: QAT2.0.L.1.0.20-00008.tar.gz
url: https://downloadmirror.intel.com/777529/QAT20.L.1.0.20-00008.tar.gz
sha256sum: 8b8a46897217a806eeca911fe7a5040183fb32897ad20bafedcc07d711436799
revision:
dist: $STX_DIST
GITREVCOUNT:
BASE_SRCREV: 3a55c2449120d1682351c4b9af671768ba3dae51
SRC_DIR: ${MY_REPO}/stx/kernel/kernel-modules/qat

View File

@ -1,13 +0,0 @@
Metadata-Version: 1.1
Name: qat17
Version: 1.0
Summary: Intel(r) QuickAssist Technology API
Home-page: https://01.org/packet-processing/intel%C2%AE-quickassist-technology-drivers-and-patches
Author:
Author-email:
License: GPLv2
Description: Intel(r) QuickAssist Technology API
Platform: UNKNOWN

View File

@ -1,11 +0,0 @@
COPY_LIST=" \
$PKG_BASE/files/* \
$STX_BASE/downloads/QAT1.7.L.4.14.0-00031.tar.gz \
"
OPT_DEP_LIST_FOR_BUILD_TYPE[std]=$GIT_BASE/kernel-std
OPT_DEP_LIST_FOR_BUILD_TYPE[rt]=$GIT_BASE/kernel-rt
BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-std]=145ff64b9734e5c45cfd8eb837a04e257b4b9581
BASE_SRCREV_FOR_PATH[$GIT_BASE/kernel-rt]=c0fee2da8ef34aa816ddd76690ed425b2ff94c90
PKG_BASE_SRCREV=3b8696650cb85c558c1b4c6d315c64d57f178527
TIS_PATCH_VER=PKG_GITREVCOUNT+OTHER_GITREVCOUNT+1
BUILD_IS_SLOW=3

View File

@ -1,148 +0,0 @@
%if "%{?_tis_build_type}" == "rt"
%define bt_ext -rt
%else
%undefine bt_ext
%endif
Summary: Intel(r) QuickAssist Technology API
%define pkgname qat17
Name: %{pkgname}%{?bt_ext}
Version: 4.14.0
%define upstream_release 00031
Release: %{upstream_release}%{?_tis_dist}.%{tis_patch_ver}
License: GPLv2
Group: base
Packager: Wind River <info@windriver.com>
URL: https://01.org/packet-processing/intel%C2%AE-quickassist-technology-drivers-and-patches
BuildRequires: kernel%{?bt_ext}-devel, kernel%{?bt_ext}-devel-keys
BuildRequires: zlib-devel
BuildRequires: openssl-devel
BuildRequires: pciutils
BuildRequires: libudev-devel
BuildRequires: boost-devel
BuildRequires: perl
BuildRequires: openssl
BuildRequires: elfutils-libelf-devel
BuildRequires: yasm
%if 0%{?rhel} == 7
BuildRequires: devtoolset-8-build
BuildRequires: devtoolset-8-binutils
BuildRequires: devtoolset-8-gcc
BuildRequires: devtoolset-8-make
%endif
%define icp_tools accelcomp
%define kernel_version %(rpm -q kernel%{?bt_ext}-devel | sed 's/kernel%{?bt_ext}-devel-//')
%define staging_kernel_dir /usr/src/kernels/%{kernel_version}/
%define qat_unpack_dir %{_builddir}/%{name}-%{version}
%define qat_src_dir %{qat_unpack_dir}
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: crypto-qat-Silence-smp_processor_id-warning.patch
Patch2: qat17-build-Do-not-override-KERNELVERSION-with-build-machi.patch
%description
Intel(r) QuickAssist Technology API
%prep
rm -rf %{qat_unpack_dir}
mkdir -p %{qat_unpack_dir}
cd %{qat_unpack_dir}
gzip -dc %{_sourcedir}/QAT1.7.L.%{version}-%{upstream_release}.tar.gz | tar -xvvf -
if [ $? -ne 0 ]; then
exit $?
fi
%patch1 -p1
%patch2 -p1
%build
%if 0%{?rhel} == 7
source scl_source enable devtoolset-8 || :
%endif
ICP_ROOT=%{qat_src_dir}
KERNEL_SOURCE_ROOT=%{staging_kernel_dir}
mkdir -p %{qat_src_dir}/build
ICP_BUILD_OUTPUT=%{qat_src_dir}/build
export ICP_ROOT KERNEL_SOURCE_ROOT ICP_BUILD_OUTPUT
cd %{qat_src_dir}
%configure --enable-icp-sriov=host
make -C %{qat_src_dir}/
# intel test sample
make -C %{qat_src_dir}/ sample-all
%install
%if 0%{?rhel} == 7
source scl_source enable devtoolset-8 || :
%endif
%{__install} -d %{buildroot}%{_sysconfdir}/default
%{__install} -m 750 %SOURCE1 %{buildroot}%{_sysconfdir}/default
%{__install} -d %{buildroot}%{_sysconfdir}/modprobe.d
%{__install} -d %{buildroot}%{_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
%{__install} -d %{buildroot}%{_sbindir}
%{__install} -m 750 %{qat_src_dir}/build/adf_ctl %{buildroot}%{_sbindir}
%{__install} -d %{buildroot}%{_sysconfdir}/init.d
%{__install} -m 750 %SOURCE2 %{buildroot}%{_sysconfdir}/init.d/qat_service
%{__install} -d %{buildroot}%{_libdir}
%{__install} -m 750 %{qat_src_dir}/build/*.so %{buildroot}%{_libdir}
%{__install} -d %{buildroot}/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
%{__install} -d %{buildroot}/usr/lib/firmware
%{__install} -m 750 %{qat_src_dir}/build/cpa_sample_code %{buildroot}%{_sbindir}/cpa_sample_code
%{__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
%{__install} -d %{buildroot}/usr/lib/firmware/updates
%{__install} -m 640 %{qat_src_dir}/build/*.bin %{buildroot}/usr/lib/firmware/updates
# Strip the modules(s).
find %{buildroot} -type f -name \*.ko -exec %{__strip} --strip-debug \{\} \;
# Always Sign the modules(s).
# If the module signing keys are not defined, define them here.
%{!?privkey: %define privkey /usr/src/kernels/%{kernel_version}/signing_key.pem}
%{!?pubkey: %define pubkey /usr/src/kernels/%{kernel_version}/signing_key.x509}
for module in $(find %{buildroot} -type f -name \*.ko);
do /usr/src/kernels/%{kernel_version}/scripts/sign-file \
sha256 %{privkey} %{pubkey} $module;
done
%clean
%{__rm} -rf %{buildroot}
%files
"%{_sbindir}/*"
"%{_sysconfdir}/default/qat"
"%{_sysconfdir}/init.d/qat_service"
"/lib/modules/%{kernel_version}/kernel/drivers/crypto/qat/*.ko"
"%{_libdir}/*.so"
"/usr/lib/firmware/*"
"/usr/lib/firmware/updates/*"
"%{_sysconfdir}/qat/*"
"%{_sysconfdir}/qat/conf_files/*"

View File

@ -1,5 +0,0 @@
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

@ -1,384 +0,0 @@
#!/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

@ -1,69 +0,0 @@
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

@ -1,3 +0,0 @@
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

@ -1,99 +0,0 @@
#!/usr/bin/make -f
#
# Copyright (c) 2021-2022 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 ?= 1
export DEB_BUILD_OPTIONS=noddebs
kheaders_name=$(shell ls /usr/src | grep linux@KERNEL_TYPE@-headers | grep amd64)
export KERNEL_SOURCE_ROOT=/usr/src/$(kheaders_name)
kernel_version=$(shell echo $(kheaders_name) | sed 's/linux@KERNEL_TYPE@-headers-//g')
pkg_name=qat1.7.l@KERNEL_TYPE@
pkg_name_common=qat1.7.l-common
qat_src_dir=./
_sysconfdir=/etc/
_sbindir=/usr/sbin
_libdir=/usr/lib/
buildroot=./debian/$(pkg_name)/
ifeq ($(WITH_MOD_SIGN),1)
_keydir ?= /usr/src/kernels/$(kernel_version)/
privkey ?= $(_keydir)/signing_key.pem
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_common) $(_sysconfdir)/default
install -m 750 ./debian/extra/qat debian/$(pkg_name_common)/$(_sysconfdir)/default
dh_installdirs -p$(pkg_name_common) $(_sysconfdir)/qat/conf_files
install -m 640 $(qat_src_dir)/build/*.conf debian/$(pkg_name_common)/$(_sysconfdir)/qat/conf_files
install -m 640 $(qat_src_dir)/build/*.vm debian/$(pkg_name_common)/$(_sysconfdir)/qat/conf_files
dh_installdirs -p$(pkg_name_common) $(_sbindir)
install -m 750 $(qat_src_dir)/build/adf_ctl debian/$(pkg_name_common)/$(_sbindir)
dh_installdirs -p$(pkg_name_common) $(_sysconfdir)/init.d/
install -m 750 ./debian/extra/qat_service debian/$(pkg_name_common)/$(_sysconfdir)/init.d/
dh_installdirs -p$(pkg_name_common) $(_libdir)
install -m 750 $(qat_src_dir)/build/*.so debian/$(pkg_name_common)/$(_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_common) usr/lib/firmware
install -m 750 $(qat_src_dir)/quickassist/lookaside/access_layer/src/sample_code/build/cpa_sample_code debian/$(pkg_name_common)/$(_sbindir)/
install -m 640 $(qat_src_dir)/quickassist/lookaside/access_layer/src/sample_code/performance/compression/calgary debian/$(pkg_name_common)/usr/lib/firmware
install -m 640 $(qat_src_dir)/quickassist/lookaside/access_layer/src/sample_code/performance/compression/calgary32 debian/$(pkg_name_common)/usr/lib/firmware
install -m 640 $(qat_src_dir)/quickassist/lookaside/access_layer/src/sample_code/performance/compression/canterbury debian/$(pkg_name_common)/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_common) usr/lib/firmware/updates
install -m 640 $(qat_src_dir)/build/*.bin debian/$(pkg_name_common)/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
override_dh_auto_test:
true

View File

@ -1,12 +0,0 @@
---
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
GITREVCOUNT:
BASE_SRCREV: 3a55c2449120d1682351c4b9af671768ba3dae51
SRC_DIR: ${MY_REPO}/stx/kernel/kernel-modules/qat17

View File

@ -1,70 +0,0 @@
From 5d3c6cab1726c79855561327b65a19ab982891e5 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] 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 35f0f44..d0ff355 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
@@ -100,7 +100,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.7.4

View File

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

View File

@ -1,70 +0,0 @@
From 87f6c5a8e843461df50229f2b07ba69bc98b7e04 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] build: Do not override KERNELVERSION with build machine's
kernel version
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.31.1

View File

@ -1,384 +0,0 @@
#!/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