x64: add Intel® QuickAssist Technology openssl crypto hardware accel suuport (C2558 and C3558 SOC)

This commit is contained in:
lean 2022-04-20 15:32:30 +08:00
parent 13aa14c64b
commit 535f8ec1f0
43 changed files with 8826 additions and 0 deletions

View File

@ -0,0 +1,9 @@
menu "Configuration"
depends on PACKAGE_kmod-crypto-qat-c2xxx
config CRYPTO_QAT_DEBUG
bool
default n
prompt "Build with debugging support enabled"
endmenu

View File

@ -0,0 +1,160 @@
#
# Copyright (C) DL <revelstone@yahoo.com>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=quickassist-c2xxx
PKG_VERSION:=1.5
PKG_RELEASE:=2
PKG_SOURCE_VERSION:=1.5.l.1.13.0-19
PKG_SOURCE:=qat$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_URL:=https://01.org/sites/default/files/downloads/intel-quickassist-technology/
PKG_HASH:=afe8339edbbf05099e79c256191584aabf30b564f89a553b9585b2f8e18bee17
PKG_LICENSE:=GPL v3
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_PARALLEL:=0
define Package/quickassist-c2xxx
SECTION:=firmware
CATEGORY:=Firmware
TITLE:=Intel Quick Assist meta-package for c2xxx
DEPENDS:= \
@TARGET_x86_64 \
@LINUX_4_14 \
+libopenssl \
+kmod-crypto-qat-c2xxx \
+kmod-crypto-qat-c2xxx-usdm
endef
define Package/quickassist-c2xxx/config
depends on !quickassist-c3xxx-enabled
config quickassist-c2xxx-enabled
bool
default y if PACKAGE_quickassist-c2xxx
default n
endef
define Package/quickassist-c2xxx/description
Intel Quick Assist v1.5 utilities and firmware for c2xxx series SoCs
endef
#
# QAT 1.5 kernel driver
#
define KernelPackage/crypto-qat-c2xxx
SUBMENU:=Cryptographic API modules
TITLE:=Intel Quick Assist Technology Drivers
DEPENDS:= \
@TARGET_x86_64 \
@LINUX_4_14 \
+libc \
+libpthread \
+libopenssl \
+kmod-crypto-manager \
+kmod-crypto-cbc \
+kmod-crypto-sha1 \
+kmod-crypto-sha256 \
+kmod-crypto-sha512
FILES:=$(PKG_BUILD_DIR)/build/icp_qa_al.ko
endef
define KernelPackage/crypto-qat-c2xxx/description
Kernel driver for Intel Quick Assist Technology c2xxx
endef
define KernelPackage/crypto-qat-c2xxx/config
depends on quickassist-c2xxx-enabled
source "$(SOURCE)/Config.in"
endef
#
# QAT 1.7 contiguous pinned memory driver
#
define KernelPackage/crypto-qat-c2xxx-usdm
SUBMENU:=Cryptographic API modules
TITLE:=Quick Assist Pinned Memory Driver
DEPENDS:= \
@TARGET_x86_64 \
@LINUX_4_14
FILES:=$(PKG_BUILD_DIR)/build/usdm_drv.ko
AUTOLOAD:=$(call AutoProbe,usdm_drv)
endef
define KernelPackage/crypto-qat-c2xxx-usdm/config
depends on quickassist-c2xxx-enabled
endef
define KernelPackage/crypto-qat-c2xxx-usdm/description
Contiguous pinned memory driver for Intel Quick Assist Technology
endef
ICP_ARCH = x86_64
MAKE_PATH = quickassist
MAKE_FLAGS = ARCH_USER="$(ICP_ARCH)"
MAKE_VARS += ICP_ROOT="$(PKG_BUILD_DIR)" \
CROSS_COMPILE="$(KERNEL_CROSS)" \
KERNEL_SOURCE_ROOT="$(LINUX_DIR)" \
MACHINE="$(ICP_ARCH)" \
ICP_BUILD_OUTPUT="$(PKG_BUILD_DIR)/build" \
ICP_ENV_DIR="$(PKG_BUILD_DIR)/quickassist/build_system/build_files/env_files" \
ICP_BUILDSYSTEM_PATH="$(PKG_BUILD_DIR)/quickassist/build_system" \
ICP_TOOLS_TARGET="accelcomp" \
ICP_NONBLOCKING_PARTIALS_PERFORM="1" \
ICP_ARCH_USER="$(ICP_ARCH)" \
LIB_SHARED_FLAGS="-L$(STAGING_DIR)/usr/lib" \
LD_LIBRARY_PATH="$(PKG_BUILD_DIR)/build"
define Build/Prepare
(mkdir -p '$(PKG_BUILD_DIR)' && zcat '$(DL_DIR)/$(PKG_SOURCE)' | tar -C '$(PKG_BUILD_DIR)' -xf -)
$(Build/Patch)
endef
define Build/Compile
$(call Build/Compile/Default)
$(call Build/Compile/Default, -C $(PKG_BUILD_DIR)/quickassist/lookaside/access_layer/src/sample_code perf_all)
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/icp/quickassist
$(INSTALL_DIR) $(1)/usr/icp/build
$(CP) $(PKG_BUILD_DIR)/build/lib*.{a,so*} $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/quickassist/include/{*.h,dc,lac} $(1)/usr/include
$(CP) $(PKG_BUILD_DIR)/quickassist/lookaside/access_layer/include/*.h $(1)/usr/include
$(CP) $(PKG_BUILD_DIR)/quickassist $(1)/usr/icp
$(CP) $(PKG_BUILD_DIR)/build $(1)/usr/icp
endef
define Package/quickassist/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/lib/firmware
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/usr/share/quickassist/QAT1.5/config
$(CP) $(PKG_BUILD_DIR)/quickassist/config/* $(1)/usr/share/quickassist/QAT1.5/config
$(CP) $(PKG_BUILD_DIR)/build/adf_ctl $(1)/usr/sbin/adf_ctl
$(CP) $(PKG_BUILD_DIR)/quickassist/adf/build/linux_2.6/icp_gige_watchdog $(1)/usr/sbin/icp_gige_watchdog
$(CP) $(PKG_BUILD_DIR)/build/lib*.{a,so*} $(1)/lib/
$(CP) $(PKG_BUILD_DIR)/build/*.bin $(1)/lib/firmware/
$(CP) ./files/qat.init $(1)/etc/init.d/qat
$(CP) ./files/qat_watchdog.init $(1)/etc/init.d/qat_watchdog
$(CP) ./files/c2xxx_qa_dev0_single_ae.conf $(1)/etc/c2xxx_qa_dev0.conf
endef
$(eval $(call BuildPackage,quickassist-c2xxx))
$(eval $(call KernelPackage,crypto-qat-c2xxx))
$(eval $(call KernelPackage,crypto-qat-c2xxx-usdm))

View File

@ -0,0 +1,175 @@
#########################################################################
#
# @par
# # This file is provided under a dual BSD/GPLv2 license. When using or
# redistributing this file, you may do so under either license.
#
# GPL LICENSE SUMMARY
#
# Copyright(c) 2007-2020 Intel Corporation. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
# The full GNU General Public License is included in this distribution
# in the file called LICENSE.GPL.
#
# Contact Information:
# Intel Corporation
#
# BSD LICENSE
#
# Copyright(c) 2007-2020 Intel Corporation. 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.
#
#
#########################################################################
########################################################
# General Section
##############################################
[GENERAL]
ServicesEnabled = cy0
# Use version 2 of the config file
ConfigVersion = 2
# Look Aside Cryptographic Configuration
cyHmacAuthMode = 1
# Firmware Location Configuration
Firmware_MofPath = mof_firmware_c2xxx.bin
Firmware_MmpPath = mmp_firmware_c2xxx.bin
#Default values for number of concurrent requests*/
CyNumConcurrentSymRequests = 512
CyNumConcurrentAsymRequests = 64
#Statistics, valid values: 1,0
statsGeneral = 1
statsDh = 1
statsDrbg = 1
statsDsa = 1
statsEcc = 1
statsKeyGen = 1
statsLn = 1
statsPrime = 1
statsRsa = 1
statsSym = 1
#Debug feature, if set to 1 it enables additional entries in /proc filesystem
ProcDebug = 1
#######################################################
# Wireless Section
#######################################################
[WIRELESS]
NumProcesses = 0
#######################################################
#
# Logical Instances Section
# A logical instance allows each address domain
# (kernel space and individual user space processes)
# to configure rings (i.e. hardware assisted queues)
# to be used by that address domain and to define the
# behavior of that ring.
#
# The address domains are in the following format
# - For kernel address domains
# [KERNEL]
# - For user process address domains
# [xxxxx]
# Where xxxxx may be any ascii value which uniquely identifies
# the user mode process.
# To allow the driver correctly configure the
# logical instances associated with this user process,
# the process must call the icp_sal_userStart(...)
# passing the xxxxx string during process initialisation.
# When the user space process is finish it must call
# icp_sal_userStop(...) to free resources.
# NumProcesses will indicate the maximum number of processes
# that can call icp_sal_userStart on this instance.
# Warning: the ressources are preallocated: if NumProcesses
# is too high, the driver will fail to load
#
# Items configurable by a logical instance are:
# - Name of the logical instance
# - The accelerator associated with this logical
# instance
# - The core the instance is affinitized to (optional)
#
# Note: Logical instances may not share the same ring, but
# may share a ring bank.
#
# The format of the logical instances are:
# - For crypto:
# Cy<n>Name = "xxxx"
# Cy<n>AcceleratorNumber = 0-1
# Cy<n>CoreAffinity = 0-7
#
# Note: for user space processes, a list of values can be specified for
# the core affinity: for example
# Cy0CoreAffinity = 0,2,4
#
# Where:
# - n is the number of this logical instance starting at 0.
# - xxxx may be any ascii value which identifies the logical instance.
#
########################################################
##############################################
# Kernel Instances Section
##############################################
[KERNEL]
NumberCyInstances = 0
##############################################
# Compression multi thread/process section
##############################################
[SHIM]
NumberCyInstances = 1
NumProcesses = 8
LimitDevAccess = 1
# Crypto - User space
Cy0Name = "UserCY0"
Cy0AcceleratorNumber = 0
Cy0IsPolled = 1
Cy0CoreAffinity = 0

View File

@ -0,0 +1,140 @@
#!/bin/sh /etc/rc.common
# Adapted from Intel QAT1.5 qat_service. Portions copyright Intel Corporation
#################################################################
#
# This file is provided under a dual BSD/GPLv2 license. When using or
# redistributing this file, you may do so under either license.
#
# GPL LICENSE SUMMARY
#
# Copyright(c) 2007-2013 Intel Corporation. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
# The full GNU General Public License is included in this distribution
# in the file called LICENSE.GPL.
#
# Contact Information:
# Intel Corporation
#
# BSD LICENSE
#
# Copyright(c) 2007-2013 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.5.L.1.10.0-80
#
#################################################################
# qat Start/Stop the Intel QAT.
#
# description: modprobe the QAT icp_qa_al.ko, which loads dependant \
# modules, before calling the user space \
# utility to pass configuration parameters
START=29
STOP=99
PROG=/usr/sbin/adf_ctl
KMOD=icp_qa_al
NETKEY=icp_qat_netkey.ko
EXTRA_COMMANDS="status"
EXTRA_HELP=" status Show the status of the qat device"
status() {
${PROG} status
if [ "$?" -ne 0 ]
then
echo "No devices found. Please start the driver using:"
echo "$0 start"
fi
}
start() {
# First check if the modules are already installed
# install them as necessary and if they are LKMs
# and not built-in kernel modules
if [ `lsmod | grep -c "sha512"` == 0 ]; then
if [ `cat /proc/kallsyms |grep -c sha512_generic` == 0 ]; then
`modprobe sha512`
fi
fi
if [ `lsmod | grep -c "sha256"` == 0 ]; then
if [ `cat /proc/kallsyms |grep -c sha256_generic` == 0 ]; then
`modprobe sha256`
fi
fi
lsmod | grep ${KMOD} >/dev/null 2>&1 || modprobe ${KMOD}
# Check device status, try to turn it on only if driver is loaded
${PROG} $2 status | grep state=down >/dev/null 2>&1
if [ $? = 0 ]; then
${PROG} $2 up
fi
# lsmod | grep ${NETKEY} >/dev/null 2>&1 || modprobe ${NETKEY} 2> /dev/null
# Show device status
${PROG} $2 status
}
stop() {
${PROG} $2 down
}
restart() {
${PROG} $2 down && ${PROG} $2 up
}

