summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiweiSong <liwei.song@windriver.com>2021-07-27 10:40:42 +0800
committerAnuj Mittal <anuj.mittal@intel.com>2021-07-27 22:00:39 +0800
commitda3bacb39c0bc8d0970502237c6c5a60533a997f (patch)
tree220a00d06e1480c33242544c1caaf17bccca52ba
parentc824eb30052764c39636b8b501d4a210c8aa1f1e (diff)
downloadmeta-intel-qat-da3bacb39c0bc8d0970502237c6c5a60533a997f.tar.gz
qat17: upgrade qat to 4.14.0-00031
upgrade qat from 4.12.0-00011 to 4.14.0-00031 adjust patch index and add a patch to fix deadlock issue. Signed-off-by: Liwei Song <liwei.song@windriver.com> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
-rw-r--r--recipes-extended/qat/files/0001-usdm_drv-convert-mutex_lock-to-mutex_trylock-to-avio.patch104
-rw-r--r--recipes-extended/qat/files/0006-qat-add-install-target-and-add-folder.patch16
-rw-r--r--recipes-extended/qat/files/0011-qat17-use-namespace-CRYPTO_INTERNAL.patch40
-rw-r--r--recipes-extended/qat/qat17_4.14.0-00031.bb (renamed from recipes-extended/qat/qat17_4.12.0-00011.bb)13
4 files changed, 147 insertions, 26 deletions
diff --git a/recipes-extended/qat/files/0001-usdm_drv-convert-mutex_lock-to-mutex_trylock-to-avio.patch b/recipes-extended/qat/files/0001-usdm_drv-convert-mutex_lock-to-mutex_trylock-to-avio.patch
new file mode 100644
index 0000000..04ff59e
--- /dev/null
+++ b/recipes-extended/qat/files/0001-usdm_drv-convert-mutex_lock-to-mutex_trylock-to-avio.patch
@@ -0,0 +1,104 @@
1From acf49dcacc450830bf9ccad5dcd895ce1b8ba786 Mon Sep 17 00:00:00 2001
2From: Liwei Song <liwei.song@windriver.com>
3Date: Thu, 22 Jul 2021 08:09:05 +0000
4Subject: [PATCH] usdm_drv: convert mutex_lock to mutex_trylock to aviod
5 deadlock
6
7exist the following deadlock when run cpa_sample_code:
8
9======================================================
10WARNING: possible circular locking dependency detected
115.10.47-yocto-standard #1 Tainted: G O
12------------------------------------------------------
13
14cpa_sample_code/2144 is trying to acquire lock:
15ffffffffc04883d0 (&dev_mem_lock
16=============================
17){+.+.}-{3:3}, at: mem_mmap+0x32/0x160 [usdm_drv]
18
19but task is already holding lock:
20ff1ab034bf111278 (&mm->mmap_lock#2){++++}-{3:3}, at: vm_mmap_pgoff+0x99/0x100
21
22which lock already depends on the new lock.
23
24the existing dependency chain (in reverse order) is:
25
26-> #1 (&mm->mmap_lock#2){++++}-{3:3}:
27 __lock_acquire+0x4be/0x980
28 lock_acquire+0xe1/0x2f0
29WARNING: suspicious RCU usage
30 __might_fault+0x5e/0x80
31 _copy_to_user+0x23/0xa0
32 mem_ioctl+0x2ed/0x3b5 [usdm_drv]
33 __x64_sys_ioctl+0x91/0xc0
34 do_syscall_64+0x38/0x50
35 entry_SYSCALL_64_after_hwframe+0x44/0xa9
365.10.47-yocto-standard #1 Tainted: G O
37
38-> #0 (&dev_mem_lock){+.+.}-{3:3}:
39 check_prev_add+0x95/0xc00
40 validate_chain+0x723/0xaa0
41 __lock_acquire+0x4be/0x980
42 lock_acquire+0xe1/0x2f0
43 __mutex_lock+0x97/0x960
44 mutex_lock_nested+0x1b/0x20
45 mem_mmap+0x32/0x160 [usdm_drv]
46-----------------------------
47 mmap_region+0x423/0x6b0
48 do_mmap+0x46a/0x5e0
49 vm_mmap_pgoff+0xc5/0x100
50 ksys_mmap_pgoff+0x1d0/0x230
51 __x64_sys_mmap+0x33/0x40
52 do_syscall_64+0x38/0x50
53 entry_SYSCALL_64_after_hwframe+0x44/0xa9
54kernel/sched/core.c:7263 Illegal context switch in RCU-bh read-side critical section!
55
56other info that might help us debug this:
57
58 Possible unsafe locking scenario:
59
60 CPU0 CPU1
61 ---- ----
62 lock(&mm->mmap_lock#2);
63 lock(&dev_mem_lock);
64 lock(&mm->mmap_lock#2);
65 lock(&dev_mem_lock);
66
67 *** DEADLOCK ***
68
69convert mutex_lock to mutex_trylock which will return without wait.
70
71Upstream-Status: Inappropriate
72
73Signed-off-by: Liwei Song <liwei.song@windriver.com>
74---
75 .../utilities/libusdm_drv/linux/kernel_space/qae_mem_drv.c | 6 +++++-
76 1 file changed, 5 insertions(+), 1 deletion(-)
77
78diff --git a/quickassist/utilities/libusdm_drv/linux/kernel_space/qae_mem_drv.c b/quickassist/utilities/libusdm_drv/linux/kernel_space/qae_mem_drv.c
79index e404647aafb2..2a4de14a0300 100644
80--- a/quickassist/utilities/libusdm_drv/linux/kernel_space/qae_mem_drv.c
81+++ b/quickassist/utilities/libusdm_drv/linux/kernel_space/qae_mem_drv.c
82@@ -87,6 +87,7 @@
83 #include <linux/uaccess.h>
84 #include <linux/version.h>
85 #include <linux/hugetlb.h>
86+#include <linux/delay.h>
87
88 #include "qae_mem_utils.h"
89
90@@ -975,7 +976,10 @@ mem_mmap(struct file *fp, struct vm_area_struct *vma)
91 unsigned long size = vma->vm_end - vma->vm_start;
92 id = vma->vm_pgoff << PAGE_SHIFT;
93
94- mutex_lock(&dev_mem_lock);
95+ while(!mutex_trylock(&dev_mem_lock)){
96+ udelay(5);
97+ }
98+
99 kmem = userMemGetInfo(fp, id);
100 if (!kmem)
101 {
102--
1032.29.2
104
diff --git a/recipes-extended/qat/files/0006-qat-add-install-target-and-add-folder.patch b/recipes-extended/qat/files/0006-qat-add-install-target-and-add-folder.patch
index 62d25e0..9d92f83 100644
--- a/recipes-extended/qat/files/0006-qat-add-install-target-and-add-folder.patch
+++ b/recipes-extended/qat/files/0006-qat-add-install-target-and-add-folder.patch
@@ -1,4 +1,4 @@
1From fc2ae28063d10721282a4e6009cec9143ce37c80 Mon Sep 17 00:00:00 2001 1From b6f1c6465ce5d9d3792b8e00fe0a94ddd2724b91 Mon Sep 17 00:00:00 2001
2From: "Tan, Raymond" <raymond.tan@intel.com> 2From: "Tan, Raymond" <raymond.tan@intel.com>
3Date: Mon, 4 Jun 2018 09:26:33 +0800 3Date: Mon, 4 Jun 2018 09:26:33 +0800
4Subject: [PATCH 06/11] qat-add-install-target-and-add-folder 4Subject: [PATCH 06/11] qat-add-install-target-and-add-folder
@@ -13,18 +13,18 @@ Signed-off-by: Tan, Raymond <raymond.tan@intel.com>
13 1 file changed, 22 insertions(+), 3 deletions(-) 13 1 file changed, 22 insertions(+), 3 deletions(-)
14 14
15diff --git a/quickassist/Makefile b/quickassist/Makefile 15diff --git a/quickassist/Makefile b/quickassist/Makefile
16index 558f85d..4cc0f2b 100644 16index 34aaae021a40..292a19921832 100644
17--- a/quickassist/Makefile 17--- a/quickassist/Makefile
18+++ b/quickassist/Makefile 18+++ b/quickassist/Makefile
19@@ -96,6 +96,7 @@ ICP_BUILD_OUTPUT?=build_$(DATE) 19@@ -98,6 +98,7 @@ export ICP_ACCEL_INC=YES
20 ICP_TOP_ENV=$(ICP_BUILDSYSTEM_PATH)/build_files/env_files/ 20 export ICP_PARAM_CHECK ?= y
21 export ICP_ACCEL_INC=YES 21 export CNV_STRICT_MODE ?= 1
22 LAC_LIB_DIR=$(LAC_PATH)/build/libs 22 LAC_LIB_DIR=$(LAC_PATH)/build/libs
23+MODULE_INSTALLPATH=$(SAMPLE_BUILD_OUTPUT)/lib/modules/$(QAT_KERNEL_VER)/updates/drivers/crypto/qat 23+MODULE_INSTALLPATH=$(SAMPLE_BUILD_OUTPUT)/lib/modules/$(QAT_KERNEL_VER)/updates/drivers/crypto/qat
24 24
25 #Release Package build steps 25 #Release Package build steps
26 ALL_TARGETS = lac_user lac_kernel 26 ALL_TARGETS = lac_user lac_kernel
27@@ -113,10 +114,14 @@ all: $(ALL_TARGETS) 27@@ -115,10 +116,14 @@ all: $(ALL_TARGETS)
28 28
29 user: lac_lib_dir libosal_user lac_user 29 user: lac_lib_dir libosal_user lac_user
30 30
@@ -41,7 +41,7 @@ index 558f85d..4cc0f2b 100644
41 41
42 # 42 #
43 # Common memory driver 43 # Common memory driver
44@@ -199,8 +204,22 @@ ifeq ($(ICP_NO_CLEAN),) 44@@ -201,8 +206,22 @@ ifeq ($(ICP_NO_CLEAN),)
45 endif 45 endif
46 46
47 47
@@ -66,5 +66,5 @@ index 558f85d..4cc0f2b 100644
66 lac_lib_dir: clean 66 lac_lib_dir: clean
67 test -d $(LAC_LIB_DIR) || mkdir -p $(LAC_LIB_DIR); 67 test -d $(LAC_LIB_DIR) || mkdir -p $(LAC_LIB_DIR);
68-- 68--
692.14.5 692.29.2
70 70
diff --git a/recipes-extended/qat/files/0011-qat17-use-namespace-CRYPTO_INTERNAL.patch b/recipes-extended/qat/files/0011-qat17-use-namespace-CRYPTO_INTERNAL.patch
index 1a7a647..c9eb5c3 100644
--- a/recipes-extended/qat/files/0011-qat17-use-namespace-CRYPTO_INTERNAL.patch
+++ b/recipes-extended/qat/files/0011-qat17-use-namespace-CRYPTO_INTERNAL.patch
@@ -1,4 +1,4 @@
1From 9b2b7a79fc9d9323fe9ec44de7619ea175c45bc1 Mon Sep 17 00:00:00 2001 1From 6a1fa62ffa4acd6e8e4d4f648e19363a2ed5ef74 Mon Sep 17 00:00:00 2001
2From: Yongxin Liu <yongxin.liu@windriver.com> 2From: Yongxin Liu <yongxin.liu@windriver.com>
3Date: Tue, 23 Mar 2021 09:31:25 +0000 3Date: Tue, 23 Mar 2021 09:31:25 +0000
4Subject: [PATCH 11/11] qat17: use namespace CRYPTO_INTERNAL 4Subject: [PATCH 11/11] qat17: use namespace CRYPTO_INTERNAL
@@ -11,12 +11,13 @@ Upstream-Status: Inappropriate [Code released in tarball form only]
11 11
12Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com> 12Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com>
13--- 13---
14 quickassist/lookaside/access_layer/src/linux/icp_qa_module.c | 3 +++ 14 quickassist/lookaside/access_layer/src/linux/icp_qa_module.c | 3 +++
15 .../utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c | 5 +++++ 15 quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c | 5 +++++
16 2 files changed, 8 insertions(+) 16 .../osal/src/linux/kernel_space/OsalCryptoInterface.c | 5 +++++
17 3 files changed, 13 insertions(+)
17 18
18diff --git a/quickassist/lookaside/access_layer/src/linux/icp_qa_module.c b/quickassist/lookaside/access_layer/src/linux/icp_qa_module.c 19diff --git a/quickassist/lookaside/access_layer/src/linux/icp_qa_module.c b/quickassist/lookaside/access_layer/src/linux/icp_qa_module.c
19index 413eb07..f3a371e 100644 20index db51add84592..209b3054aa8c 100644
20--- a/quickassist/lookaside/access_layer/src/linux/icp_qa_module.c 21--- a/quickassist/lookaside/access_layer/src/linux/icp_qa_module.c
21+++ b/quickassist/lookaside/access_layer/src/linux/icp_qa_module.c 22+++ b/quickassist/lookaside/access_layer/src/linux/icp_qa_module.c
22@@ -120,3 +120,6 @@ module_exit(kapi_mod_exit); 23@@ -120,3 +120,6 @@ module_exit(kapi_mod_exit);
@@ -26,14 +27,31 @@ index 413eb07..f3a371e 100644
26+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0)) 27+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0))
27+MODULE_IMPORT_NS(CRYPTO_INTERNAL); 28+MODULE_IMPORT_NS(CRYPTO_INTERNAL);
28+#endif 29+#endif
30diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c b/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c
31index 23249de3db39..0e61954c0150 100644
32--- a/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c
33+++ b/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c
34@@ -8,7 +8,12 @@
35 #include <crypto/internal/aead.h>
36 #include <crypto/internal/skcipher.h>
37 #include <crypto/aes.h>
38+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
39+#include <crypto/sha1.h>
40+#include <crypto/sha2.h>
41+#else
42 #include <crypto/sha.h>
43+#endif
44 #include <crypto/hash.h>
45 #include <crypto/algapi.h>
46 #include <crypto/authenc.h>
29diff --git a/quickassist/utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c b/quickassist/utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c 47diff --git a/quickassist/utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c b/quickassist/utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c
30index de24fa0..96c29c0 100644 48index ec536607989a..9d62bb8749d5 100644
31--- a/quickassist/utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c 49--- a/quickassist/utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c
32+++ b/quickassist/utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c 50+++ b/quickassist/utilities/osal/src/linux/kernel_space/OsalCryptoInterface.c
33@@ -75,6 +75,11 @@ 51@@ -76,6 +76,11 @@
34 #else 52 #endif /* end of 5.11.0, 2.6.29 checks */
35 #include <crypto/sha.h> 53 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
36 #endif 54 #include <crypto/internal/hash.h>
37+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0)) 55+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0))
38+#include <crypto/internal/cipher.h> 56+#include <crypto/internal/cipher.h>
39+#include <linux/module.h> 57+#include <linux/module.h>
@@ -43,5 +61,5 @@ index de24fa0..96c29c0 100644
43 #define OSAL_MAX_SHASH_DECSIZE 512 61 #define OSAL_MAX_SHASH_DECSIZE 512
44 62
45-- 63--
462.14.5 642.29.2
47 65
diff --git a/recipes-extended/qat/qat17_4.12.0-00011.bb b/recipes-extended/qat/qat17_4.14.0-00031.bb
index 28bcad7..d27d933 100644
--- a/recipes-extended/qat/qat17_4.12.0-00011.bb
+++ b/recipes-extended/qat/qat17_4.14.0-00031.bb
@@ -7,12 +7,12 @@ LIC_FILES_CHKSUM = "\
7 file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6 \ 7 file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6 \
8 file://${COMMON_LICENSE_DIR}/BSD;md5=3775480a712fc46a69647678acb234cb \ 8 file://${COMMON_LICENSE_DIR}/BSD;md5=3775480a712fc46a69647678acb234cb \
9 " 9 "
10DEPENDS += "boost udev zlib openssl" 10DEPENDS += "boost udev zlib openssl yasm-native"
11PROVIDES += "virtual/qat" 11PROVIDES += "virtual/qat"
12 12
13TARGET_CC_ARCH += "${LDFLAGS}" 13TARGET_CC_ARCH += "${LDFLAGS}"
14 14
15SRC_URI = "https://01.org/sites/default/files/downloads//qat1.7.l.4.12.0-00011.tar.gz;subdir=qat17 \ 15SRC_URI = "https://downloadmirror.intel.com/30178/eng/QAT1.7.L.4.14.0-00031.tar.gz;subdir=qat17 \
16 file://0001-qat-fix-for-cross-compilation-issue.patch \ 16 file://0001-qat-fix-for-cross-compilation-issue.patch \
17 file://0002-qat-remove-local-path-from-makefile.patch \ 17 file://0002-qat-remove-local-path-from-makefile.patch \
18 file://0003-qat-override-CC-LD-AR-only-when-it-is-not-define.patch \ 18 file://0003-qat-override-CC-LD-AR-only-when-it-is-not-define.patch \
@@ -20,16 +20,15 @@ SRC_URI = "https://01.org/sites/default/files/downloads//qat1.7.l.4.12.0-00011.t
20 file://0005-Added-include-dir-path.patch \ 20 file://0005-Added-include-dir-path.patch \
21 file://0006-qat-add-install-target-and-add-folder.patch \ 21 file://0006-qat-add-install-target-and-add-folder.patch \
22 file://0007-qat-use-static-lib-for-linking-under-cpa-sample-code.patch \ 22 file://0007-qat-use-static-lib-for-linking-under-cpa-sample-code.patch \
23 file://0008-qat-overwrite-KBUILD_BUILTIN-in-kernel-s-Makefile.patch \
24 file://0009-crypto-qat-Silence-smp_processor_id-warning.patch \ 23 file://0009-crypto-qat-Silence-smp_processor_id-warning.patch \
25 file://0010-qat-include-sha1.h-and-sha2.h-instead-of-sha.h-in-ke.patch \
26 file://0011-qat17-use-namespace-CRYPTO_INTERNAL.patch \ 24 file://0011-qat17-use-namespace-CRYPTO_INTERNAL.patch \
25 file://0001-usdm_drv-convert-mutex_lock-to-mutex_trylock-to-avio.patch \
27 " 26 "
28 27
29do_configure[depends] += "virtual/kernel:do_shared_workdir" 28do_configure[depends] += "virtual/kernel:do_shared_workdir"
30 29
31SRC_URI[md5sum] = "23d962944ae22ef14ff880fdbff4223b" 30SRC_URI[md5sum] = "a6ff665184159583542dac89b9226f09"
32SRC_URI[sha256sum] = "6b8d643780b2640d084f5bd50546c8dae4ae9ec50cf167660a0ebdc55619eb2e" 31SRC_URI[sha256sum] = "a68dfaea4308e0bb5f350b7528f1a076a0c6ba3ec577d60d99dc42c49307b76e"
33 32
34COMPATIBLE_MACHINE = "null" 33COMPATIBLE_MACHINE = "null"
35COMPATIBLE_HOST_x86-x32 = 'null' 34COMPATIBLE_HOST_x86-x32 = 'null'
@@ -145,7 +144,7 @@ do_install() {
145 install -m 0755 ${S}/quickassist/lookaside/access_layer/src/sample_code/performance/compression/canterbury ${D}${nonarch_base_libdir}/firmware 144 install -m 0755 ${S}/quickassist/lookaside/access_layer/src/sample_code/performance/compression/canterbury ${D}${nonarch_base_libdir}/firmware
146 145
147 #install qat source 146 #install qat source
148 cp ${DL_DIR}/qat1.7.l.${PV}.tar.gz ${D}${prefix}/src/qat/ 147 cp ${DL_DIR}/QAT1.7.L.${PV}.tar.gz ${D}${prefix}/src/qat/
149} 148}
150 149
151PACKAGES += "${PN}-app" 150PACKAGES += "${PN}-app"