From 68cdafdbb8c3515328cedd351b471e1bb918bd27 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Wed, 30 Sep 2020 22:17:30 +0200 Subject: [PATCH] Add intel_QAT patches Add community compatibility patches for Intel QAT Due to incompatibility with higher kernel versions. Also includes basic instructions. Reviewed-by: Brian Behlendorf Signed-off-by: Kjeld Schouten-Lebbing Closes #10961 Closes #10962 --- contrib/intel_qat/patch/0001-cryptohash.diff | 17 ++++++++++ contrib/intel_qat/patch/0001-pci_aer.diff | 20 +++++++++++ contrib/intel_qat/patch/0001-timespec.diff | 35 ++++++++++++++++++++ contrib/intel_qat/patch/LICENSE | 30 +++++++++++++++++ contrib/intel_qat/readme.md | 27 +++++++++++++++ 5 files changed, 129 insertions(+) create mode 100644 contrib/intel_qat/patch/0001-cryptohash.diff create mode 100644 contrib/intel_qat/patch/0001-pci_aer.diff create mode 100644 contrib/intel_qat/patch/0001-timespec.diff create mode 100644 contrib/intel_qat/patch/LICENSE create mode 100644 contrib/intel_qat/readme.md diff --git a/contrib/intel_qat/patch/0001-cryptohash.diff b/contrib/intel_qat/patch/0001-cryptohash.diff new file mode 100644 index 000000000..2d87c8f36 --- /dev/null +++ b/contrib/intel_qat/patch/0001-cryptohash.diff @@ -0,0 +1,17 @@ +cryptohash.h was dropped and merged with crypto/sha.sh in 5.8 kernel. Details in: +https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=228c4f265c6eb60eaa4ed0edb3bf7c113173576c + +--- +diff --git a/quickassist/utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c b/quickassist/utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c +index 4c389da..e602377 100644 +--- a/quickassist/utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c ++++ b/quickassist/utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c +@@ -66,7 +66,7 @@ + + #include "Osal.h" + #include +-#include ++#include + #include + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + #include diff --git a/contrib/intel_qat/patch/0001-pci_aer.diff b/contrib/intel_qat/patch/0001-pci_aer.diff new file mode 100644 index 000000000..7516ac4fe --- /dev/null +++ b/contrib/intel_qat/patch/0001-pci_aer.diff @@ -0,0 +1,20 @@ +In kernel 5.7 the pci_cleanup_aer_uncorrect_error_status() function was +renamed with the following commit: + +git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=894020fdd88c1e9a74c60b67c0f19f1c7696ba2f + +This simply updates the function call with the proper name (pci_aer_clear_nonfatal_status()). + +--- +diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/adf_aer.c b/quickassist/qat/drivers/crypto/qat/qat_common/adf_aer.c +index a6ce6df..545bb79 100644 +--- a/quickassist/qat/drivers/crypto/qat/qat_common/adf_aer.c ++++ b/quickassist/qat/drivers/crypto/qat/qat_common/adf_aer.c +@@ -304,7 +304,7 @@ static pci_ers_result_t adf_slot_reset(struct pci_dev *pdev) + pr_err("QAT: Can't find acceleration device\n"); + return PCI_ERS_RESULT_DISCONNECT; + } +- pci_cleanup_aer_uncorrect_error_status(pdev); ++ pci_aer_clear_nonfatal_status(pdev); + if (adf_dev_aer_schedule_reset(accel_dev, ADF_DEV_RESET_SYNC)) + return PCI_ERS_RESULT_DISCONNECT; diff --git a/contrib/intel_qat/patch/0001-timespec.diff b/contrib/intel_qat/patch/0001-timespec.diff new file mode 100644 index 000000000..04fb053e1 --- /dev/null +++ b/contrib/intel_qat/patch/0001-timespec.diff @@ -0,0 +1,35 @@ +This patch attempts to expose timespec and getnstimeofday which were +explicitly hidden in the 5.6 kernel with the introduction of the +following commits: + +git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c766d1472c70d25ad475cf56042af1652e792b23 +git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=412c53a680a97cb1ae2c0ab60230e193bee86387 + +Code received from users@dpdk.org, issue tracked under QATE-59888. + +--- +diff --git a/quickassist/lookaside/access_layer/src/sample_code/performance/framework/linux/kernel_space/cpa_sample_code_utils.c b/quickassist/lookaside/access_layer/src/sample_code/performance/framework/linux/kernel_space/cpa_sample_code_utils.c +index 4639834..523e376 100644 +--- a/quickassist/lookaside/access_layer/src/sample_code/performance/framework/linux/kernel_space/cpa_sample_code_utils.c ++++ b/quickassist/lookaside/access_layer/src/sample_code/performance/framework/linux/kernel_space/cpa_sample_code_utils.c +@@ -107,6 +107,8 @@ atomic_t arrived; + extern struct device perf_device; + #endif + ++#define timespec timespec64 ++#define getnstimeofday ktime_get_real_ts64 + + /* Define a number for timeout */ + #define SAMPLE_CODE_MAX_LONG (0x7FFFFFFF) +diff --git a/quickassist/qat/compat/qat_compat.h b/quickassist/qat/compat/qat_compat.h +index 2a02eaf..3515092 100644 +--- a/quickassist/qat/compat/qat_compat.h ++++ b/quickassist/qat/compat/qat_compat.h +@@ -466,4 +466,7 @@ static inline void pci_ignore_hotplug(struct pci_dev *dev) + #if (RHEL_RELEASE_CODE && RHEL_RELEASE_VERSION(7, 3) <= RHEL_RELEASE_CODE) + #define QAT_KPT_CAP_DISCOVERY + #endif ++ ++#define timespec timespec64 ++#define getnstimeofday ktime_get_real_ts64 + #endif /* _QAT_COMPAT_H_ */ diff --git a/contrib/intel_qat/patch/LICENSE b/contrib/intel_qat/patch/LICENSE new file mode 100644 index 000000000..8e12726c0 --- /dev/null +++ b/contrib/intel_qat/patch/LICENSE @@ -0,0 +1,30 @@ +BSD LICENSE + +Copyright (c) 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. diff --git a/contrib/intel_qat/readme.md b/contrib/intel_qat/readme.md new file mode 100644 index 000000000..7e45d395b --- /dev/null +++ b/contrib/intel_qat/readme.md @@ -0,0 +1,27 @@ +# Intel_QAT easy install script + +This contrib contains community compatibility patches to get Intel QAT working on the following kernel versions: +- 5.6 +- 5.7 +- 5.8 + +These patches are based on the following Intel QAT version: +[1.7.l.4.10.0-00014](https://01.org/sites/default/files/downloads/qat1.7.l.4.10.0-00014.tar.gz) + +When using QAT with above kernels versions, the following patches needs to be applied using: +patch -p1 < _$PATCH_ +_Where $PATCH refers to the path of the patch in question_ + +### 5.6 +/patch/0001-timespec.diff + +### 5.7 +/patch/0001-pci_aer.diff + +### 5.8 +/patch/0001-cryptohash.diff + + +_Patches are supplied by [Storage Performance Development Kit (SPDK)](https://github.com/spdk/spdk)_ + +