View File

@ -0,0 +1,119 @@
#!/bin/bash /etc/rc.common
#################################################################
#
# This file is provided under a dual BSD/GPLv2 license. When using or
# redistributing this file, you may do so under either license.
#
# GPL LICENSE SUMMARY
#
# Copyright(c) 2007-2013 Intel Corporation. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
# The full GNU General Public License is included in this distribution
# in the file called LICENSE.GPL.
#
# Contact Information:
# Intel Corporation
#
# BSD LICENSE
#
# Copyright(c) 2007-2013 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.5.L.1.10.0-80
#
#################################################################
START=99
STOP=99
PROG=/usr/sbin/icp_gige_watchdog
PID="`ps | grep ${PROG} | grep -v grep | awk '{print $1}'`"
EXTRA_COMMANDS="status"
EXTRA_HELP=" status Show the status of the qat device"
status() {
if [ -z "$PID" ]
then
echo "${PROG} not running"
else
echo "${PROG} running: ${PID}"
fi
}
start() {
if [ -z "$PID" ]
then
${PROG} &
else
echo "Already running pid: ${PID}"
fi
}
stop() {
if [ -z "$PID" ]
then
echo "${PROG} not running"
else
kill -USR1 ${PID}
fi
}
restart() {
stop
start
}

View File

