summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYongxin Liu <yongxin.liu@windriver.com>2020-03-31 22:11:02 +0800
committerAnuj Mittal <anuj.mittal@intel.com>2020-04-02 00:10:07 +0800
commitfe4ec71117c34f6e4b3b31b55dfbd528ca518955 (patch)
tree9ce951a1b1b2ca69cab47bfd6c0bc9fba398b20b
parent3f32ece68a4bda31e654eb72f5a1c18d941d12ca (diff)
downloadmeta-intel-qat-fe4ec71117c34f6e4b3b31b55dfbd528ca518955.tar.gz
qat: Make it compatible with kernel 5.6
Add qat17_4.7.0-00006-make-it-compitable-with-kernel-5.6.patch when compiling qat with kernel 5.6. In the patch, replace struct timespec with y2038 safe struct timespec64. And add definition of CRYPTO_TFM_RES_BAD_KEY_LEN back for qat driver. Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
-rw-r--r--recipes-extended/qat/files/qat17_4.7.0-00006-make-it-compatible-with-kernel-5.6.patch96
-rw-r--r--recipes-extended/qat/qat17_4.7.0-00006.bb9
2 files changed, 105 insertions, 0 deletions
diff --git a/recipes-extended/qat/files/qat17_4.7.0-00006-make-it-compatible-with-kernel-5.6.patch b/recipes-extended/qat/files/qat17_4.7.0-00006-make-it-compatible-with-kernel-5.6.patch
new file mode 100644
index 0000000..0851724
--- /dev/null
+++ b/recipes-extended/qat/files/qat17_4.7.0-00006-make-it-compatible-with-kernel-5.6.patch
@@ -0,0 +1,96 @@
1From 75fe2382f42ac42333a28445bb54132afd9a27a1 Mon Sep 17 00:00:00 2001
2From: Yongxin Liu <yongxin.liu@windriver.com>
3Date: Tue, 31 Mar 2020 19:44:25 +0000
4Subject: [PATCH] qat17: make it compatible with kernel 5.6
5
61) In kernel commit c766d1472c70 ("y2038: hide timeval/timespec/itimerval
7/itimerspec types"), timespec was hiden, so change timespec to timespec64.
8
92) CRYPTO_TFM_RES_BAD_KEY_LEN was removed in kernel commit 674f368a952c
10("crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN"). Add it back, since qat driver
11needs it.
12
13Upstream-Status: Inappropriate [Code released in tarball form only]
14
15Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com>
16---
17 .../drivers/crypto/qat/qat_common/adf_clock.c | 18 +++++++++---------
18 .../drivers/crypto/qat/qat_common/qat_algs.c | 2 ++
19 2 files changed, 11 insertions(+), 9 deletions(-)
20
21diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/adf_clock.c b/quickassist/qat/drivers/crypto/qat/qat_common/adf_clock.c
22index 8785f67..be3d9b8 100644
23--- a/quickassist/qat/drivers/crypto/qat/qat_common/adf_clock.c
24+++ b/quickassist/qat/drivers/crypto/qat/qat_common/adf_clock.c
25@@ -113,7 +113,7 @@ int adf_clock_debugfs_add(struct adf_accel_dev *accel_dev)
26 #endif
27 EXPORT_SYMBOL_GPL(adf_clock_debugfs_add);
28
29-static inline s64 timespec_to_us(const struct timespec *ts)
30+static inline s64 timespec_to_us(const struct timespec64 *ts)
31 {
32 return ((s64)ts->tv_sec * USEC_PER_SEC +
33 (ts->tv_nsec + NSEC_PER_USEC / 2) / NSEC_PER_USEC);
34@@ -129,10 +129,10 @@ static inline s64 timespec_to_us(const struct timespec *ts)
35 static int measure_clock(struct adf_accel_dev *accel_dev,
36 u32 *frequency)
37 {
38- struct timespec ts1;
39- struct timespec ts2;
40- struct timespec ts3;
41- struct timespec ts4;
42+ struct timespec64 ts1;
43+ struct timespec64 ts2;
44+ struct timespec64 ts3;
45+ struct timespec64 ts4;
46 u64 delta_us = 0;
47 u64 timestamp1 = 0;
48 u64 timestamp2 = 0;
49@@ -143,13 +143,13 @@ static int measure_clock(struct adf_accel_dev *accel_dev,
50 return -EIO;
51
52 do {
53- getnstimeofday(&ts1);
54+ ktime_get_real_ts64(&ts1);
55 if (adf_get_fw_timestamp(accel_dev, &timestamp1)) {
56 dev_err(&GET_DEV(accel_dev),
57 "Failed to get fw timestamp\n");
58 return -EIO;
59 }
60- getnstimeofday(&ts2);
61+ ktime_get_real_ts64(&ts2);
62 delta_us = timespec_to_us(&ts2) - timespec_to_us(&ts1);
63 } while (delta_us > MEASURE_CLOCK_DELTA_THRESHOLD &&
64 ++tries < MEASURE_CLOCK_RETRIES);
65@@ -162,13 +162,13 @@ static int measure_clock(struct adf_accel_dev *accel_dev,
66
67 tries = 0;
68 do {
69- getnstimeofday(&ts3);
70+ ktime_get_real_ts64(&ts3);
71 if (adf_get_fw_timestamp(accel_dev, &timestamp2)) {
72 dev_err(&GET_DEV(accel_dev),
73 "Failed to get fw timestamp\n");
74 return -EIO;
75 }
76- getnstimeofday(&ts4);
77+ ktime_get_real_ts64(&ts4);
78 delta_us = timespec_to_us(&ts4) - timespec_to_us(&ts3);
79 } while (delta_us > MEASURE_CLOCK_DELTA_THRESHOLD &&
80 ++tries < MEASURE_CLOCK_RETRIES);
81diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c b/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c
82index c4edb3c..b509dca 100644
83--- a/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c
84+++ b/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c
85@@ -73,6 +73,8 @@
86 ICP_QAT_HW_CIPHER_KEY_CONVERT, \
87 ICP_QAT_HW_CIPHER_DECRYPT)
88
89+#define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000
90+
91 static DEFINE_MUTEX(algs_lock);
92 static unsigned int active_devs;
93
94--
952.24.1
96
diff --git a/recipes-extended/qat/qat17_4.7.0-00006.bb b/recipes-extended/qat/qat17_4.7.0-00006.bb
index a77f4c0..2f783f5 100644
--- a/recipes-extended/qat/qat17_4.7.0-00006.bb
+++ b/recipes-extended/qat/qat17_4.7.0-00006.bb
@@ -22,6 +22,7 @@ SRC_URI = "https://01.org/sites/default/files/downloads/qat1.7.l.4.7.0-00006.tar
22 file://qat17_4.7.0-00006-Link-driver-with-object-files.patch \ 22 file://qat17_4.7.0-00006-Link-driver-with-object-files.patch \
23 file://qat17_4.7.0-00006-Drop-pr_warning-definition.patch \ 23 file://qat17_4.7.0-00006-Drop-pr_warning-definition.patch \
24 file://qat17_4.7.0-00006-Switch-to-skcipher-API.patch;apply=0 \ 24 file://qat17_4.7.0-00006-Switch-to-skcipher-API.patch;apply=0 \
25 file://qat17_4.7.0-00006-make-it-compatible-with-kernel-5.6.patch;apply=0 \
25 " 26 "
26 27
27do_patch[depends] += "virtual/kernel:do_shared_workdir" 28do_patch[depends] += "virtual/kernel:do_shared_workdir"
@@ -29,6 +30,8 @@ do_patch[depends] += "virtual/kernel:do_shared_workdir"
29do_patch_append () { 30do_patch_append () {
30 if d.getVar("KERNEL_VERSION") >= "5.5%": 31 if d.getVar("KERNEL_VERSION") >= "5.5%":
31 bb.build.exec_func('do_switch_to_skcipher_api', d) 32 bb.build.exec_func('do_switch_to_skcipher_api', d)
33 if d.getVar("KERNEL_VERSION") >= "5.6%":
34 bb.build.exec_func('do_patch_for_kernel_5_6', d)
32} 35}
33 36
34do_switch_to_skcipher_api () { 37do_switch_to_skcipher_api () {
@@ -36,6 +39,12 @@ do_switch_to_skcipher_api () {
36 patch -p1 < "${WORKDIR}/qat17_4.7.0-00006-Switch-to-skcipher-API.patch" 39 patch -p1 < "${WORKDIR}/qat17_4.7.0-00006-Switch-to-skcipher-API.patch"
37} 40}
38 41
42do_patch_for_kernel_5_6 () {
43 cd "${S}"
44 patch -p1 < "${WORKDIR}/qat17_4.7.0-00006-make-it-compatible-with-kernel-5.6.patch"
45}
46
47
39SRC_URI[md5sum] = "ac939b51cc8836c182e31e309c065002" 48SRC_URI[md5sum] = "ac939b51cc8836c182e31e309c065002"
40SRC_URI[sha256sum] = "5c8bdc35fd7a42f212f1f87eb9e3d8584df7af56dae366debc487981e531fa5c" 49SRC_URI[sha256sum] = "5c8bdc35fd7a42f212f1f87eb9e3d8584df7af56dae366debc487981e531fa5c"
41 50