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 <behlendorf1@llnl.gov>
Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
Closes #10961 
Closes #10962
This commit is contained in:
Kjeld Schouten-Lebbing 2020-09-30 22:17:30 +02:00 committed by GitHub
parent 5aa3e3d3be
commit 68cdafdbb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 129 additions and 0 deletions

View File

@ -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 <linux/crypto.h>
-#include <linux/cryptohash.h>
+#include <crypto/sha.h>
#include <linux/version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
#include <crypto/internal/hash.h>

View File

@ -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;

View File

@ -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_ */

View File

@ -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.

View File

@ -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)_