@ -0,0 +1,360 @@
--- a/quickassist/adf/accel_mgr/src/adf_cfg.c
+++ b/quickassist/adf/accel_mgr/src/adf_cfg.c
@@ -545,9 +545,10 @@ CpaStatus adf_cfgAddKeyValueParam(icp_ac
}
else if(ADF_HEX == type)
{
- value_addr = (Cpa64U *)val;
- snprintf(pKeyValue->val, ADF_CFG_MAX_VAL_LEN_IN_BYTES,
- "0x%p", value_addr);
+// value_addr = (Cpa64U *)val;
+// snprintf(pKeyValue->val, ADF_CFG_MAX_VAL_LEN_IN_BYTES,
+// "0x%p", value_addr);
+ snprintf(pKeyValue->val, ADF_CFG_MAX_VAL_LEN_IN_BYTES,"0x%lx", (uintptr_t)val);
}
else
{
--- a/quickassist/adf/accelengine/src/adf_ae.c
+++ b/quickassist/adf/accelengine/src/adf_ae.c
@@ -222,6 +222,7 @@ CpaStatus adf_aeFwLoad(icp_accel_dev_t *
/* Get the UoF FW and Map the memory to the AEs */
status = adf_aefwGetFirmware(pAccelDev, ADF_FW_UOF_TYPE, &addr, &size);
ICP_CHECK_STATUS(status);
+
/* load ucode for patching, ucode_map */
status = adf_aeUcodeMap(pAccelDev, addr, size);
if (CPA_STATUS_SUCCESS != status)
--- a/quickassist/adf/accelengine/src/adf_ae_fw.c
+++ b/quickassist/adf/accelengine/src/adf_ae_fw.c
@@ -147,7 +147,6 @@ CpaStatus adf_aefwLoadFirmware(icp_accel
return CPA_STATUS_FAIL;
}
ICP_MEMCPY(pUofFwAddr, pFwAddr, fwSize);
-
/*
* Add the local copies to the config table.
* When the memory address is needed again it can be queried from
@@ -356,14 +355,13 @@ CpaStatus adf_aefwGetFirmware(icp_accel_
status_addr = icp_adf_cfgGetParamValue(pAccelDev, INTERNAL_SEC,
ICP_CFG_UOF_ADDRESS_KEY, config_value);
*pAddr = (void *)ICP_STRTOUL(config_value, NULL, ADF_CFG_BASE_HEX);
- status_size = icp_adf_cfgGetParamValue(pAccelDev, INTERNAL_SEC,
+ status_size = icp_adf_cfgGetParamValue(pAccelDev, INTERNAL_SEC,
ICP_CFG_UOF_SIZE_BYTES_KEY, config_value);
*pSize = (Cpa32U)ICP_STRTOUL(config_value, NULL, ADF_CFG_BASE_DEC);
break;
case ADF_FW_MMP_TYPE:
status_addr = icp_adf_cfgGetParamValue(pAccelDev, INTERNAL_SEC,
ICP_CFG_MMP_ADDRESS_KEY, config_value);
- *pAddr = (void *)ICP_STRTOUL(config_value, NULL, ADF_CFG_BASE_HEX);
status_size = icp_adf_cfgGetParamValue(pAccelDev, INTERNAL_SEC,
ICP_CFG_MMP_SIZE_BYTES_KEY, config_value);
*pSize = (Cpa32U)ICP_STRTOUL(config_value, NULL, ADF_CFG_BASE_DEC);
--- a/quickassist/adf/drivers/ACCELDEV/linux/src/adf_acceldev_drv.c
+++ b/quickassist/adf/drivers/ACCELDEV/linux/src/adf_acceldev_drv.c
@@ -911,7 +911,7 @@ int adf_restore_dev(icp_accel_dev_t *acc
ADF_ERROR("Can not issue secondary bus reset\n");
ADF_ERROR("Trying FLR\n");
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
- ret = __pci_reset_function(pdev);
+ ret = pci_reset_function(pdev);
if (ret) {
ADF_ERROR("Could not reset device\n");
return ret;
--- a/quickassist/adf/drivers/ACCELDEV/linux/src/adf_acceldev_isr.c
+++ b/quickassist/adf/drivers/ACCELDEV/linux/src/adf_acceldev_isr.c
@@ -214,7 +214,7 @@ STATIC int adf_enable_msix(icp_accel_dev
(hw_data->msix.aeVectorStart - hw_data->msix.banksVectorNum);
}
- stat = pci_enable_msix(pci_dev_info->pDev,
+ stat = pci_enable_msix_exact(pci_dev_info->pDev,
pci_dev_info->msixEntries.value,
msix_num_entries);
if (SUCCESS != stat){
--- a/quickassist/adf/drivers/common/linux/src/adf_dev_csr.c
+++ b/quickassist/adf/drivers/common/linux/src/adf_dev_csr.c
@@ -80,6 +80,7 @@
#include "adf_dev_csr.h"
#include "adf_platform.h"
#include <linux/mutex.h>
+#include <linux/sched/signal.h>
#define ADF_DEV_CSR_NAME ("icp_dev_csr")
#define ADF_DEV_CSR_MAX_MINOR (255)
--- a/quickassist/adf/drivers/common/linux/src/adf_dev_ring.c
+++ b/quickassist/adf/drivers/common/linux/src/adf_dev_ring.c
@@ -87,6 +87,7 @@
#include "icp_adf_init.h"
#include "icp_adf_cfg.h"
#include "adf_proc_debug.h"
+#include <linux/sched/signal.h>
#define ADF_DEV_RING_NAME ("icp_dev_ring")
#define ADF_DEV_RING_MAX_MINOR (255)
--- a/quickassist/adf/drivers/common/linux/src/adf_gige_wd_drv.c
+++ b/quickassist/adf/drivers/common/linux/src/adf_gige_wd_drv.c
@@ -76,6 +76,8 @@
#include "adf_platform.h"
#include <linux/mutex.h>
#include <linux/completion.h>
+#include <linux/sched/signal.h>
+
/* Character Device Driver Name */
#define DEVICE_NAME "icp_adf_gige_wd"
#define COMPLETION_TIME 5000
--- a/quickassist/adf/drivers/common/linux/src/adf_proc_debug.c
+++ b/quickassist/adf/drivers/common/linux/src/adf_proc_debug.c
@@ -132,17 +132,13 @@ static int adf_debug_show(struct seq_fil
{
debug_file_info_t* file_info = sfile->private;
if (file_info && file_info->seq_read && file_info->page) {
- int ret = 0, old_offset = file_info->offset;
- file_info->offset =
- file_info->seq_read(file_info->private_data,
- file_info->page, PAGE_SIZE - 1,
- file_info->offset);
- ret = seq_puts(sfile, (char*)file_info->page);
- if (ret) {
- /* run out of space - need to reprint */
- file_info->offset = old_offset;
- }
+ file_info->offset =
+ file_info->seq_read(file_info->private_data,
+ file_info->page, PAGE_SIZE - 1,
+ file_info->offset);
+ seq_puts(sfile, (char*)file_info->page);
}
+
return 0;
}
--- a/quickassist/adf/include/icp_adf_transport_dp.h
+++ b/quickassist/adf/include/icp_adf_transport_dp.h
@@ -79,7 +79,7 @@
* Data plain support function - returns the pointer to next message on the ring
* or NULL if there is not enough space.
*/
-inline void icp_adf_getQueueMemory(icp_comms_trans_handle trans_handle,
+void icp_adf_getQueueMemory(icp_comms_trans_handle trans_handle,
Cpa32U numberRequests,
void** pCurrentQatMsg);
/*
@@ -87,7 +87,7 @@ inline void icp_adf_getQueueMemory(icp_c
* Data plain support function - returns the pointer to next message on the ring
* or NULL if there is not enough space - it also updates the shadow tail copy.
*/
-inline void icp_adf_getSingleQueueAddr(icp_comms_trans_handle trans_handle,
+void icp_adf_getSingleQueueAddr(icp_comms_trans_handle trans_handle,
void** pCurrentQatMsg);
/*
@@ -95,26 +95,26 @@ inline void icp_adf_getSingleQueueAddr(i
* Data plain support function - increments the tail pointer and returns
* the pointer to next message on the ring.
*/
-inline void icp_adf_getQueueNext(icp_comms_trans_handle trans_handle,
+void icp_adf_getQueueNext(icp_comms_trans_handle trans_handle,
void** pCurrentQatMsg);
/*
* icp_adf_updateQueueTail
* Data plain support function - Writes the tail shadow copy to the device.
*/
-inline void icp_adf_updateQueueTail(icp_comms_trans_handle trans_handle);
+void icp_adf_updateQueueTail(icp_comms_trans_handle trans_handle);
/*
* icp_adf_isRingEmpty
* Data plain support function - check if the ring is empty
*/
-inline CpaBoolean icp_adf_isRingEmpty(icp_comms_trans_handle trans_handle);
+CpaBoolean icp_adf_isRingEmpty(icp_comms_trans_handle trans_handle);
/*
* icp_adf_pollQueue
* Data plain support function - Poll messages from the queue.
*/
-inline CpaStatus icp_adf_pollQueue(icp_comms_trans_handle trans_handle,
+CpaStatus icp_adf_pollQueue(icp_comms_trans_handle trans_handle,
Cpa32U response_quota);
/*
@@ -123,6 +123,6 @@ inline CpaStatus icp_adf_pollQueue(icp_c
* send. This should only be called on request rings. If the function returns
* true then it is ok to call icp_adf_updateQueueTail() function on this ring.
*/
-inline CpaBoolean icp_adf_queueDataToSend(icp_comms_trans_handle trans_hnd);
+CpaBoolean icp_adf_queueDataToSend(icp_comms_trans_handle trans_hnd);
#endif /* ICP_ADF_TRANSPORT_DP_H */
--- a/quickassist/adf/include/icp_platform_linux.h
+++ b/quickassist/adf/include/icp_platform_linux.h
@@ -90,7 +90,7 @@
#include <linux/fs.h>
#include <linux/cdev.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include "Osal.h"
--- a/quickassist/adf/user/user_proxy/src/adf_user_ETring_mgr_dp.c
+++ b/quickassist/adf/user/user_proxy/src/adf_user_ETring_mgr_dp.c
@@ -84,7 +84,7 @@
* Data plain support function - returns the pointer to next message on the ring
* or NULL if there is not enough space.
*/
-inline void icp_adf_getQueueMemory(icp_comms_trans_handle trans_hnd,
+void icp_adf_getQueueMemory(icp_comms_trans_handle trans_hnd,
Cpa32U numberRequests,
void** pCurrentQatMsg)
{
@@ -114,7 +114,7 @@ inline void icp_adf_getQueueMemory(icp_c
* Data plane support function - returns the pointer to next message on the ring
* or NULL if there is not enough space - it also updates the shadow tail copy.
*/
-inline void icp_adf_getSingleQueueAddr(icp_comms_trans_handle trans_hnd,
+void icp_adf_getSingleQueueAddr(icp_comms_trans_handle trans_hnd,
void** pCurrentQatMsg)
{
adf_dev_ring_handle_t *pRingHandle = (adf_dev_ring_handle_t *)trans_hnd;
@@ -147,7 +147,7 @@ inline void icp_adf_getSingleQueueAddr(i
* Data plain support function - increments the tail pointer and returns
* the pointer to next message on the ring.
*/
-inline void icp_adf_getQueueNext(icp_comms_trans_handle trans_hnd,
+void icp_adf_getQueueNext(icp_comms_trans_handle trans_hnd,
void** pCurrentQatMsg)
{
adf_dev_ring_handle_t *pRingHandle = (adf_dev_ring_handle_t *)trans_hnd;
@@ -168,7 +168,7 @@ inline void icp_adf_getQueueNext(icp_com
* icp_adf_updateQueueTail
* Data plain support function - Writes the tail shadow copy to the device.
*/
-inline void icp_adf_updateQueueTail(icp_comms_trans_handle trans_hnd)
+void icp_adf_updateQueueTail(icp_comms_trans_handle trans_hnd)
{
adf_dev_ring_handle_t *pRingHandle = (adf_dev_ring_handle_t *)trans_hnd;
icp_accel_dev_t *accel_dev = (icp_accel_dev_t*) pRingHandle->accel_dev;
@@ -183,7 +183,7 @@ inline void icp_adf_updateQueueTail(icp_
* icp_adf_isRingEmpty
* Data plain support function - check if the ring is empty
*/
-inline CpaBoolean icp_adf_isRingEmpty(icp_comms_trans_handle trans_hnd)
+CpaBoolean icp_adf_isRingEmpty(icp_comms_trans_handle trans_hnd)
{
Cpa32U mask = 0;
adf_dev_ring_handle_t *pRingHandle = (adf_dev_ring_handle_t *)trans_hnd;
@@ -205,7 +205,7 @@ inline CpaBoolean icp_adf_isRingEmpty(ic
* * icp_adf_pollQueue
* * Data plain support function - Poll messages from the queue.
* */
-inline CpaStatus icp_adf_pollQueue(icp_comms_trans_handle trans_hnd,
+CpaStatus icp_adf_pollQueue(icp_comms_trans_handle trans_hnd,
Cpa32U response_quota)
{
adf_dev_ring_handle_t *pRingHandle = (adf_dev_ring_handle_t *)trans_hnd;
@@ -260,7 +260,7 @@ inline CpaStatus icp_adf_pollQueue(icp_c
* send. This should only be called on request rings. If the function returns
* true then it is ok to call icp_adf_updateQueueTail() function on this ring.
*/
-inline CpaBoolean icp_adf_queueDataToSend(icp_comms_trans_handle trans_hnd)
+CpaBoolean icp_adf_queueDataToSend(icp_comms_trans_handle trans_hnd)
{
adf_dev_ring_handle_t *ringData = (adf_dev_ring_handle_t *)trans_hnd;
icp_accel_dev_t *accel_dev = (icp_accel_dev_t*) ringData->accel_dev;
--- a/quickassist/build_system/build_files/OS/linux_2.6_kernel_space_rules.mk
+++ b/quickassist/build_system/build_files/OS/linux_2.6_kernel_space_rules.mk
@@ -73,15 +73,15 @@ endif
$(LIB_STATIC): dirs
@echo 'Creating static library ${LIB_STATIC}'; \
$(MAKE) -C $(KERNEL_SOURCE_ROOT)/ M=$(PWD) obj-m=""; \
- echo 'Copying outputs';\
+ echo 'Copying outputs $(OBJ)';\
+ test -f lib.a && (ar -t lib.a | xargs ar -rcsD $($(PROG_ACY)_FINAL_OUTPUT_DIR)/$(LIB_STATIC)); \
mv -f $(OBJ) $($(PROG_ACY)_FINAL_OUTPUT_DIR);\
test -f built-in.o && mv -f built-in.o $($(PROG_ACY)_FINAL_OUTPUT_DIR);\
- test -f lib.a && mv lib.a $($(PROG_ACY)_FINAL_OUTPUT_DIR)/$(LIB_STATIC);\
+ test -f $($(PROG_ACY)_FINAL_OUTPUT_DIR)/lib.a && mv $($(PROG_ACY)_FINAL_OUTPUT_DIR)/lib.a $($(PROG_ACY)_FINAL_OUTPUT_DIR)/$(LIB_STATIC);\
test -f $(OUTPUT_NAME).ko && mv -f $(OUTPUT_NAME).ko $($(PROG_ACY)_FINAL_OUTPUT_DIR);\
test -f $(OUTPUT_NAME).o && mv -f $(OUTPUT_NAME).o $($(PROG_ACY)_FINAL_OUTPUT_DIR);\
$(RM) -rf *.mod.* .*.cmd;
-
$(MODULENAME): dirs
@echo 'Creating kernel module'; \
$(MAKE) -C $(KERNEL_SOURCE_ROOT)/ M=$(PWD); \
--- a/quickassist/lookaside/access_layer/src/sample_code/fips/cpa_fips_sample.h
+++ b/quickassist/lookaside/access_layer/src/sample_code/fips/cpa_fips_sample.h
@@ -109,7 +109,7 @@ extern "C"
#include <linux/string.h>
#include <linux/ctype.h>
#include <linux/sched.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#else /*KERNEL_SPACE*/
#include <string.h>
#include <sched.h>
--- a/quickassist/lookaside/access_layer/src/sample_code/performance/qae/linux/kernel_space/qae_mem_drv.c
+++ b/quickassist/lookaside/access_layer/src/sample_code/performance/qae/linux/kernel_space/qae_mem_drv.c
@@ -85,7 +85,7 @@
#include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include <linux/string.h>
#include <asm/io.h>
--- a/quickassist/utilities/downloader/Target_CoreLibs/halAe/icp_firml_interface.c
+++ b/quickassist/utilities/downloader/Target_CoreLibs/halAe/icp_firml_interface.c
@@ -185,7 +185,7 @@ icp_FirmLoader_MapMofAddr(void *handle,
int status = ICP_FIRMLOADER_SUCCESS;
myHandle = (icp_firml_handle_t *)handle;
-
+
status = UcLo_MapMofAddr(myHandle, filePtr, fileSize,
uofName, (char **)uofPtr, uofSize);
--- a/quickassist/utilities/downloader/Target_CoreLibs/uclo/uclo_mof.c
+++ b/quickassist/utilities/downloader/Target_CoreLibs/uclo/uclo_mof.c
@@ -582,6 +582,7 @@ UcLo_MapMofAddr (icp_firml_handle_t *han
/* UOF_FID (0xc6c2) for uof object
* SUOF_FID for suof object
*/
+
if ((((uof_fileHdr_T *) mofPtr)->fileId == UOF_FID) ||
(((suof_fileHdr_T *) mofPtr)->fileId == SUOF_FID))
{
@@ -599,7 +600,6 @@ UcLo_MapMofAddr (icp_firml_handle_t *han
/* return BADOBJ if neither UOF/SUOF nor MOF */
else if (((mof_fileHdr_T *)mofPtr)->fileId != MOF_FID)
{
- PRINTF("unsupported file format\n");
return (UCLO_BADOBJ);
}
--- a/quickassist/utilities/osal/src/linux/kernel_space/OsalUsrKrlProxy.c
+++ b/quickassist/utilities/osal/src/linux/kernel_space/OsalUsrKrlProxy.c
@@ -45,7 +45,7 @@
#include <linux/mm.h>
#include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include <linux/string.h>
#include <asm/io.h>
--- a/quickassist/utilities/osal/src/linux/user_space/OsalCryptoInterface.c
+++ b/quickassist/utilities/osal/src/linux/user_space/OsalCryptoInterface.c
@@ -78,7 +78,7 @@ OSAL_STATUS
osalHashSHA1(UINT8 *in, UINT8 *out)
{
SHA_CTX ctx;
- if(!SHA_Init(&ctx))
+ if(!SHA1_Init(&ctx))
{
return OSAL_FAIL;
}

View File

@ -0,0 +1,104 @@
menu "Configuration"
depends on PACKAGE_quickassist-c3xxx
config QAT_C3XXX_KERNEL_OPTIONS
bool
default n
prompt "Required kernel options for Quickassist"
select KERNEL_ASN1
select KERNEL_CRYPTO_AKCIPHER
select KERNEL_CRYPTO_AKCIPHER2
select KERNEL_CRYPTO_DH
select KERNEL_CRYPTO_HW
select KERNEL_CRYPTO_KPP
select KERNEL_CRYPTO_KPP2
select KERNEL_CRYPTO_RSA
select KERNEL_UIO
select KERNEL_PCI_IOV
select KERNEL_HUGETLBFS
select KERNEL_HUGETLB_PAGE
help
These kernel options are required for successful compilation and runtime functionality.
config QAT_DEBUG
bool
default n
prompt "Build with debugging support enabled"
config QAT_DISABLE_STATS
bool
default n
prompt "Disable statistics collection"
help
Disable for performance optimization
config QAT_LOG_SYSLOG
bool
default y
prompt "Debug to syslog instead of stdout"
config QAT_PARAM_CHECK
bool
default y
prompt "Enable parameter checking in the top-level APIs"
help
Disable for performance optimization
config QAT_NONBLOCKING_PARTIALS
bool
default y
prompt "Partial operation results are non-blocking"
help
Disable for performance optimization
config QAT_DC_ONLY
bool
default n
prompt "Build acceleration only for compression"
help
Optimize for size if using only compression
config QAT_DC_SYM_ONLY
bool
default n
prompt "Build acceleration only for compression and symmetric ciphers"
help
Optimize for size if using only compression and symmetric ciphers
config QAT_DC_COUNTER_ERROR
bool
default n
prompt "Update counters when encountering an error"
help
Enables updates of consumed/produced results in case
of error during compression or decompression operations
config QAT_DISABLE_INLINE
bool
default n
prompt "Disable functioning inlining for functions that cannot be inlined by the compiler"
help
Use where kernel does not support CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING to allow building
config QAT_HB_FAIL
bool
default n
prompt "Enable heartbeat failure simulation"
config QAT_COEXIST
bool
default n
prompt "Enable legacy and upstream driver coexistence"
config QAT_LKCF
bool
default y
prompt "Enable QAT registration with Linux Kernel Crypto Framework"
config QAT_DISABLE_STRICT
bool
default n
prompt "Disable strict mode for data compression"
endmenu

View File

@ -0,0 +1,97 @@
config KERNEL_ASN1
bool
default n
config KERNEL_CRYPTO_AKCIPHER
bool
default n
config KERNEL_CRYPTO_AKCIPHER2
bool
default n
config KERNEL_CRYPTO_DH
bool
default n
config KERNEL_CRYPTO_KPP
bool
default n
config KERNEL_CRYPTO_KPP2
bool
default n
config KERNEL_CRYPTO_RSA
bool
default n
config KERNEL_HUGETLBFS
bool
default n
config KERNEL_HUGETLB_PAGE
bool
default n
config KERNEL_CRYPTO_HW
bool
default n
config KERNEL_UIO
bool
default n
config KERNEL_PCI_IOV
bool
default n
# CONFIG_UIO is not set in generic and x86 kernels
# Avoid prompting the user for input of dependent symbols
config KERNEL_UIO_CIF
bool
default n
config KERNEL_UIO_PDRV_GENIRQ
bool
default n
config KERNEL_UIO_DMEM_GENIRQ
bool
default n
config KERNEL_UIO_AEC
bool
default n
config KERNEL_UIO_SERCOS3
bool
default n
config KERNEL_UIO_PCI_GENERIC
bool
default n
config KERNEL_UIO_NETX
bool
default n
config KERNEL_UIO_PRUSS
bool
default n
config KERNEL_UIO_MF624
bool
default n
config KERNEL_UIO_HV_GENERIC
bool
default n
# CONFIG_STAGING is set in generic
# CONFIG_KPC2000 depends on PCI and UIO
config KERNEL_KPC2000
bool
default n

View File

@ -0,0 +1,236 @@
#
# Copyright (C) Ian Cooper <iancooper@hotmail.com>
#
# This is free software, licensed under the GNU General Public License v3.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=quickassist-c3xxx
PKG_VERSION:=1.7
PKG_MINOR_VERSION:=L.4.13.0-00009
PKG_RELEASE:=1
PKG_SOURCE:=QAT$(PKG_VERSION).$(PKG_MINOR_VERSION).tar.gz
PKG_SOURCE_URL:=https://downloadmirror.intel.com/30178/eng/
PKG_HASH:=skip
PKG_LICENSE:=GPL v3
PKG_BUILD_DEPENDS:=eudev openssl
QAT_DEFAULT_DEPENDS:= @TARGET_x86_64
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
PKG_BUILD_PARALLEL:=0
QAT_BUILD = $(PKG_BUILD_DIR)/build
QAT_BLDSYS = $(PKG_BUILD_DIR)/quickassist/build_system
QAT_OOT = $(PKG_BUILD_DIR)/quickassist/qat
QAT_ADF = $(PKG_BUILD_DIR)/quickassist/utilities/adf_ctl
QAT_ENV = $(PKG_BUILD_DIR)/quickassist/build_system/build_files/env_files
define Package/quickassist-c3xxx
SECTION:=firmware
CATEGORY:=Firmware
TITLE:=Intel Quick Assist Technology for c3xxx SoC
DEPENDS:= \
$(QAT_DEFAULT_DEPENDS) \
$(PKG_DEFAULT_DEPENDS) \
+libopenssl \
+libstdcpp \
+eudev \
+kmod-itco-wdt \
+kmod-crypto-manager \
+kmod-crypto-sha1 \
+kmod-crypto-sha256 \
+kmod-crypto-sha512 \
+kmod-crypto-cbc \
+kmod-crypto-qat-c3xxx \
+kmod-crypto-qat-usdm \
+kmod-crypto-qat-common \
+kmod-crypto-qat-api
USERID:=qat=555:qat=555
endef
define Package/quickassist-c3xxx/description
Intel Quick Assist v1.7 drivers and utilities for c3xxx series SoCs
endef
define Package/quickassist-c3xxx/config
source "$(SOURCE)/Config.kernel"
source "$(SOURCE)/Config.in"
config quickassist-c3xxx-enabled
bool
default y if PACKAGE_quickassist-c3xxx
default n
endef
define KernelPackage/crypto-qat-c3xxx
SUBMENU:=Cryptographic API modules
TITLE:=Intel Quick Assist Technology Driver
DEPENDS:= \
$(QAT_DEFAULT_DEPENDS) \
kmod-crypto-qat-common
FILES:=$(QAT_OOT)/drivers/crypto/qat/qat_c3xxx/qat_c3xxx.ko
endef
define KernelPackage/crypto-qat-c3xxx/description
Kernel driver for Intel Quick Assist Technology c3xxx
endef
define KernelPackage/crypto-qat-common
SUBMENU:=Cryptographic API modules
TITLE:=Intel Quick Assist Common Driver
DEPENDS:= \
$(QAT_DEFAULT_DEPENDS) \
+kmod-crypto-authenc \
+kmod-crypto-kpp
FILES:=$(QAT_OOT)/drivers/crypto/qat/qat_common/intel_qat.ko
endef
define KernelPackage/crypto-qat-common/description
Kernel driver shared layer for Intel Quick Assist Technology c3xxx
endef
define KernelPackage/crypto-qat-common/config
depends on quickassist-c3xxx-enabled
endef
define KernelPackage/crypto-qat-api
SUBMENU:=Cryptographic API modules
TITLE:=Intel Quick Assist Kernel API
DEPENDS:= \
$(QAT_DEFAULT_DEPENDS) \
kmod-crypto-qat-common
FILES:=$(QAT_BUILD)/qat_api.ko
endef
define KernelPackage/crypto-qat-api/description
Kernel API for Intel Quick Assist Technology c3xxx
endef
define KernelPackage/crypto-qat-usdm
SUBMENU:=Cryptographic API modules
TITLE:=Intel Quick Assist Pinned Memory Driver
DEPENDS:= \
$(QAT_DEFAULT_DEPENDS) \
kmod-crypto-qat-common
FILES:=$(QAT_BUILD)/usdm_drv.ko
endef
define KernelPackage/crypto-qat-usdm/description
Contiguous pinned memory driver for Intel Quick Assist Technology
endef
ICP_ARCH = x86_64
MAKE_PATH = quickassist
QAT_CONFIG += $(if $(CONFIG_QAT_DEBUG) ,ICP_DEBUG="1",)
QAT_CONFIG += $(if $(CONFIG_QAT_DISABLE_STATS) ,DISABLE_STATS="1",)
QAT_CONFIG += $(if $(CONFIG_QAT_LOG_SYSLOG) ,ICP_LOG_SYSLOG="1",)
QAT_CONFIG += $(if $(CONFIG_QAT_PARAM_CHECK) ,ICP_PARAM_CHECK="y",)
QAT_CONFIG += $(if $(CONFIG_QAT_NONBLOCKING_PARTIALS) ,ICP_NONBLOCKING_PARTIALS_PERFORM="1",)
QAT_CONFIG += $(if $(CONFIG_QAT_DC_ONLY) ,ICP_DC_ONLY="1",)
QAT_CONFIG += $(if $(CONFIG_QAT_DC_ONLY) ,DO_CRYPTO="0",)
QAT_CONFIG += $(if $(CONFIG_QAT_DC_SYM_ONLY) ,ICP_DC_SYM_ONLY_AM="1",)
QAT_CONFIG += $(if $(CONFIG_QAT_DC_COUNTER_ERROR) ,ICP_DC_RETURN_COUNTERS_ON_ERROR="1",)
QAT_CONFIG += $(if $(CONFIG_QAT_DISABLE_INLINE) ,ICP_DISABLE_INLINE="1",)
QAT_CONFIG += $(if $(CONFIG_QAT_HB_FAIL) ,ICP_HB_FAIL_SYM="y",)
QAT_CONFIG += $(if $(CONFIG_QAT_COEXIST) ,QAT_COEXISTENCE="y",)
QAT_CONFIG += $(if $(CONFIG_QAT_LKCF) ,QAT_NO_LKCF="n",)
QAT_CONFIG += $(if $(CONFIG_QAT_DISABLE_STRICT) ,CNV_STRICT_MODE="1",)
QAT_CONFIG += $(if $(CONFIG_PKG_CC_STACKPROTECTOR_NONE) ,ICP_DEFENSES_ENABLED="n",ICP_DEFENSES_ENABLED="y")
MAKE_VARS += ICP_ROOT="$(PKG_BUILD_DIR)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
CXX="$(TARGET_CXX)" \
KERNEL_SOURCE_ROOT="$(LINUX_DIR)" \
KERNEL_SOURCE_DIR="$(QAT_OOT)" \
KDIR="$(LINUX_DIR)" \
MACHINE="$(ICP_ARCH)" \
USE_OPENSSL="1" \
ICP_BUILD_OUTPUT="$(QAT_BUILD)" \
ICP_ENV_DIR="$(QAT_ENV)" \
ICP_BUILDSYSTEM_PATH="$(QAT_BLDSYS)" \
ICP_TOOLS_TARGET="accelcomp" \
$(QAT_CONFIG) \
ICP_KAPI_M="1" \
ICP_CORE="ia" \
ICP_OS="linux_2.6" \
ICP_ARCH_USER="$(ICP_ARCH)" \
ICP_DEFENSES_ENABLED="n" \
LIB_SHARED_FLAGS="-L $(STAGING_DIR)/lib -L $(STAGING_DIR)/usr/lib" \
LD_LIBRARY_PATH="$(PKG_BUILD_DIR)/build"
# ICP_DEFENSES_ENABLED="$(ICP_DEFENSES_ENABLED)" \
define Build/Prepare
(mkdir -p '$(PKG_BUILD_DIR)' && zcat '$(DL_DIR)/$(PKG_SOURCE)' | tar -C '$(PKG_BUILD_DIR)' -xf -)
$(Build/Patch)
endef
define Build/Configure
# The shipped configure script is hopelessly broken for cross compilation environments
endef
define Build/Compile
@echo "QAT Build Configuration: $(QAT_CONFIG)"
$(call Build/Compile/Default, -C $(QAT_OOT))
$(call Build/Compile/Default, lac_kernel lac_user)
$(call Build/Compile/Default, -C $(QAT_ADF))
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/icp/quickassist
$(INSTALL_DIR) $(1)/usr/icp/build
$(CP) $(PKG_BUILD_DIR)/build/lib*.{a,so*} $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/quickassist/include/{*.h,dc,lac} $(1)/usr/include
$(CP) $(PKG_BUILD_DIR)/quickassist/lookaside/access_layer/include/*.h $(1)/usr/include
$(CP) $(PKG_BUILD_DIR)/quickassist $(1)/usr/icp
$(CP) $(PKG_BUILD_DIR)/build $(1)/usr/icp
endef
define Package/quickassist-c3xxx/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/hotplug.d
$(INSTALL_DIR) $(1)/etc/sysctl.d
$(INSTALL_DIR) $(1)/lib/firmware
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/usr/share/quickassist/QAT1.7/config
$(CP) $(PKG_BUILD_DIR)/quickassist/utilities/adf_ctl/conf_files/c3xxx* $(1)/usr/share/quickassist/QAT1.7/config
$(CP) $(PKG_BUILD_DIR)/quickassist/utilities/adf_ctl/adf_ctl $(1)/usr/sbin/adf_ctl
$(CP) $(PKG_BUILD_DIR)/build/*.so* $(1)/lib/
$(CP) $(PKG_BUILD_DIR)/quickassist/qat/fw/qat_c3xxx* $(1)/lib/firmware/
$(CP) ./files/qat.init $(1)/etc/init.d/qat
$(CP) ./files/hotplug.d $(1)/etc
$(CP) ./files/sysctl.d $(1)/etc
$(CP) ./files/c3xxx_dev0.conf $(1)/etc/c3xxx_dev0.conf
$(CP) ./files/c3xxx_dev0.conf.multi $(1)/etc/c3xxx_dev0.conf.multi
endef
define Package/quickassist-c3xxx/postinst
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] && exit 0
[ "$${PKG_UPGRADE}" = "1" ] && exit 0
sysctl -p /etc/sysctl.d/12-hugepages.conf
/etc/init.d/qat enable
exit 0
endef
define Package/quickassist-c3xxx/prerm
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] && exit 0
/etc/init.d/qat stop
exit 0
endef
$(eval $(call BuildPackage,quickassist-c3xxx))
$(eval $(call KernelPackage,crypto-qat-c3xxx))
$(eval $(call KernelPackage,crypto-qat-common))
$(eval $(call KernelPackage,crypto-qat-api))
$(eval $(call KernelPackage,crypto-qat-usdm))

View File

@ -0,0 +1,121 @@
################################################################
# This file is provided under a dual BSD/GPLv2 license. When using or
# redistributing this file, you may do so under either license.
#
# GPL LICENSE SUMMARY
#
# Copyright(c) 2007-2020 Intel Corporation. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
# The full GNU General Public License is included in this distribution
# in the file called LICENSE.GPL.
#
# Contact Information:
# Intel Corporation
#
# BSD LICENSE
#
# Copyright(c) 2007-2020 Intel Corporation. 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.
#
#
################################################################
[GENERAL]
ServicesEnabled = cy
# Set the service profile to determine available features
# =====================================================================
# DEFAULT CRYPTO COMPRESSION CUSTOM1
# Asymmetric Crypto * * *
# Symmetric Crypto * * *
# MGF KeyGen * *
# SSL/TLS KeyGen * * *
# HKDF * *
# Compression * * *
# Decompression (stateless) * * *
# Decompression (stateful) * *
# Service Chaining *
# Device Utilization * *
# Rate Limiting * *
# =====================================================================
ServicesProfile = DEFAULT
ConfigVersion = 2
#Default values for number of concurrent requests*/
CyNumConcurrentSymRequests = 512
CyNumConcurrentAsymRequests = 64
#Statistics, valid values: 1,0
statsGeneral = 1
statsDh = 1
statsDrbg = 1
statsDsa = 1
statsEcc = 1
statsKeyGen = 1
statsDc = 1
statsLn = 1
statsPrime = 1
statsRsa = 1
statsSym = 1
# This flag is to enable device auto reset on heartbeat error
AutoResetOnError = 0
##############################################
# Kernel Instances Section
##############################################
[KERNEL]
NumberCyInstances = 0
NumberDcInstances = 0
##############################################
# User Process Instance Section
##############################################
[SHIM]
NumberCyInstances = 1
NumberDcInstances = 0
NumProcesses = 32
LimitDevAccess = 1
# Crypto - User instance #0
Cy0Name = "UserCY0"
Cy0IsPolled = 1
# List of core affinities
Cy0CoreAffinity = 0

View File

@ -0,0 +1,127 @@
################################################################
# This file is provided under a dual BSD/GPLv2 license. When using or
# redistributing this file, you may do so under either license.
#
# GPL LICENSE SUMMARY
#
# Copyright(c) 2007-2020 Intel Corporation. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
# The full GNU General Public License is included in this distribution
# in the file called LICENSE.GPL.
#
# Contact Information:
# Intel Corporation
#
# BSD LICENSE
#
# Copyright(c) 2007-2020 Intel Corporation. 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.
#
#
################################################################
[GENERAL]
ServicesEnabled = cy
# Set the service profile to determine available features
# =====================================================================
# DEFAULT CRYPTO COMPRESSION CUSTOM1
# Asymmetric Crypto * * *
# Symmetric Crypto * * *
# MGF KeyGen * *
# SSL/TLS KeyGen * * *
# HKDF * *
# Compression * * *
# Decompression (stateless) * * *
# Decompression (stateful) * *
# Service Chaining *
# Device Utilization * *
# Rate Limiting * *
# =====================================================================
ServicesProfile = DEFAULT
ConfigVersion = 2
#Default values for number of concurrent requests*/
CyNumConcurrentSymRequests = 512
CyNumConcurrentAsymRequests = 64
#Statistics, valid values: 1,0
statsGeneral = 1
statsDh = 1
statsDrbg = 1
statsDsa = 1
statsEcc = 1
statsKeyGen = 1
statsDc = 1
statsLn = 1
statsPrime = 1
statsRsa = 1
statsSym = 1
# This flag is to enable device auto reset on heartbeat error
AutoResetOnError = 0
##############################################
# Kernel Instances Section
##############################################
[KERNEL]
NumberCyInstances = 0
NumberDcInstances = 0
##############################################
# User Process Instance Section
##############################################
[SHIM]
NumberCyInstances = 2
NumberDcInstances = 0
NumProcesses = 4
LimitDevAccess = 0
# Crypto - User instance #0
Cy0Name = "UserCY0"
Cy0IsPolled = 1
# List of core affinities
Cy0CoreAffinity = 0
# Crypto - User instance #1
Cy1Name = "UserCY1"
Cy1IsPolled = 1
# List of core affinities
Cy1CoreAffinity = 0

View File

@ -0,0 +1,32 @@
#!/bin/sh
HUGE_PAGE_DIR="/dev/hugepages"
[ "$DEVICENAME" != "usdm_drv" ] && exit 0
[ "$ACTION" == "add" ] && {
if [ -d ${HUGE_PAGE_DIR} ]; then
mkdir ${HUGE_PAGE_DIR}/qat 2> /dev/null
if [ $? -ne 0]; then
logger -t "quickassist(usdm_drv): error creating ${HUGE_PAGE_DIR}/qat"
else
chgrp qat ${HUGE_PAGE_DIR}/qat
chmod 0770 ${HUGE_PAGE_DIR}/qat
fi
else
logger -t "quickassist(usdm_drv): ${HUGE_PAGE_DIR} not found"
exit 1
fi
}
[ "$ACTION" == "remove" ] && {
rmdir ${HUGE_PAGE_DIR}/qat
}

View File

@ -0,0 +1,8 @@
#!/bin/sh
if [ "$DEVICENAME" != "qat_adf_ctl" ] && [ "$ACTION" != "add" ]; then exit 0; fi
chgrp qat /dev/qat_adf_ctl
chmod 0660 /dev/qat_adf_ctl

View File

@ -0,0 +1,8 @@
#!/bin/sh
if [ "$DEVICENAME" != "qat_dev_processes" ] && [ "$ACTION" != "add" ]; then exit 0; fi
chgrp qat /dev/qat_dev_processes
chmod 0660 /dev/qat_dev_processes

View File

@ -0,0 +1,7 @@
#!/bin/sh
if [ "$ACTION" != "add" ] && [ "$MAJOR" != "249" ]; then exit 0; fi
chgrp qat /dev/${DEVICENAME}
chmod 0660 /dev/${DEVICENAME}

View File

@ -0,0 +1,8 @@
#!/bin/sh
if [ "$DEVICENAME" != "usdm_drv" ] && [ "$ACTION" != "add" ]; then exit 0; fi
chgrp qat /dev/usdm_drv
chmod 0660 /dev/usdm_drv

View File

@ -0,0 +1,175 @@
#!/bin/sh /etc/rc.common
#################################################################
# qat Start/Stop the Intel QAT.
#
START=29
STOP=99
ADF_CTL=/usr/sbin/adf_ctl
QAT_GID=200
INTEL_VENDORID="8086"
C3XX_DEVICE_PCI_ID="19e2"
NUM_C3XXX_DEVICES=$(lspci -n | egrep -c "$INTEL_VENDORID:$C3XX_DEVICE_PCI_ID")
HUGE_PAGE_DIR=/dev/hugepages
HUGE_PAGE_MOUNT=$(mount | grep hugetlbfs | awk '{print $3}')
MAX_HUGE_PAGES=200
MAX_HUGE_PAGES_PER_PROCESS=10
EXTRA_COMMANDS="status"
EXTRA_HELP=" status Show the status of the qat device"
qat_started() {
${ADF_CTL} status > /dev/null 2>&1
return $?
}
status() {
${ADF_CTL} status
if [ "$?" -ne 0 ]
then
echo "No devices found. Please start the driver using:"
echo "$0 start"
fi
}
insert_digest_modules() {
if [ $(lsmod | grep -c "sha512") == 0 ]; then
if [ $(cat /proc/kallsyms |grep -c sha512_) == 0 ]; then
modprobe sha512_ssse3
else
echo "$0 no sha512_ssse3 module to load"
return 1
fi
fi
if [ $(lsmod | grep -c "sha256") == 0 ]; then
if [ $(cat /proc/kallsyms |grep -c sha256_) == 0 ]; then
modprobe sha256_ssse3
else
echo "$0 no sha256_ssse3 module to load"
return 1
fi
fi
return 0
}
mount_hugetlbfs() {
if [ "${HUGE_PAGE_MOUNT}" != "${HUGE_PAGE_DIR}" ]; then
[ ! -d ${HUGE_PAGE_DIR} ] && mkdir ${HUGE_PAGE_DIR}
mount -t hugetlbfs hugetlbfs ${HUGE_PAGE_DIR} -o mode=1770 -o gid=${QAT_GID}
if [ $? -ne 0 ]; then
echo "$0: error mounting hugetlbfs on ${HUGE_PAGE_DIR}"
return 1
fi
fi
return 0
}
insert_modules() {
# common functions kernel module
if [ $(lsmod | grep "intel_qat" | wc -l) == "0" ]; then
modprobe intel_qat
fi
[ $? -ne 0 ] && return 1
# contiguous pinned memory driver
# requires huge pages support in the kernel
if [ $(lsmod | grep "usdm_drv" | wc -l) == "0" ]; then
modprobe usdm_drv max_huge_pages=${MAX_HUGE_PAGES} max_huge_pages_per_process=${MAX_HUGE_PAGES_PER_PROCESS}
fi
[ $? -ne 0 ] && return 1
# qat device driver
if [ $(lsmod | grep "qat_c3xxx" | wc -l) == "0" ]; then
modprobe qat_c3xxx
fi
[ $? -ne 0 ] && return 1
# qat kernel api
if [ $(lsmod | grep "qat_api" | wc -l) == "0" ]; then
modprobe qat_api
fi
return $?
}
start() {
/sbin/depmod -a 2> /dev/null
qat_started
if [ $? -ne 0 ]; then
insert_digest_modules && [ $? -eq 0 ] && mount_hugetlbfs
if [ $? -eq 0 ]; then
if [ ${NUM_C3XXX_DEVICES} != 0 ]; then
insert_modules
[ $? -eq 0 ] && ${ADF_CTL} restart
fi
fi
else echo "QAT already started $?"; fi
${ADF_CTL} status
}
stop() {
qat_started
if [ $? -eq 0 ]; then
${ADF_CTL} down
rmmod usdm_drv
rmmod qat_api
rmmod qat_c3xxx
rmmod intel_qat
umount ${HUGE_PAGE_DIR}
fi
}
restart() {
${ADF_CTL} restart
}

View File

@ -0,0 +1,5 @@
# setup huge page maximums
# default size is 2MB
vm.nr_hugepages=256
vm.hugetlb_shm_group=200

View File

@ -0,0 +1,15 @@
--- a/quickassist/build_system/build_files/env_files/environment.mk
+++ b/quickassist/build_system/build_files/env_files/environment.mk
@@ -59,11 +59,7 @@ DIRECT_PATH=$(ICP_ROOT)/quickassist/look
KERNEL_PATH=$(ICP_ROOT)/quickassist/lookaside/access_layer/src/qat_kernel/
CMN_MEM_PATH=$(ICP_ROOT)/quickassist/utilities/libusdm_drv
ICP_DEFENSES_ENABLED ?= y
-ifeq ($(shell cat /proc/kallsyms | grep -w "__stack_chk_fail" | wc -l), 1)
-KERNEL_DEFENSES_STACK_PROTECTION = y
-else
-KERNEL_DEFENSES_STACK_PROTECTION = n
-endif
+KERNEL_DEFENSES_STACK_PROTECTION ?= n
#----------------------------------------------------------------------
# ADF paths

View File

@ -0,0 +1,14 @@
Index: quickassist-c3xxx-1.7.L.4.13.0-00009/quickassist/build_system/build_files/env_files/linux_2.6_user_space.mk
===================================================================
--- quickassist-c3xxx-1.7.L.4.13.0-00009.orig/quickassist/build_system/build_files/env_files/linux_2.6_user_space.mk
+++ quickassist-c3xxx-1.7.L.4.13.0-00009/quickassist/build_system/build_files/env_files/linux_2.6_user_space.mk
@@ -46,8 +46,7 @@
#
#-------------------------------------------------------------
-INCLUDES+=-I/usr/include \
- -I$(API_DIR) \
+INCLUDES+=-I$(API_DIR) \
-I$(ADF_CMN_DIR) \
-I$(OSAL_DIR)/include \
-I$(OSAL_DIR)/src/linux/user_space/include

View File

@ -0,0 +1,13 @@
Index: quickassist-c3xxx-1.7/quickassist/utilities/osal/src/linux/user_space/OsalServices.c
===================================================================
--- quickassist-c3xxx-1.7.orig/quickassist/utilities/osal/src/linux/user_space/OsalServices.c
+++ quickassist-c3xxx-1.7/quickassist/utilities/osal/src/linux/user_space/OsalServices.c
@@ -42,7 +42,7 @@
#define __STDC_WANT_LIB_EXT1__ 1
#include <stdarg.h>
#include <stdio.h>
-#ifdef __linux__
+#if defined(__linux__) && defined(__GLIBC__)
#include <bits/time.h>
#include <string.h>
#endif

View File

@ -0,0 +1,14 @@
Index: quickassist-c3xxx-1.7/quickassist/utilities/libusdm_drv/linux/user_space/qae_page_table.h
===================================================================
--- quickassist-c3xxx-1.7.orig/quickassist/utilities/libusdm_drv/linux/user_space/qae_page_table.h
+++ quickassist-c3xxx-1.7/quickassist/utilities/libusdm_drv/linux/user_space/qae_page_table.h
@@ -82,7 +82,9 @@
#endif
#ifndef __FreeBSD__ /* FreeBSD, already defined in machine param.h */
+#if defined(__GLIBC__)
#define PAGE_SIZE (0x1000)
+#endif
#define PAGE_SHIFT (12)
#endif

View File

@ -0,0 +1,49 @@
#
# Copyright (C) 2019 OpenWrt.org and dl12345@github.com
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
KMOD_NAME:=crypto-crc32-pclmul
PKG_NAME:=kmod-$(KMOD_NAME)
PKG_VERSION:=1.0
PKG_RELEASE:=1
PKG_MAINTAINER:=dl12345 <dl12345@github.com>
PKG_LICENSE:=GPL v3
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
CRYPTO_MENU:=Cryptographic API modules
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define KernelPackage/crypto-crc32-pclmul
SUBMENU:=$(CRYPTO_MENU)
TITLE:=CRC32 hardware acceleration (PCLMULDQ)
DEPENDS:=+kmod-crypto-hash +kmod-crypto-crc32 @TARGET_x86_64
KCONFIG:=CONFIG_CRYPTO_CRC32_PCLMUL
FILES:=$(LINUX_DIR)/arch/x86/crypto/crc32-pclmul.ko
AUTOLOAD:=$(call AutoLoad,09,crc32-pclmul)
endef
define KernelPackage/$(KMOD_NAME)/description
From Intel Westmere and AMD Bulldozer processor with SSE4.2 and PCLMULQDQ supported, the processor will support CRC32 PCLMULQDQ
implementation using hardware accelerated PCLMULQDQ instruction. This option will create 'crc32-pclmul' module, which will enable
any routine to use the CRC-32-IEEE 802.3 checksum and gain better performance as compared with the table implementation
endef
$(eval $(call KernelPackage,$(KMOD_NAME)))

View File

@ -0,0 +1,48 @@
#
# Copyright (C) 2019 OpenWrt.org and dl12345@github.com
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
KMOD_NAME:=crypto-crc32c-intel
PKG_NAME:=kmod-$(KMOD_NAME)
PKG_VERSION:=1.0
PKG_RELEASE:=1
PKG_MAINTAINER:=dl12345 <dl12345@github.com>
PKG_LICENSE:=GPL v3
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
CRYPTO_MENU:=Cryptographic API modules
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define KernelPackage/crypto-crc32c-intel
SUBMENU:=$(CRYPTO_MENU)
TITLE:=CRC32c hardware acceleration (SSE4.2)
DEPENDS:=+kmod-crypto-hash @TARGET_x86_64
KCONFIG:=CONFIG_CRYPTO_CRC32C_INTEL
FILES:=$(LINUX_DIR)/arch/x86/crypto/crc32c-intel.ko
AUTOLOAD:=$(call AutoLoad,09,crc32-intel)
endef
define KernelPackage/$(KMOD_NAME)/description
In Intel processor with SSE4.2 supported, the processor will support CRC32C implementation using hardware accelerated CRC32 instruction.
This option will create 'crc32c-intel' module, which will enable any routine to use the hardware accelerated CRC32 instruction
Module will be crc32c-intel
endef
$(eval $(call KernelPackage,$(KMOD_NAME)))

View File

@ -0,0 +1,47 @@
#
# Copyright (C) 2019 OpenWrt.org and dl12345@github.com
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
KMOD_NAME:=crypto-crct10dif-pclmu
PKG_NAME:=kmod-$(KMOD_NAME)
PKG_VERSION:=1.0
PKG_RELEASE:=1
PKG_MAINTAINER:=dl12345 <dl12345@github.com>
PKG_LICENSE:=GPL v3
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
CRYPTO_MENU:=Cryptographic API modules
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define KernelPackage/$(KMOD_NAME)
SUBMENU:=$(CRYPTO_MENU)
TITLE:=CRCT10DIF hardware acceleration
DEPENDS:=+kmod-crypto-hash @TARGET_x86_64
KCONFIG:=CONFIG_CRYPTO_CRCT10DIF_PCLMUL
FILES:=$(LINUX_DIR)/arch/x86/crypto/crct10dif-pclmul.ko
AUTOLOAD:=$(call AutoLoad,09,crct10dif-pclmul)
endef
define KernelPackage/$(KMOD_NAME)/description
CRC T10 Data Integrity Field computation is being cast as a crypto transform.
This allows for faster crc t10 diff transforms to be used if they are available.
endef
$(eval $(call KernelPackage,$(KMOD_NAME)))

View File

@ -0,0 +1,46 @@
#
# Copyright (C) 2019 OpenWrt.org and dl12345@github.com
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
KMOD_NAME:=crypto-ghash-clmulni
PKG_NAME:=kmod-$(KMOD_NAME)
PKG_VERSION:=1.0
PKG_RELEASE:=1
PKG_MAINTAINER:=dl12345 <dl12345@github.com>
PKG_LICENSE:=GPL v3
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
CRYPTO_MENU:=Cryptographic API modules
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define KernelPackage/crypto-ghash-clmulni
SUBMENU:=$(CRYPTO_MENU)
TITLE:=GHASH digest hardware acceleration
DEPENDS:=+kmod-crypto-ghash @TARGET_x86_64
KCONFIG:=CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL
FILES:=$(LINUX_DIR)/arch/x86/crypto/ghash-clmulni-intel.ko
AUTOLOAD:=$(call AutoLoad,09,ghash-clmulni-intel)
endef
define KernelPackage/$(KMOD_NAME)/description
GHASH is message digest algorithm for GCM (Galois/Counter Mode). The implementation is accelerated by CLMUL-NI of Intel.
endef
$(eval $(call KernelPackage,$(KMOD_NAME)))

View File

@ -0,0 +1,63 @@
#
# Copyright (C) 2019 OpenWrt.org and dl12345@github.com
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
KMOD_NAME:=crypto-misc-cxxxx
PKG_NAME:=kmod-$(KMOD_NAME)
PKG_VERSION:=1.0
PKG_RELEASE:=1
PKG_MAINTAINER:=dl12345 <dl12345@github.com>
PKG_LICENSE:=GPL v3
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
CRYPTO_MENU:=Cryptographic API modules
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define KernelPackage/crypto-misc-cxxxx
SUBMENU:=$(CRYPTO_MENU)
HIDDEN:=1
TITLE:=crypto-misc-cxxxx
DEPENDS:=kmod-crypto-misc @(TARGET_x86_c2xxx||TARGET_x86_c3xxx)
DEFAULT:=y if ((TARGET_x86_c2xxx||TARGET_x86_c3xxx) && PACKAGE_kmod-crypto-misc)
FILES:= \
$(LINUX_DIR)/arch/x86/crypto/camellia-x86_64.ko \
$(LINUX_DIR)/arch/x86/crypto/blowfish-x86_64.ko \
$(LINUX_DIR)/arch/x86/crypto/twofish-x86_64.ko \
$(LINUX_DIR)/arch/x86/crypto/twofish-x86_64-3way.ko \
$(LINUX_DIR)/arch/x86/crypto/serpent-sse2-x86_64.ko \
$(LINUX_DIR)/arch/x86/crypto/camellia-aesni-avx-x86_64.ko \
$(LINUX_DIR)/arch/x86/crypto/cast5-avx-x86_64.ko \
$(LINUX_DIR)/arch/x86/crypto/cast6-avx-x86_64.ko \
$(LINUX_DIR)/arch/x86/crypto/twofish-avx-x86_64.ko \
$(LINUX_DIR)/arch/x86/crypto/serpent-avx-x86_64.ko \
$(LINUX_DIR)/arch/x86/crypto/camellia-aesni-avx2.ko \
$(LINUX_DIR)/arch/x86/crypto/serpent-avx2.ko \
$(LINUX_DIR)/crypto/ablk_helper.ko@lt4.17
AUTOLOAD+= $(call AutoLoad,10,camellia-x86_64 \
camellia-aesni-avx-x86_64 camellia-aesni-avx2 cast5-avx-x86_64 \
cast6-avx-x86_64 twofish-x86_64 twofish-x86_64-3way \
twofish-avx-x86_64 blowfish-x86_64 serpent-avx-x86_64 serpent-avx2)
endef
define KernelPackage/$(KMOD_NAME)/description
Camellia, Camellia-AESNI, Blowfish, Twofish, Serpent, Serpent SSE2, Serpent AVX2, Cast5, Cast6
endef
$(eval $(call KernelPackage,$(KMOD_NAME)))

View File

@ -0,0 +1,66 @@
#
# Copyright (C) 2019 OpenWrt.org and dl12345@github.com
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
KMOD_NAME:=crypto-sha-cxxxx
PKG_NAME:=kmod-$(KMOD_NAME)
PKG_VERSION:=1.0
PKG_RELEASE:=1
PKG_MAINTAINER:=dl12345 <dl12345@github.com>
PKG_LICENSE:=GPL v3
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
CRYPTO_MENU:=Cryptographic API modules
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define KernelPackage/crypto-sha1-cxxxx
SUBMENU:=$(CRYPTO_MENU)
TITLE:=SHA1 x86_64 versions for C2000/C3000 target
HIDDEN:=1
DEPENDS:=kmod-crypto-sha1 @(TARGET_x86_c2xxx||TARGET_x86_c3xxx)
DEFAULT:=y if ((TARGET_x86_c2xxx||TARGET_x86_c3xxx) && PACKAGE_kmod-crypto-sha1)
FILES:=$(LINUX_DIR)/arch/x86/crypto/sha1-ssse3.ko
AUTOLOAD+=$(call AutoLoad,09,sha1-ssse3)
endef
define KernelPackage/crypto-sha256-cxxxx
SUBMENU:=$(CRYPTO_MENU)
TITLE:=SHA256 x86_64 versions for C2000/C3000 target
HIDDEN:=1
DEPENDS:=kmod-crypto-sha256 @(TARGET_x86_c2xxx||TARGET_x86_c3xxx)
DEFAULT:=y if ((TARGET_x86_c2xxx||TARGET_x86_c3xxx) && PACKAGE_kmod-crypto-sha256)
FILES:=$(LINUX_DIR)/arch/x86/crypto/sha256-ssse3.ko
AUTOLOAD+=$(call AutoLoad,09,sha256-ssse3)
endef
define KernelPackage/crypto-sha512-cxxxx
SUBMENU:=$(CRYPTO_MENU)
TITLE:=SHA512 x86_64 versions for C2000/C3000 target
HIDDEN:=1
DEPENDS:=kmod-crypto-sha512 @(TARGET_x86_c2xxx||TARGET_x86_c3xxx)
DEFAULT:=y if ((TARGET_x86_c2xxx||TARGET_x86_c3xxx) && PACKAGE_kmod-crypto-sha512)
FILES:=$(LINUX_DIR)/arch/x86/crypto/sha512-ssse3.ko
AUTOLOAD+=$(call AutoLoad,09,sha512-ssse3)
endef
$(eval $(call KernelPackage,crypto-sha1-cxxxx))
$(eval $(call KernelPackage,crypto-sha256-cxxxx))
$(eval $(call KernelPackage,crypto-sha512-cxxxx))

View File

@ -0,0 +1,69 @@
# udev package config
menu "Configuration"
depends on PACKAGE_eudev
config EUDEV_EXTRA_ata_id
bool "Install eudev ata_id callout"
default y
help
ata_id - udev callout to read product/serial number
from ATA drives
config EUDEV_EXTRA_blkid
bool "Use blkid to identify block devices"
default y
help
blkid - make use of libblkid to identify block devices
config EUDEV_EXTRA_cdrom_id
bool "Install eudev cdrom_id callout"
default y
help
cdrom_id - udev callout to determine the capabilities
of optical drives and media
config EUDEV_EXTRA_collect
bool "Install eudev collect"
default n
help
Adds ID to the list governed by <checkpoint>
config EUDEV_EXTRA_input_id
bool "Install input_id callout"
default y
help
input_id - udev callout to classify input devices
config EUDEV_EXTRA_kmod
bool "Use kmod for loading kernel modules"
default n
help
kmod - make use of kmod to load kernel modules on demand
config EUDEV_EXTRA_mtd_probe
bool "Install mtd_probe callout"
default y
help
mtd_probe - udev callout to probe mtd devices
config EUDEV_EXTRA_rule_generator
bool "Install (legacy) eudev rule_generator"
default n
help
Install (legacy) eudev rule_generator
config EUDEV_EXTRA_scsi_id
bool "Install eudev scsi_id callout"
default y
help
scsi_id - retrieve and generate a unique SCSI identifier
config EUDEV_EXTRA_v4l_id
bool "Install eudev v4l_id callout"
default y
help
v4l_id - udev callout to identify Video4Linux devices
endmenu

View File

@ -0,0 +1,88 @@
#
# Copyright (C) 2006-2008 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=eudev
PKG_VERSION:=3.2.9
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://dev.gentoo.org/~blueness/eudev/
PKG_HASH:=89618619084a19e1451d373c43f141b469c9fd09767973d73dd268b92074d4fc
PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk
PKG_BUILD_DEPENDS:=gperf/host
PKG_FIXUP:=autoreconf
PKG_INSTALL=1
define Package/libeudev
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Dynamic device management subsystem
URL:=https://wiki.gentoo.org/wiki/Project:Eudev
MAINTAINER:=Ian Cooper <iancooper@hotmail.com>
PROVIDES:=libudev
CONFLICTS:=libudev-zero udev
endef
define Package/eudev
SECTION:=Libs
CATEGORY:=Libraries
TITLE:=Dynamic device management subsystem
URL:=https://wiki.gentoo.org/wiki/Project:Eudev
MAINTAINER:=Ian Cooper <iancooper@hotmail.com>
MENU:=1
DEPENDS:=+EUDEV_EXTRA_blkid:libblkid +EUDEV_EXTRA_kmod:libkmod +librt +libeudev
endef
define Package/eudev/description
Eudev is the Gentoo Linux port of udev. This implementation installs only the libraries
and a udevmonitor binary. This allows packages dependent on libudev to be compiled and
run on OpenWrt. The udevmonitor binary can be used to see what events are tiggered so
that an appropriate hotplug handler script can be installed.
endef
define Package/eudev/config
source "$(SOURCE)/Config.in"
endef
CONFIGURE_ARGS += \
--prefix=/usr --exec-prefix= --sysconfdir=/etc \
--libexecdir=/lib/udev --sbindir=/sbin \
--disable-hwdb --disable-introspection --disable-manpages \
--disable-selinux \
$(if $(CONFIG_EUDEV_EXTRA_blkid),--enable-blkid,--disable-blkid) \
$(if $(CONFIG_EUDEV_EXTRA_kmod),--enable-kmod,--disable-kmod)
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/libudev.h $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/share/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/share/pkgconfig/udev.pc $(1)/usr/share/pkgconfig
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/lib/libudev.so* $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/lib/libudev.a $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/lib/pkgconfig/libudev.pc $(1)/usr/lib/pkgconfig
endef
define Package/libeudev/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/lib/libudev.so* $(1)/usr/lib
endef
define Package/eudev/install
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/udevadm $(1)/sbin/udevadm
endef
$(eval $(call BuildPackage,eudev))
$(eval $(call BuildPackage,libeudev))

View File

@ -0,0 +1,12 @@
Index: eudev-3.2.9/src/mtd_probe/mtd_probe.h
===================================================================
--- eudev-3.2.9.orig/src/mtd_probe/mtd_probe.h
+++ eudev-3.2.9/src/mtd_probe/mtd_probe.h
@@ -20,6 +20,7 @@
#pragma once
#include <mtd/mtd-user.h>
+#include <stdint.h>
#include "macro.h"

View File

@ -0,0 +1,18 @@
Index: eudev-3.2.9/src/udev/udevadm.c
===================================================================
--- eudev-3.2.9.orig/src/udev/udevadm.c
+++ eudev-3.2.9/src/udev/udevadm.c
@@ -45,13 +45,7 @@ static const struct udevadm_cmd udevadm_
static const struct udevadm_cmd *udevadm_cmds[] = {
&udevadm_info,
- &udevadm_trigger,
- &udevadm_settle,
- &udevadm_control,
&udevadm_monitor,
- &udevadm_hwdb,
- &udevadm_test,
- &udevadm_test_builtin,
&udevadm_version,
&udevadm_help,
};

View File

@ -0,0 +1,160 @@
menu "Configuration"
depends on TARGET_x86_64
choice
prompt "Platform"
default QAT_NONE
config QAT_NONE
bool "None (Default)"
config QAT_C2XXX
bool "c2xxx - Rangeley"
depends on LINUX_4_14
select PACKAGE_quickassist-c2xxx
select PACKAGE_kmod-crypto-qat-c2xxx
select PACKAGE_kmod-crypto-qat-c2xxx-usdm
config QAT_C3XXX
bool "c3xxx - Denverton"
select PACKAGE_quickassist-c3xxx
select PACKAGE_kmod-crypto-qat-c3xxx
select PACKAGE_kmod-crypto-qat-common
select PACKAGE_kmod-crypto-qat-usdm
endchoice
config QAT_ENGINE_DISABLE_RSA
bool
default n
prompt "Disable QAT RSA offload"
config QAT_ENGINE_DISABLE_DSA
bool
default n
prompt "Disable QAT DSA offload"
config QAT_ENGINE_DISABLE_DH
bool
default n
prompt "Disable QAT DH offload"
config QAT_ENGINE_DISABLE_EDSA
bool
default n
prompt "Disable QAT ECDSA offload"
config QAT_ENGINE_DISABLE_CIPHERS
bool
default y
prompt "Disable QAT chained cipher offload"
help
Offload of chained ciphers performs significantly worse than CPU
based chained ciphers. Strongly recommended to keep this disabled
config QAT_ENGINE_DISABLE_HKDF
bool
default y
prompt "Disable QAT HKDF offload"
help
Disable QAT HKDF offload
config QAT_ENGINE_ENABLE_GCM_CIPHERS
bool
default n
prompt "Enable QAT GCM offload"
help
Enable QAT GCM offload
config QAT_ENGINE_ENABLE_SMALL_PACKET
bool
default n
prompt "Enable offload of small packet cipher operations"
help
This is generally a bad idea from a performance point of view since
there is a penalty for transfer of the data across the pci bus to the
accelerator that makes it faster for small packet operations using
only cpu resources and not QAT offloading (generally < 4k bufsize)
config QAT_ENGINE_ENABLE_WARNINGS
bool
default n
prompt "Enable warnings to aid in debugging"
help
WARNING: never leave on in a production environment as it may output
private key informtion to the logs and it may introduce side-channel
timing attack vulnerabilities
config QAT_ENGINE_ENABLE_DEBUG
bool
default n
prompt "Enable debug output"
help
WARNING: never leave on in a production environment as it may output
private key informtion to the logs and it may introduce side-channel
timing attack vulnerabilities
config QAT_ENGINE_ENABLE_QAT_MEM_WARNINGS
bool
default n
prompt "Enable warnings from the userspace memory management code"
help
WARNING: This option should never be left on in a production
environment as it may introduce side channel timing attack
vulnerabilities
config QAT_ENGINE_ENABLE_MEM_DEBUG
bool
default n
prompt "Enable debug output from userspace memory management (very verbose)"
help
This will also enable the QAT_MEM warning messages. This option
produces quite verbose output hence why it is separate to the
standard debug.
WARNING: This option should never be enabled in a production environment
as it may output private key information to the console/logs and may
also introduce side channel timing attack vulnerabilities
config QAT_ENGINE_ENABLE_MULTITHREAD
bool
default n
prompt "Optimize for multi-threaded use"
help
This alternative method will give improved performance in a
multi-threaded environment by making the slab pools thread
local to avoid locking between threads. Although this can
give better performance there are several drawbacks such as
the memory slabs will be utilized less efficiently, and you
cannot allocate in one thread and free in another thread.
Running in this mode DOES NOT support processes that fork
config QAT_ENGINE_DISABLE_LENSTRA
bool
default n
prompt "Disable protection against Lenstra attack (CVE-2017-5681)"
help
The RSA-CRT implementation in the Intel(R) QAT OpenSSL* Engine for
OpenSSL* versions prior to v0.5.19 may allow remote attackers to
obtain private RSA keys by conducting a Lenstra side-channel attack.
From version v0.5.19 onward, protection against this form of attack
is effected by performing a Verify/Encrypt operation after the Sign/Decrypt
operation, and if a failure is detected then re-running the Sign/Decrypt
operation using the CPU. However, future releases of Intel(R) QAT
driver code or firmware may effect this protection instead, in which
case the Intel(R) QAT OpenSSL* Engine code-based protection would no
longer be required and this configuration option should then be selected.
config QAT_ENGINE_DISABLE_AUTOINIT_ONFORK
bool
default y
prompt "Disable auto engine init on fork"
help
Disable the engine from being initialized automatically following a
fork operation. This is useful in a situation where you want to tightly
control how many instances are being used for processes. For instance if an
application forks to start a process that does not utilize QAT currently
the default behaviour is for the engine to still automatically get started
in the child using up an engine instance. After using this flag either the
engine needs to be initialized manually using the engine message:
INIT_ENGINE or will automatically get initialized on the first QAT crypto
operation.
endmenu

View File

@ -0,0 +1,84 @@
#
# Copyright (C) Ian Cooper <iancooper@hotmail.com>
#
# This is free software, licensed under the GNU General Public License v3.
#
#
include $(TOPDIR)/rules.mk
PKG_NAME:=openssl-qat
PKG_VERSION:=0.6.4
PKG_RELEASE:=1
PKG_SOURCE:=v${PKG_VERSION}.tar.gz
PKG_SOURCE_URL:=https://github.com/intel/QAT_Engine/archive/refs/tags/
PKG_HASH:=skip
PKG_BUILD_DIR:=$(BUILD_DIR)/QAT_Engine-$(PKG_VERSION)
PKG_BUILD_DEPENDS:=openssl
PKG_FIXUP:=autoreconf
PKG_REMOVE_FILES:=autogen.sh
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/kernel.mk
define Package/openssl-qat
SECTION:=libs
CATEGORY:=Libraries
SUBMENU:=SSL
TITLE:=Intel Quick Assist OpenSSL Engine
URL:=https://github.com/intel/QAT_Engine.git
DEPENDS:= \
@TARGET_x86_64 \
+libopenssl \
+(TARGET_x86_64&&QAT_C2XXX):quickassist-c2xxx \
+(TARGET_x86_64&&QAT_C3XXX):quickassist-c3xxx
endef
define Package/openssl-qat/description
Intel Quick Assist hardware acceleration engine for OpenSSL
endef
define Package/openssl-qat/config
source "$(SOURCE)/Config.in"
endef
#CONFIGURE_ARGS += --with-openssl_install_dir=$(PKG_INSTALL_DIR)/usr
CONFIGURE_ARGS += --prefix=$(PKG_INSTALL_DIR)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_C3XXX) ,--with-qat_dir=$(KERNEL_BUILD_DIR)/quickassist-c3xxx-1.7)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_C2XXX) ,--with-qat_dir=$(KERNEL_BUILD_DIR)/quickassist-c2xxx-1.5)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_ENGINE_DISABLE_RSA) ,--disable-qat_rsa)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_ENGINE_DISABLE_DSA) ,--disable-qat_dsa)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_ENGINE_DISABLE_DH) ,--disable-qat_dh)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_ENGINE_DISABLE_ECDSA) ,--disable-qat_ecdsa)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_ENGINE_DISABLE_CIPHERS) ,--disable-qat_ciphers)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_ENGINE_DISABLE_PRF) ,--disable-qat_prf)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_ENGINE_DISABLE_HKDF) ,--disable-qat_hkdf)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_ENGINE_ENABLE_GCM_CIPHERS) ,--enable-qat_gcm)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_ENGINE_ENABLE_SMALL_PACKET) ,--enable-qat_small_pkt_offload)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_ENGINE_ENABLE_WARNINGS) ,--enable-qat_warnings)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_ENGINE_ENABLE_DEBUG) ,--enable-qat_debug)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_ENGINE_ENABLE_QAT_MEM_WARNINGS) ,--enable-qat_mem_warnings)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_ENGINE_ENABLE_MEM_DEBUG) ,--enable-qat_mem_debug)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_ENGINE_ENABLE_MULTITHREAD) ,--enable-multi_thread)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_ENGINE_DISABLE_LENSTRA) ,--disable-qat_lenstra_protection)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_ENGINE_DISABLE_AUTOINIT_ONFORK) ,--disable-qat_auto_engine_init_on_fork)
CONFIGURE_ARGS += $(if $(CONFIG_QAT_C2XXX) ,--enable-qat16_driver)
MAKE_VARS += \
CROSS_COMPILE="$(KERNEL_CROSS)" \
KERNEL_SOURCE_ROOT="$(LINUX_DIR)" \
PATH_AUTOCNF="include/generated/autoconf.h" \
WITH_ICP_TARGET="1"
define Package/openssl-qat/install
$(INSTALL_DIR) $(1)/usr/lib/engines-1.1
$(INSTALL_DIR) $(1)/usr/share/quickassist/QAT_Engine/config
$(CP) $(PKG_BUILD_DIR)/.libs/qatengine.so $(1)/usr/lib/engines-1.1
$(CP) $(PKG_BUILD_DIR)/qatengine.la $(1)/usr/lib/engines-1.1
$(CP) $(PKG_BUILD_DIR)/qat/config/c3xxx $(1)/usr/share/quickassist/QAT_Engine/config
endef
$(eval $(call BuildPackage,openssl-qat))

View File

@ -0,0 +1,21 @@
Index: QAT_Engine-0.6.4/configure.ac
===================================================================
--- QAT_Engine-0.6.4.orig/configure.ac
+++ QAT_Engine-0.6.4/configure.ac
@@ -554,13 +554,13 @@ case "$host_os" in
*linux*)
if test "`cc --version | head -1 | awk '{print $3>=4.9}' 2>/dev/null`" = "1"
then
- AC_ARG_WITH(cflags, AS_HELP_STRING(), , cflags="-shared -fPIC -Wall -Wformat -Wformat-security -O2 -D_FORTIFY_SOURCE=2 -fno-delete-null-pointer-checks -fwrapv -fstack-protector-strong -fno-strict-overflow")
+ AC_ARG_WITH(cflags, AS_HELP_STRING(), , cflags="-shared -fPIC -Wall -Wformat -Wformat-security -O2 -fno-delete-null-pointer-checks -fwrapv -fno-strict-overflow")
else
- AC_ARG_WITH(cflags, AS_HELP_STRING(), , cflags="-shared -fPIC -Wall -Wformat -Wformat-security -O2 -D_FORTIFY_SOURCE=2 -fno-delete-null-pointer-checks -fwrapv -fstack-protector -fno-strict-overflow")
+ AC_ARG_WITH(cflags, AS_HELP_STRING(), , cflags="-shared -fPIC -Wall -Wformat -Wformat-security -O2 -fno-delete-null-pointer-checks -fwrapv -fno-strict-overflow")
fi
;;
*freebsd*)
- AC_ARG_WITH(cflags, AS_HELP_STRING(), , cflags="-shared -fPIC -Wall -Wformat -Wformat-security -O2 -D_FORTIFY_SOURCE=2 -fno-delete-null-pointer-checks -fwrapv -fstack-protector-strong")
+ AC_ARG_WITH(cflags, AS_HELP_STRING(), , cflags="-shared -fPIC -Wall -Wformat -Wformat-security -O2 -fno-delete-null-pointer-checks -fwrapv -fstack-protector-strong")
;;
*) ;;
esac

View File

@ -0,0 +1,27 @@
--- a/.tools/configure.ac
+++ b/.tools/configure.ac
@@ -415,19 +415,19 @@ then
AC_MSG_NOTICE([Enabling writing debug to file])
fi
-
-AC_CHECK_PROG(USE_GETCONF, getconf, yes, no)
+AC_CHECK_PROG(USE_LDD, ldd, yes, no)
+AC_CHECK_PROG(USE_HEAD, head, yes, no)
AC_PROG_AWK
-if test $AWK == "gawk" -a $USE_GETCONF == "yes"
+if test $AWK == "gawk" -a $USE_LDD == "yes" -a $USE_HEAD
then
AC_MSG_NOTICE([Getting glibc version ...])
- if test `getconf GNU_LIBC_VERSION | gawk '{print $2>=2.23?"1":"0"}' 2>/dev/null` == 1
+ if test `ldd --version | head -1 | gawk '{print $4>=2.23?"1":"0"}' 2>/dev/null` == 1
then
AC_MSG_NOTICE([glibc version is greater or equal to 2.23 so AVX-512 optimisations are supported.])
else
AC_MSG_NOTICE([glibc version is less than 2.23 - no AVX-512 optimisation supported.])
fi
- if test `getconf GNU_LIBC_VERSION | gawk '{print $2<2.17?"1":"0"}' 2>/dev/null` == 1
+ if test `ldd --version | head -1 | gawk '{print $4<2.17?"1":"0"}' 2>/dev/null` == 1
then
AC_ARG_WITH(LIBS, AS_HELP_STRING(), , LIBS+="-lrt")
AC_SUBST(LIBS)

View File

@ -0,0 +1,11 @@
--- a/.tools/Makefile.am
+++ b/.tools/Makefile.am
@@ -137,7 +137,7 @@ MAKE = make err-files && make
endif
install-data-am:
- -cp -f $(prefix)/lib/libqat.so $(ENGINE_LIB)
+ cp -L --remove-destination .libs/libqat.so $(ENGINE_LIB)
err-files:
if QAT_OPENSSL_102

View File

@ -0,0 +1,11 @@
--- a/.tools/configure.ac
+++ b/.tools/configure.ac
@@ -533,7 +533,7 @@ then
AC_SUBST(QAT_SHARED_LIB_DEPS_DRIVER)
fi
-if test "x$enable_qat_contig_mem" != "xyes" -a "x$enable_multi_thread" != "xyes" -a "$enable_qat16_driver" = "xyes"
+if test "x$enable_qat_contig_mem" != "xyes" -a "x$enable_multi_thread" != "xyes"
then
AC_ARG_WITH(QAT_SHARED_LIB_DEPS_QAE_MEM, AS_HELP_STRING(), , QAT_SHARED_LIB_DEPS_QAE_MEM=["-Wl,-rpath,\$(with_usdm_dir) -L\$(with_usdm_dir) -lusdm_drv_s"])
AC_SUBST(QAT_SHARED_LIB_DEPS_QAE_MEM)

View File

@ -0,0 +1,15 @@
Index: openssl-qat-1/e_qat.c
===================================================================
--- openssl-qat-1.orig/e_qat.c
+++ openssl-qat-1/e_qat.c
@@ -1327,8 +1327,10 @@ static int bind_qat(ENGINE *e, const cha
* configuration as environment variables.
*/
+#if defined(__GLIBC__)
#if __GLIBC_PREREQ(2, 17)
config_section = secure_getenv("QAT_SECTION_NAME");
+#endif
#else
config_section = getenv("QAT_SECTION_NAME");
#endif

View File

@ -0,0 +1,108 @@
#
# Copyright (C) DL <revelstone@yahoo.com>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
#
include $(TOPDIR)/rules.mk
PKG_NAME:=qatzip
PKG_VERSION:=1
PKG_RELEASE:=1
PKG_SOURCE_URL:=https://github.com/intel/QATzip
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2020-05-15
PKG_SOURCE_VERSION:=5abaaf546a479350ada023115c6e3d499db2b363
PKG_MIRROR_HASH:=17ff33161e7a6b513f90050fb747e0a6f0a74ea3e4e3b1dc10b18e5540adbe9a
PKG_BUILD_DEPENDS:=openssl
PKG_FIXUP:=autoreconf
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/kernel.mk
define Package/libqatzip
SECTION:=libs
CATEGORY:=Libraries
SUBMENU:=Compression
TITLE:=Intel Quick Assist QATzip Compression Library
URL:=https://github.com/intel/QATzip
DEPENDS:= \
@TARGET_x86_64 \
+zlib \
+openssl-qat
endef
define Package/libqatzip/description
Intel Quick Assist userspace compression library
endef
define Package/qzip
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=Compression
TITLE:=Intel Quick Assist qzip compression utility
URL:=https://github.com/intel/QATzip
DEPENDS:= \
@TARGET_x86_64 \
+libqatzip
endef
define Package/qzip/description
Intel Quick Assist file compression utility
endef
PKG_BUILD_DEPENDS += $(if $(CONFIG_QAT_C2XXX),quickassist-c2xxx,quickassist-c3xxx)
QAT_DIR=$(KERNEL_BUILD_DIR)/$(if $(CONFIG_QAT_C2XXX),quickassist-c2xxx-1.5,quickassist-c3xxx-1.7)/quickassist
TARGET_CFLAGS += \
-I$(QAT_DIR)/include \
-I$(QAT_DIR)/include/dc \
-I$(QAT_DIR)/lookaside/access_layer/include \
-I$(QAT_DIR)/utilities/libusdm_drv \
-I$(PKG_BUILD_DIR)/include \
-I$(PKG_BUILD_DIR)/src \
-DADF_PCI_API \
-fPIC
TARGET_LDFLAGS += \
-L$(QAT_DIR)/build
MAKE_VARS += \
QATZIP_LIB_STATIC="libqatzip.a" \
QATZIP_LIB_SHARED="libqatzip.so" \
QATZIP_LIB_D="$(PKG_BUILD_DIR)/src" \
LIBADD="-lqat_s -lusdm_drv_s -lz -lpthread -ludev -lssl" \
VER="1.0.1" \
VER_M="1" \
LN_S="ln -s"
define Build/Configure
endef
define Build/Compile
$(call Build/Compile/Default, -C src libqatzip.so)
$(call Build/Compile/Default, -C src libqatzip.a)
$(call Build/Compile/Default, -C utils qzip)
endef
define Package/InstallDev
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_BUILD_DIR)/src/lib*.{a,so*} $(1)/usr/lib/
endef
define Package/libqatzip/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/src/lib*.so* $(1)/usr/lib/
endef
define Package/qzip/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_BUILD_DIR)/utils/qzip $(1)/usr/bin/qzip
endef
$(eval $(call BuildPackage,libqatzip))
$(eval $(call BuildPackage,qzip))

View File

@ -0,0 +1,14 @@
Index: qatzip-1/src/qatzip.c
===================================================================
--- qatzip-1.orig/src/qatzip.c
+++ qatzip-1/src/qatzip.c
@@ -40,7 +40,9 @@
#include <stdlib.h>
#include <assert.h>
#include <sys/time.h>
+#if defined(__linux__) && defined(__GLIBC__)
#include <bits/types.h>
+#endif
#include <stdio.h>
#include <sys/types.h>
#include <sys/syscall.h>

View File

@ -0,0 +1,14 @@
Index: qatzip-1/utils/qzip.c
===================================================================
--- qatzip-1.orig/utils/qzip.c
+++ qatzip-1/utils/qzip.c
@@ -776,7 +776,9 @@ int main(int argc, char **argv)
printf("For help, type: qzip -h\n");
} else {
stream_out = stdout;
+#ifdef __GLIBC___
stdout = freopen(NULL, "w", stdout);
+#endif
processStream(&g_sess, stdin, stream_out, g_decompress == 0);
}
} else {