diff options
-rw-r--r-- | recipes-extended/qat/files/qat16_2.3.0-34-qat-remove-local-path-from-makefile.patch | 15 | ||||
-rw-r--r-- | recipes-extended/qat/files/qat17_0.9.0-4-qat-add-install-target-and-add-folder.patch | 16 | ||||
-rw-r--r-- | recipes-extended/qat/files/qat17_4.7.0-00006-Drop-pr_warning-definition.patch | 31 | ||||
-rw-r--r-- | recipes-extended/qat/files/qat17_4.7.0-00006-Link-driver-with-object-files.patch | 91 | ||||
-rw-r--r-- | recipes-extended/qat/files/qat17_4.7.0-00006-Switch-to-skcipher-API.patch | 1161 | ||||
-rw-r--r-- | recipes-extended/qat/qat17_4.7.0-00006.bb (renamed from recipes-extended/qat/qat17_4.2.0-00012.bb) | 67 |
6 files changed, 1332 insertions, 49 deletions
diff --git a/recipes-extended/qat/files/qat16_2.3.0-34-qat-remove-local-path-from-makefile.patch b/recipes-extended/qat/files/qat16_2.3.0-34-qat-remove-local-path-from-makefile.patch index da40e9f..96791cb 100644 --- a/recipes-extended/qat/files/qat16_2.3.0-34-qat-remove-local-path-from-makefile.patch +++ b/recipes-extended/qat/files/qat16_2.3.0-34-qat-remove-local-path-from-makefile.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 5044a14a6b4192b771f16aa834f688c1fd1287dd Mon Sep 17 00:00:00 2001 | 1 | From 1e29afc0e69fb9118cb0dcb924cdffa9db730572 Mon Sep 17 00:00:00 2001 |
2 | From: Anuj Mittal <anujx.mittal@intel.com> | 2 | From: Anuj Mittal <anujx.mittal@intel.com> |
3 | Date: Wed, 8 Jul 2015 11:11:32 +0800 | 3 | Date: Wed, 8 Jul 2015 11:11:32 +0800 |
4 | Subject: [PATCH] qat: remove local path from makefile | 4 | Subject: [PATCH] qat: remove local path from makefile |
@@ -9,22 +9,23 @@ Remove the host machine /usr/include path from makefile. | |||
9 | 9 | ||
10 | Signed-off-by: Anuj Mittal <anujx.mittal@intel.com> | 10 | Signed-off-by: Anuj Mittal <anujx.mittal@intel.com> |
11 | --- | 11 | --- |
12 | .../build_files/env_files/linux_2.6_user_space.mk | 3 +-- | 12 | quickassist/build_system/build_files/env_files/linux_2.6_user_space.mk | 3 +-- |
13 | 1 file changed, 1 insertion(+), 2 deletions(-) | 13 | 1 file changed, 1 insertion(+), 2 deletions(-) |
14 | 14 | ||
15 | diff --git a/quickassist/build_system/build_files/env_files/linux_2.6_user_space.mk b/quickassist/build_system/build_files/env_files/linux_2.6_user_space.mk | 15 | diff --git a/quickassist/build_system/build_files/env_files/linux_2.6_user_space.mk b/quickassist/build_system/build_files/env_files/linux_2.6_user_space.mk |
16 | index 1451f4a..719d1bb 100755 | 16 | index f7f18a5..e8c9f18 100644 |
17 | --- a/quickassist/build_system/build_files/env_files/linux_2.6_user_space.mk | 17 | --- a/quickassist/build_system/build_files/env_files/linux_2.6_user_space.mk |
18 | +++ b/quickassist/build_system/build_files/env_files/linux_2.6_user_space.mk | 18 | +++ b/quickassist/build_system/build_files/env_files/linux_2.6_user_space.mk |
19 | @@ -72,8 +72,7 @@ | 19 | @@ -46,8 +46,7 @@ |
20 | # | 20 | # |
21 | #------------------------------------------------------------- | 21 | #------------------------------------------------------------- |
22 | 22 | ||
23 | -INCLUDES+=-I/usr/include \ | 23 | -INCLUDES+=-I/usr/include \ |
24 | - -I$(API_DIR) \ | 24 | - -I$(API_DIR) \ |
25 | +INCLUDES+=-I$(API_DIR) \ | 25 | +INCLUDES+=-I$(API_DIR) \ |
26 | -I$(ADF_CMN_DIR) \ | ||
26 | -I$(OSAL_DIR)/include \ | 27 | -I$(OSAL_DIR)/include \ |
27 | -I$(OSAL_DIR)/src/linux/user_space/include | 28 | -I$(OSAL_DIR)/src/linux/user_space/include |
29 | -- | ||
30 | 2.14.4 | ||
28 | 31 | ||
29 | -- | ||
30 | 1.7.9.5 | ||
diff --git a/recipes-extended/qat/files/qat17_0.9.0-4-qat-add-install-target-and-add-folder.patch b/recipes-extended/qat/files/qat17_0.9.0-4-qat-add-install-target-and-add-folder.patch index 6b6dfa9..a810cfc 100644 --- a/recipes-extended/qat/files/qat17_0.9.0-4-qat-add-install-target-and-add-folder.patch +++ b/recipes-extended/qat/files/qat17_0.9.0-4-qat-add-install-target-and-add-folder.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 22963fed4e9017ca05855bd2373e2467f45ebe30 Mon Sep 17 00:00:00 2001 | 1 | From a94af9df0fa6f2c41efaf7ef6c17d0e5bb8aa80d Mon Sep 17 00:00:00 2001 |
2 | From: "Tan, Raymond" <raymond.tan@intel.com> | 2 | From: "Tan, Raymond" <raymond.tan@intel.com> |
3 | Date: Mon, 4 Jun 2018 09:26:33 +0800 | 3 | Date: Mon, 4 Jun 2018 09:26:33 +0800 |
4 | Subject: [PATCH] qat-add-install-target-and-add-folder | 4 | Subject: [PATCH] qat-add-install-target-and-add-folder |
@@ -8,23 +8,24 @@ Upstream-Status: Inappropriate [Configuration] | |||
8 | Modify Makefile to add install target and add folder | 8 | Modify Makefile to add install target and add folder |
9 | 9 | ||
10 | Signed-off-by: Tan, Raymond <raymond.tan@intel.com> | 10 | Signed-off-by: Tan, Raymond <raymond.tan@intel.com> |
11 | |||
11 | --- | 12 | --- |
12 | quickassist/Makefile | 25 ++++++++++++++++++++++--- | 13 | quickassist/Makefile | 25 ++++++++++++++++++++++--- |
13 | 1 file changed, 22 insertions(+), 3 deletions(-) | 14 | 1 file changed, 22 insertions(+), 3 deletions(-) |
14 | 15 | ||
15 | diff --git a/quickassist/Makefile b/quickassist/Makefile | 16 | diff --git a/quickassist/Makefile b/quickassist/Makefile |
16 | index 3e08241..1647d9e 100644 | 17 | index 93990f2..70a4353 100644 |
17 | --- a/quickassist/Makefile | 18 | --- a/quickassist/Makefile |
18 | +++ b/quickassist/Makefile | 19 | +++ b/quickassist/Makefile |
19 | @@ -64,6 +64,7 @@ ICP_BUILD_OUTPUT?=build_$(DATE) | 20 | @@ -97,6 +97,7 @@ ICP_BUILD_OUTPUT?=build_$(DATE) |
20 | ICP_TOP_ENV=$(ICP_BUILDSYSTEM_PATH)/build_files/env_files/ | 21 | ICP_TOP_ENV=$(ICP_BUILDSYSTEM_PATH)/build_files/env_files/ |
21 | export ICP_ACCEL_INC=YES | 22 | export ICP_ACCEL_INC=YES |
22 | LAC_LIB_DIR=$(LAC_PATH)/build/libs | 23 | LAC_LIB_DIR=$(LAC_PATH)/build/libs |
23 | +MODULE_INSTALLPATH=$(SAMPLE_BUILD_OUTPUT)/lib/modules/$(QAT_KERNEL_VER)/updates/drivers/crypto/qat | 24 | +MODULE_INSTALLPATH=$(SAMPLE_BUILD_OUTPUT)/lib/modules/$(QAT_KERNEL_VER)/updates/drivers/crypto/qat |
24 | 25 | ||
25 | #Release Package build steps | 26 | #Release Package build steps |
26 | ALL_TARGETS = clean lac_lib_dir qat_direct libosal_user lac_user | 27 | ALL_TARGETS = lac_user lac_kernel |
27 | @@ -80,10 +81,14 @@ all: $(ALL_TARGETS) | 28 | @@ -114,10 +115,14 @@ all: $(ALL_TARGETS) |
28 | 29 | ||
29 | user: lac_lib_dir libosal_user lac_user | 30 | user: lac_lib_dir libosal_user lac_user |
30 | 31 | ||
@@ -41,7 +42,7 @@ index 3e08241..1647d9e 100644 | |||
41 | 42 | ||
42 | # | 43 | # |
43 | # Common memory driver | 44 | # Common memory driver |
44 | @@ -143,8 +148,22 @@ ifeq ($(ICP_NO_CLEAN),) | 45 | @@ -200,8 +205,22 @@ ifeq ($(ICP_NO_CLEAN),) |
45 | endif | 46 | endif |
46 | 47 | ||
47 | 48 | ||
@@ -65,6 +66,3 @@ index 3e08241..1647d9e 100644 | |||
65 | 66 | ||
66 | lac_lib_dir: clean | 67 | lac_lib_dir: clean |
67 | test -d $(LAC_LIB_DIR) || mkdir -p $(LAC_LIB_DIR); | 68 | test -d $(LAC_LIB_DIR) || mkdir -p $(LAC_LIB_DIR); |
68 | -- | ||
69 | 1.9.1 | ||
70 | |||
diff --git a/recipes-extended/qat/files/qat17_4.7.0-00006-Drop-pr_warning-definition.patch b/recipes-extended/qat/files/qat17_4.7.0-00006-Drop-pr_warning-definition.patch new file mode 100644 index 0000000..6b816df --- /dev/null +++ b/recipes-extended/qat/files/qat17_4.7.0-00006-Drop-pr_warning-definition.patch | |||
@@ -0,0 +1,31 @@ | |||
1 | From 058673d6798b835dce7f27fe172b7727bbaf30cf Mon Sep 17 00:00:00 2001 | ||
2 | From: Yongxin Liu <yongxin.liu@windriver.com> | ||
3 | Date: Wed, 15 Jan 2020 15:25:15 +0000 | ||
4 | Subject: [PATCH] qat: Drop pr_warning definition | ||
5 | |||
6 | In mainline kernel commit 61ff72f40168 ("printk: Drop pr_warning | ||
7 | definition"), pr_warning was dropped. | ||
8 | |||
9 | Upstream-Status: Inappropriate [Code released in tarball form only] | ||
10 | |||
11 | Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com> | ||
12 | --- | ||
13 | quickassist/utilities/libusdm_drv/linux/include/qae_mem_utils.h | 2 +- | ||
14 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/quickassist/utilities/libusdm_drv/linux/include/qae_mem_utils.h b/quickassist/utilities/libusdm_drv/linux/include/qae_mem_utils.h | ||
17 | index f4a56dc..d88e762 100644 | ||
18 | --- a/quickassist/utilities/libusdm_drv/linux/include/qae_mem_utils.h | ||
19 | +++ b/quickassist/utilities/libusdm_drv/linux/include/qae_mem_utils.h | ||
20 | @@ -93,7 +93,7 @@ MALLOC_DECLARE(M_QAE_MEM); | ||
21 | |||
22 | #define mm_info(...) pr_info(USDM_MOD __VA_ARGS__) | ||
23 | |||
24 | -#define mm_warning(...) pr_warning(USDM_MOD __VA_ARGS__) | ||
25 | +#define mm_warning(...) pr_warn(USDM_MOD __VA_ARGS__) | ||
26 | |||
27 | /*define types which need to vary between 32 and 64 bit*/ | ||
28 | #define QAE_PAGE_SHIFT 12 | ||
29 | -- | ||
30 | 2.24.1 | ||
31 | |||
diff --git a/recipes-extended/qat/files/qat17_4.7.0-00006-Link-driver-with-object-files.patch b/recipes-extended/qat/files/qat17_4.7.0-00006-Link-driver-with-object-files.patch new file mode 100644 index 0000000..0780426 --- /dev/null +++ b/recipes-extended/qat/files/qat17_4.7.0-00006-Link-driver-with-object-files.patch | |||
@@ -0,0 +1,91 @@ | |||
1 | From 555a4b3605e983e492f8c67e38a094933bc7efcd Mon Sep 17 00:00:00 2001 | ||
2 | From: Yongxin Liu <yongxin.liu@windriver.com> | ||
3 | Date: Mon, 6 Jan 2020 09:26:39 +0800 | ||
4 | Subject: [PATCH] qat: Link driver with object files instead of archived files | ||
5 | |||
6 | Due to mainline kernel commit 69ea912fda7 ("kbuild: remove unneeded | ||
7 | link_multi_deps"), modules cannot link *.a archives. So change .a to | ||
8 | .o files. | ||
9 | |||
10 | Upstream-Status: Inappropriate [Temporary workaround for kernel later than | ||
11 | v4.19-rc3] | ||
12 | |||
13 | Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com> | ||
14 | |||
15 | --- | ||
16 | quickassist/Makefile | 2 ++ | ||
17 | .../lookaside/access_layer/src/Makefile | 21 +++++++++---------- | ||
18 | 2 files changed, 12 insertions(+), 11 deletions(-) | ||
19 | |||
20 | diff --git a/quickassist/Makefile b/quickassist/Makefile | ||
21 | index 70a4353..5f6ee46 100644 | ||
22 | --- a/quickassist/Makefile | ||
23 | +++ b/quickassist/Makefile | ||
24 | @@ -154,6 +154,7 @@ libosal_kernel: clean output_dir lac_lib_dir | ||
25 | echo ; echo 'Copying OSAL library'; | ||
26 | cp $(OSAL_PATH)/src/linux/kernel_space/build/linux_2.6/kernel_space/libosal.a $(ICP_BUILD_OUTPUT)/libosal_kernel.a; | ||
27 | cp $(OSAL_PATH)/src/linux/kernel_space/build/linux_2.6/kernel_space/libosal.a $(LAC_LIB_DIR)/; | ||
28 | + cp $(OSAL_PATH)/src/linux/kernel_space/build/linux_2.6/kernel_space/*.o $(LAC_LIB_DIR)/; | ||
29 | |||
30 | |||
31 | #build linux qat_direct layer | ||
32 | @@ -169,6 +170,7 @@ qat_kernel: clean output_dir lac_lib_dir libosal_kernel cmn_ko | ||
33 | echo ; echo 'Copying qat_kernel library'; | ||
34 | cp $(KERNEL_PATH)/src/build/linux_2.6/kernel_space/libadf_kernel.a $(ICP_BUILD_OUTPUT)/; | ||
35 | cp $(KERNEL_PATH)/src/build/linux_2.6/kernel_space/libadf_kernel.a $(LAC_LIB_DIR)/; | ||
36 | + cp $(KERNEL_PATH)/src/build/linux_2.6/kernel_space/*.o $(LAC_LIB_DIR)/; | ||
37 | |||
38 | |||
39 | lac_user: clean output_dir qat_direct libosal_user cmn_user cmn_ko | ||
40 | diff --git a/quickassist/lookaside/access_layer/src/Makefile b/quickassist/lookaside/access_layer/src/Makefile | ||
41 | index cc8cf2f..b8ec93c 100644 | ||
42 | --- a/quickassist/lookaside/access_layer/src/Makefile | ||
43 | +++ b/quickassist/lookaside/access_layer/src/Makefile | ||
44 | @@ -112,13 +112,13 @@ LIB_STATIC=$(OUTPUT_NAME).a | ||
45 | LIB_SHARED=$(OUTPUT_NAME).so | ||
46 | |||
47 | # add the path and list of source libraries, | ||
48 | -ADDITIONAL_KERNEL_LIBS= common/utils/$(ICP_BUILD_OUTPUT_DIR)/utils.a \ | ||
49 | - common/ctrl/$(ICP_BUILD_OUTPUT_DIR)/init.a \ | ||
50 | - common/compression/$(ICP_BUILD_OUTPUT_DIR)/compression.a | ||
51 | +ADDITIONAL_KERNEL_LIBS= common/utils/$(ICP_BUILD_OUTPUT_DIR)/*.o \ | ||
52 | + common/ctrl/$(ICP_BUILD_OUTPUT_DIR)/*.o \ | ||
53 | + common/compression/$(ICP_BUILD_OUTPUT_DIR)/*.o | ||
54 | ifndef ICP_DC_ONLY | ||
55 | -ADDITIONAL_KERNEL_LIBS += common/crypto/sym/$(ICP_BUILD_OUTPUT_DIR)/sym.a \ | ||
56 | - common/crypto/sym/qat/$(ICP_BUILD_OUTPUT_DIR)/sym_qat.a \ | ||
57 | - common/crypto/sym/key/$(ICP_BUILD_OUTPUT_DIR)/sym_key.a | ||
58 | +ADDITIONAL_KERNEL_LIBS += common/crypto/sym/$(ICP_BUILD_OUTPUT_DIR)/*.o \ | ||
59 | + common/crypto/sym/qat/$(ICP_BUILD_OUTPUT_DIR)/*.o \ | ||
60 | + common/crypto/sym/key/$(ICP_BUILD_OUTPUT_DIR)/*.o | ||
61 | ifeq ($(ICP_OS_LEVEL), user_space) | ||
62 | ADDITIONAL_KERNEL_LIBS += common/crypto/asym/pke_common/$(ICP_BUILD_OUTPUT_DIR)/pke_common.a \ | ||
63 | common/crypto/asym/diffie_hellman/$(ICP_BUILD_OUTPUT_DIR)/diffie_hellman.a \ | ||
64 | @@ -128,14 +128,14 @@ ADDITIONAL_KERNEL_LIBS += common/crypto/asym/pke_common/$(ICP_BUILD_OUTPUT_DIR)/ | ||
65 | common/crypto/asym/large_number/$(ICP_BUILD_OUTPUT_DIR)/ln.a \ | ||
66 | common/crypto/asym/ecc/$(ICP_BUILD_OUTPUT_DIR)/elliptic_curve.a | ||
67 | else | ||
68 | -ADDITIONAL_KERNEL_LIBS += common/stubs/$(ICP_BUILD_OUTPUT_DIR)/lib_lac_stubs.a | ||
69 | +ADDITIONAL_KERNEL_LIBS += common/stubs/$(ICP_BUILD_OUTPUT_DIR)/*.o | ||
70 | endif | ||
71 | else | ||
72 | ifeq ($(ICP_OS_LEVEL), kernel_space) | ||
73 | -ADDITIONAL_KERNEL_LIBS += common/stubs/$(ICP_BUILD_OUTPUT_DIR)/lib_lac_stubs.a | ||
74 | +ADDITIONAL_KERNEL_LIBS += common/stubs/$(ICP_BUILD_OUTPUT_DIR)/*.o | ||
75 | endif | ||
76 | endif | ||
77 | -ADDITIONAL_KERNEL_LIBS += common/qat_comms/$(ICP_BUILD_OUTPUT_DIR)/qat_comms.a | ||
78 | +ADDITIONAL_KERNEL_LIBS += common/qat_comms/$(ICP_BUILD_OUTPUT_DIR)/*.o | ||
79 | |||
80 | ifeq ($(ICP_OS_LEVEL), user_space) | ||
81 | ifdef KPT | ||
82 | @@ -145,8 +145,7 @@ endif | ||
83 | endif | ||
84 | |||
85 | ifeq ($(ICP_OS_LEVEL), kernel_space) | ||
86 | - ADDITIONAL_OBJECTS = ../build/libs/libadf_kernel.a | ||
87 | - ADDITIONAL_OBJECTS += ../build/libs/libosal.a | ||
88 | + ADDITIONAL_OBJECTS += ../build/libs/*.o | ||
89 | endif | ||
90 | |||
91 | ifeq ($(ICP_OS_LEVEL), user_space) | ||
diff --git a/recipes-extended/qat/files/qat17_4.7.0-00006-Switch-to-skcipher-API.patch b/recipes-extended/qat/files/qat17_4.7.0-00006-Switch-to-skcipher-API.patch new file mode 100644 index 0000000..96e949c --- /dev/null +++ b/recipes-extended/qat/files/qat17_4.7.0-00006-Switch-to-skcipher-API.patch | |||
@@ -0,0 +1,1161 @@ | |||
1 | From b19449e3c11ffd477a3db60f21e14930ed07f251 Mon Sep 17 00:00:00 2001 | ||
2 | From: Yongxin Liu <yongxin.liu@windriver.com> | ||
3 | Date: Wed, 15 Jan 2020 13:50:38 +0000 | ||
4 | Subject: [PATCH] qat: Switch to skcipher API | ||
5 | |||
6 | The patch is derived from mainline kernel commit 7fe948a52287 | ||
7 | ("crypto: qat - switch to skcipher API"). | ||
8 | |||
9 | Upstream-Status: Inappropriate [Code released in tarball form only] | ||
10 | |||
11 | Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com> | ||
12 | --- | ||
13 | .../drivers/crypto/qat/qat_common/qat_algs.c | 676 ++++++++++-------- | ||
14 | .../crypto/qat/qat_common/qat_crypto.h | 6 +- | ||
15 | 2 files changed, 394 insertions(+), 288 deletions(-) | ||
16 | |||
17 | diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c b/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c | ||
18 | index c4edb3c..35bca76 100644 | ||
19 | --- a/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c | ||
20 | +++ b/quickassist/qat/drivers/crypto/qat/qat_common/qat_algs.c | ||
21 | @@ -44,14 +44,15 @@ | ||
22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | */ | ||
25 | -#ifndef QAT_AEAD_OLD_SUPPORTED | ||
26 | #include <linux/module.h> | ||
27 | #include <linux/slab.h> | ||
28 | #include <linux/crypto.h> | ||
29 | #include <crypto/internal/aead.h> | ||
30 | +#include <crypto/internal/skcipher.h> | ||
31 | #include <crypto/aes.h> | ||
32 | #include <crypto/sha.h> | ||
33 | #include <crypto/hash.h> | ||
34 | +#include <crypto/hmac.h> | ||
35 | #include <crypto/algapi.h> | ||
36 | #include <crypto/authenc.h> | ||
37 | #include <linux/dma-mapping.h> | ||
38 | @@ -113,11 +114,16 @@ struct qat_alg_aead_ctx { | ||
39 | struct crypto_shash *hash_tfm; | ||
40 | enum icp_qat_hw_auth_algo qat_hash_alg; | ||
41 | struct qat_crypto_instance *inst; | ||
42 | - char ipad[SHA512_BLOCK_SIZE]; | ||
43 | + union { | ||
44 | + struct sha1_state sha1; | ||
45 | + struct sha256_state sha256; | ||
46 | + struct sha512_state sha512; | ||
47 | + }; | ||
48 | + char ipad[SHA512_BLOCK_SIZE]; /* sufficient for SHA-1/SHA-256 as well */ | ||
49 | char opad[SHA512_BLOCK_SIZE]; | ||
50 | }; | ||
51 | |||
52 | -struct qat_alg_ablkcipher_ctx { | ||
53 | +struct qat_alg_skcipher_ctx { | ||
54 | struct icp_qat_hw_cipher_algo_blk *enc_cd; | ||
55 | struct icp_qat_hw_cipher_algo_blk *dec_cd; | ||
56 | dma_addr_t enc_cd_paddr; | ||
57 | @@ -125,7 +131,7 @@ struct qat_alg_ablkcipher_ctx { | ||
58 | struct icp_qat_fw_la_bulk_req enc_fw_req; | ||
59 | struct icp_qat_fw_la_bulk_req dec_fw_req; | ||
60 | struct qat_crypto_instance *inst; | ||
61 | - struct crypto_tfm *tfm; | ||
62 | + struct crypto_skcipher *tfm; | ||
63 | }; | ||
64 | |||
65 | static int qat_get_inter_state_size(enum icp_qat_hw_auth_algo qat_hash_alg) | ||
66 | @@ -149,9 +155,6 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, | ||
67 | unsigned int auth_keylen) | ||
68 | { | ||
69 | SHASH_DESC_ON_STACK(shash, ctx->hash_tfm); | ||
70 | - struct sha1_state sha1; | ||
71 | - struct sha256_state sha256; | ||
72 | - struct sha512_state sha512; | ||
73 | int block_size = crypto_shash_blocksize(ctx->hash_tfm); | ||
74 | int digest_size = crypto_shash_digestsize(ctx->hash_tfm); | ||
75 | __be32 *hash_state_out; | ||
76 | @@ -160,7 +163,6 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, | ||
77 | |||
78 | memset(ctx->ipad, 0, block_size); | ||
79 | memset(ctx->opad, 0, block_size); | ||
80 | - memset(shash, 0, sizeof(struct shash_desc)); | ||
81 | shash->tfm = ctx->hash_tfm; | ||
82 | |||
83 | if (auth_keylen > block_size) { | ||
84 | @@ -178,8 +180,8 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, | ||
85 | for (i = 0; i < block_size; i++) { | ||
86 | char *ipad_ptr = ctx->ipad + i; | ||
87 | char *opad_ptr = ctx->opad + i; | ||
88 | - *ipad_ptr ^= 0x36; | ||
89 | - *opad_ptr ^= 0x5C; | ||
90 | + *ipad_ptr ^= HMAC_IPAD_VALUE; | ||
91 | + *opad_ptr ^= HMAC_OPAD_VALUE; | ||
92 | } | ||
93 | |||
94 | if (crypto_shash_init(shash)) | ||
95 | @@ -193,22 +195,22 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, | ||
96 | |||
97 | switch (ctx->qat_hash_alg) { | ||
98 | case ICP_QAT_HW_AUTH_ALGO_SHA1: | ||
99 | - if (crypto_shash_export(shash, &sha1)) | ||
100 | + if (crypto_shash_export(shash, &ctx->sha1)) | ||
101 | return -EFAULT; | ||
102 | for (i = 0; i < digest_size >> 2; i++, hash_state_out++) | ||
103 | - *hash_state_out = cpu_to_be32(*(sha1.state + i)); | ||
104 | + *hash_state_out = cpu_to_be32(ctx->sha1.state[i]); | ||
105 | break; | ||
106 | case ICP_QAT_HW_AUTH_ALGO_SHA256: | ||
107 | - if (crypto_shash_export(shash, &sha256)) | ||
108 | + if (crypto_shash_export(shash, &ctx->sha256)) | ||
109 | return -EFAULT; | ||
110 | for (i = 0; i < digest_size >> 2; i++, hash_state_out++) | ||
111 | - *hash_state_out = cpu_to_be32(*(sha256.state + i)); | ||
112 | + *hash_state_out = cpu_to_be32(ctx->sha256.state[i]); | ||
113 | break; | ||
114 | case ICP_QAT_HW_AUTH_ALGO_SHA512: | ||
115 | - if (crypto_shash_export(shash, &sha512)) | ||
116 | + if (crypto_shash_export(shash, &ctx->sha512)) | ||
117 | return -EFAULT; | ||
118 | for (i = 0; i < digest_size >> 3; i++, hash512_state_out++) | ||
119 | - *hash512_state_out = cpu_to_be64(*(sha512.state + i)); | ||
120 | + *hash512_state_out = cpu_to_be64(ctx->sha512.state[i]); | ||
121 | break; | ||
122 | default: | ||
123 | return -EFAULT; | ||
124 | @@ -229,22 +231,22 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, | ||
125 | |||
126 | switch (ctx->qat_hash_alg) { | ||
127 | case ICP_QAT_HW_AUTH_ALGO_SHA1: | ||
128 | - if (crypto_shash_export(shash, &sha1)) | ||
129 | + if (crypto_shash_export(shash, &ctx->sha1)) | ||
130 | return -EFAULT; | ||
131 | for (i = 0; i < digest_size >> 2; i++, hash_state_out++) | ||
132 | - *hash_state_out = cpu_to_be32(*(sha1.state + i)); | ||
133 | + *hash_state_out = cpu_to_be32(ctx->sha1.state[i]); | ||
134 | break; | ||
135 | case ICP_QAT_HW_AUTH_ALGO_SHA256: | ||
136 | - if (crypto_shash_export(shash, &sha256)) | ||
137 | + if (crypto_shash_export(shash, &ctx->sha256)) | ||
138 | return -EFAULT; | ||
139 | for (i = 0; i < digest_size >> 2; i++, hash_state_out++) | ||
140 | - *hash_state_out = cpu_to_be32(*(sha256.state + i)); | ||
141 | + *hash_state_out = cpu_to_be32(ctx->sha256.state[i]); | ||
142 | break; | ||
143 | case ICP_QAT_HW_AUTH_ALGO_SHA512: | ||
144 | - if (crypto_shash_export(shash, &sha512)) | ||
145 | + if (crypto_shash_export(shash, &ctx->sha512)) | ||
146 | return -EFAULT; | ||
147 | for (i = 0; i < digest_size >> 3; i++, hash512_state_out++) | ||
148 | - *hash512_state_out = cpu_to_be64(*(sha512.state + i)); | ||
149 | + *hash512_state_out = cpu_to_be64(ctx->sha512.state[i]); | ||
150 | break; | ||
151 | default: | ||
152 | return -EFAULT; | ||
153 | @@ -254,7 +256,24 @@ static int qat_alg_do_precomputes(struct icp_qat_hw_auth_algo_blk *hash, | ||
154 | return 0; | ||
155 | } | ||
156 | |||
157 | -static void qat_alg_init_common_hdr(struct icp_qat_fw_comn_req_hdr *header) | ||
158 | +static void qat_alg_init_hdr_iv_updt(struct icp_qat_fw_comn_req_hdr *header) | ||
159 | +{ | ||
160 | + ICP_QAT_FW_LA_CIPH_IV_FLD_FLAG_SET(header->serv_specif_flags, | ||
161 | + ICP_QAT_FW_CIPH_IV_64BIT_PTR); | ||
162 | + ICP_QAT_FW_LA_UPDATE_STATE_SET(header->serv_specif_flags, | ||
163 | + ICP_QAT_FW_LA_UPDATE_STATE); | ||
164 | +} | ||
165 | + | ||
166 | +static void qat_alg_init_hdr_no_iv_updt(struct icp_qat_fw_comn_req_hdr *header) | ||
167 | +{ | ||
168 | + ICP_QAT_FW_LA_CIPH_IV_FLD_FLAG_SET(header->serv_specif_flags, | ||
169 | + ICP_QAT_FW_CIPH_IV_16BYTE_DATA); | ||
170 | + ICP_QAT_FW_LA_UPDATE_STATE_SET(header->serv_specif_flags, | ||
171 | + ICP_QAT_FW_LA_NO_UPDATE_STATE); | ||
172 | +} | ||
173 | + | ||
174 | +static void qat_alg_init_common_hdr(struct icp_qat_fw_comn_req_hdr *header, | ||
175 | + int aead) | ||
176 | { | ||
177 | header->hdr_flags = | ||
178 | ICP_QAT_FW_COMN_HDR_FLAGS_BUILD(ICP_QAT_FW_COMN_REQ_FLAG_SET); | ||
179 | @@ -264,12 +283,12 @@ static void qat_alg_init_common_hdr(struct icp_qat_fw_comn_req_hdr *header) | ||
180 | QAT_COMN_PTR_TYPE_SGL); | ||
181 | ICP_QAT_FW_LA_PARTIAL_SET(header->serv_specif_flags, | ||
182 | ICP_QAT_FW_LA_PARTIAL_NONE); | ||
183 | - ICP_QAT_FW_LA_CIPH_IV_FLD_FLAG_SET(header->serv_specif_flags, | ||
184 | - ICP_QAT_FW_CIPH_IV_16BYTE_DATA); | ||
185 | + if (aead) | ||
186 | + qat_alg_init_hdr_no_iv_updt(header); | ||
187 | + else | ||
188 | + qat_alg_init_hdr_iv_updt(header); | ||
189 | ICP_QAT_FW_LA_PROTO_SET(header->serv_specif_flags, | ||
190 | ICP_QAT_FW_LA_NO_PROTO); | ||
191 | - ICP_QAT_FW_LA_UPDATE_STATE_SET(header->serv_specif_flags, | ||
192 | - ICP_QAT_FW_LA_NO_UPDATE_STATE); | ||
193 | } | ||
194 | |||
195 | static int qat_alg_aead_init_enc_session(struct crypto_aead *aead_tfm, | ||
196 | @@ -304,7 +323,7 @@ static int qat_alg_aead_init_enc_session(struct crypto_aead *aead_tfm, | ||
197 | return -EFAULT; | ||
198 | |||
199 | /* Request setup */ | ||
200 | - qat_alg_init_common_hdr(header); | ||
201 | + qat_alg_init_common_hdr(header, 1); | ||
202 | header->service_cmd_id = ICP_QAT_FW_LA_CMD_CIPHER_HASH; | ||
203 | ICP_QAT_FW_LA_DIGEST_IN_BUFFER_SET(header->serv_specif_flags, | ||
204 | ICP_QAT_FW_LA_DIGEST_IN_BUFFER); | ||
205 | @@ -391,7 +410,7 @@ static int qat_alg_aead_init_dec_session(struct crypto_aead *aead_tfm, | ||
206 | return -EFAULT; | ||
207 | |||
208 | /* Request setup */ | ||
209 | - qat_alg_init_common_hdr(header); | ||
210 | + qat_alg_init_common_hdr(header, 1); | ||
211 | header->service_cmd_id = ICP_QAT_FW_LA_CMD_HASH_CIPHER; | ||
212 | ICP_QAT_FW_LA_DIGEST_IN_BUFFER_SET(header->serv_specif_flags, | ||
213 | ICP_QAT_FW_LA_DIGEST_IN_BUFFER); | ||
214 | @@ -445,17 +464,17 @@ static int qat_alg_aead_init_dec_session(struct crypto_aead *aead_tfm, | ||
215 | return 0; | ||
216 | } | ||
217 | |||
218 | -static void qat_alg_ablkcipher_init_com(struct qat_alg_ablkcipher_ctx *ctx, | ||
219 | - struct icp_qat_fw_la_bulk_req *req, | ||
220 | - struct icp_qat_hw_cipher_algo_blk *cd, | ||
221 | - const uint8_t *key, unsigned int keylen) | ||
222 | +static void qat_alg_skcipher_init_com(struct qat_alg_skcipher_ctx *ctx, | ||
223 | + struct icp_qat_fw_la_bulk_req *req, | ||
224 | + struct icp_qat_hw_cipher_algo_blk *cd, | ||
225 | + const uint8_t *key, unsigned int keylen) | ||
226 | { | ||
227 | struct icp_qat_fw_comn_req_hdr_cd_pars *cd_pars = &req->cd_pars; | ||
228 | struct icp_qat_fw_comn_req_hdr *header = &req->comn_hdr; | ||
229 | struct icp_qat_fw_cipher_cd_ctrl_hdr *cd_ctrl = (void *)&req->cd_ctrl; | ||
230 | |||
231 | memcpy(cd->aes.key, key, keylen); | ||
232 | - qat_alg_init_common_hdr(header); | ||
233 | + qat_alg_init_common_hdr(header, 0); | ||
234 | header->service_cmd_id = ICP_QAT_FW_LA_CMD_CIPHER; | ||
235 | cd_pars->u.s.content_desc_params_sz = | ||
236 | sizeof(struct icp_qat_hw_cipher_algo_blk) >> 3; | ||
237 | @@ -467,28 +486,28 @@ static void qat_alg_ablkcipher_init_com(struct qat_alg_ablkcipher_ctx *ctx, | ||
238 | ICP_QAT_FW_COMN_NEXT_ID_SET(cd_ctrl, ICP_QAT_FW_SLICE_DRAM_WR); | ||
239 | } | ||
240 | |||
241 | -static void qat_alg_ablkcipher_init_enc(struct qat_alg_ablkcipher_ctx *ctx, | ||
242 | - int alg, const uint8_t *key, | ||
243 | - unsigned int keylen, int mode) | ||
244 | +static void qat_alg_skcipher_init_enc(struct qat_alg_skcipher_ctx *ctx, | ||
245 | + int alg, const uint8_t *key, | ||
246 | + unsigned int keylen, int mode) | ||
247 | { | ||
248 | struct icp_qat_hw_cipher_algo_blk *enc_cd = ctx->enc_cd; | ||
249 | struct icp_qat_fw_la_bulk_req *req = &ctx->enc_fw_req; | ||
250 | struct icp_qat_fw_comn_req_hdr_cd_pars *cd_pars = &req->cd_pars; | ||
251 | |||
252 | - qat_alg_ablkcipher_init_com(ctx, req, enc_cd, key, keylen); | ||
253 | + qat_alg_skcipher_init_com(ctx, req, enc_cd, key, keylen); | ||
254 | cd_pars->u.s.content_desc_addr = ctx->enc_cd_paddr; | ||
255 | enc_cd->aes.cipher_config.val = QAT_AES_HW_CONFIG_ENC(alg, mode); | ||
256 | } | ||
257 | |||
258 | -static void qat_alg_ablkcipher_init_dec(struct qat_alg_ablkcipher_ctx *ctx, | ||
259 | - int alg, const uint8_t *key, | ||
260 | - unsigned int keylen, int mode) | ||
261 | +static void qat_alg_skcipher_init_dec(struct qat_alg_skcipher_ctx *ctx, | ||
262 | + int alg, const uint8_t *key, | ||
263 | + unsigned int keylen, int mode) | ||
264 | { | ||
265 | struct icp_qat_hw_cipher_algo_blk *dec_cd = ctx->dec_cd; | ||
266 | struct icp_qat_fw_la_bulk_req *req = &ctx->dec_fw_req; | ||
267 | struct icp_qat_fw_comn_req_hdr_cd_pars *cd_pars = &req->cd_pars; | ||
268 | |||
269 | - qat_alg_ablkcipher_init_com(ctx, req, dec_cd, key, keylen); | ||
270 | + qat_alg_skcipher_init_com(ctx, req, dec_cd, key, keylen); | ||
271 | cd_pars->u.s.content_desc_addr = ctx->dec_cd_paddr; | ||
272 | |||
273 | if (mode != ICP_QAT_HW_CIPHER_CTR_MODE) | ||
274 | @@ -548,86 +567,110 @@ static int qat_alg_aead_init_sessions(struct crypto_aead *tfm, const u8 *key, | ||
275 | if (qat_alg_aead_init_dec_session(tfm, alg, &keys, mode)) | ||
276 | goto error; | ||
277 | |||
278 | + memzero_explicit(&keys, sizeof(keys)); | ||
279 | return 0; | ||
280 | bad_key: | ||
281 | crypto_aead_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); | ||
282 | + memzero_explicit(&keys, sizeof(keys)); | ||
283 | return -EINVAL; | ||
284 | error: | ||
285 | + memzero_explicit(&keys, sizeof(keys)); | ||
286 | return -EFAULT; | ||
287 | } | ||
288 | |||
289 | -static int qat_alg_ablkcipher_init_sessions(struct qat_alg_ablkcipher_ctx *ctx, | ||
290 | - const uint8_t *key, | ||
291 | - unsigned int keylen, | ||
292 | - int mode) | ||
293 | +static int qat_alg_skcipher_init_sessions(struct qat_alg_skcipher_ctx *ctx, | ||
294 | + const uint8_t *key, | ||
295 | + unsigned int keylen, | ||
296 | + int mode) | ||
297 | { | ||
298 | int alg; | ||
299 | |||
300 | if (qat_alg_validate_key(keylen, &alg, mode)) | ||
301 | goto bad_key; | ||
302 | |||
303 | - qat_alg_ablkcipher_init_enc(ctx, alg, key, keylen, mode); | ||
304 | - qat_alg_ablkcipher_init_dec(ctx, alg, key, keylen, mode); | ||
305 | + qat_alg_skcipher_init_enc(ctx, alg, key, keylen, mode); | ||
306 | + qat_alg_skcipher_init_dec(ctx, alg, key, keylen, mode); | ||
307 | return 0; | ||
308 | bad_key: | ||
309 | - crypto_tfm_set_flags(ctx->tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); | ||
310 | + crypto_skcipher_set_flags(ctx->tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); | ||
311 | return -EINVAL; | ||
312 | } | ||
313 | |||
314 | -static int qat_alg_aead_setkey(struct crypto_aead *tfm, const uint8_t *key, | ||
315 | +static int qat_alg_aead_rekey(struct crypto_aead *tfm, const uint8_t *key, | ||
316 | + unsigned int keylen) | ||
317 | +{ | ||
318 | + struct qat_alg_aead_ctx *ctx = crypto_aead_ctx(tfm); | ||
319 | + | ||
320 | + memset(ctx->enc_cd, 0, sizeof(*ctx->enc_cd)); | ||
321 | + memset(ctx->dec_cd, 0, sizeof(*ctx->dec_cd)); | ||
322 | + memset(&ctx->enc_fw_req, 0, sizeof(ctx->enc_fw_req)); | ||
323 | + memset(&ctx->dec_fw_req, 0, sizeof(ctx->dec_fw_req)); | ||
324 | + | ||
325 | + return qat_alg_aead_init_sessions(tfm, key, keylen, | ||
326 | + ICP_QAT_HW_CIPHER_CBC_MODE); | ||
327 | +} | ||
328 | + | ||
329 | +static int qat_alg_aead_newkey(struct crypto_aead *tfm, const uint8_t *key, | ||
330 | unsigned int keylen) | ||
331 | { | ||
332 | struct qat_alg_aead_ctx *ctx = crypto_aead_ctx(tfm); | ||
333 | + struct qat_crypto_instance *inst = NULL; | ||
334 | + int node = get_current_node(); | ||
335 | struct device *dev; | ||
336 | + int ret; | ||
337 | |||
338 | - if (ctx->enc_cd) { | ||
339 | - /* rekeying */ | ||
340 | - dev = &GET_DEV(ctx->inst->accel_dev); | ||
341 | - memset(ctx->enc_cd, 0, sizeof(*ctx->enc_cd)); | ||
342 | - memset(ctx->dec_cd, 0, sizeof(*ctx->dec_cd)); | ||
343 | - memset(&ctx->enc_fw_req, 0, sizeof(ctx->enc_fw_req)); | ||
344 | - memset(&ctx->dec_fw_req, 0, sizeof(ctx->dec_fw_req)); | ||
345 | - } else { | ||
346 | - /* new key */ | ||
347 | - int node = get_current_node(); | ||
348 | - struct qat_crypto_instance *inst = | ||
349 | - qat_crypto_get_instance_node(node); | ||
350 | - if (!inst) { | ||
351 | - return -EINVAL; | ||
352 | - } | ||
353 | - | ||
354 | - dev = &GET_DEV(inst->accel_dev); | ||
355 | - ctx->inst = inst; | ||
356 | - ctx->enc_cd = dma_alloc_coherent(dev, sizeof(*ctx->enc_cd), | ||
357 | - &ctx->enc_cd_paddr, | ||
358 | - GFP_ATOMIC); | ||
359 | - if (!ctx->enc_cd) { | ||
360 | - return -ENOMEM; | ||
361 | - } | ||
362 | - ctx->dec_cd = dma_alloc_coherent(dev, sizeof(*ctx->dec_cd), | ||
363 | - &ctx->dec_cd_paddr, | ||
364 | - GFP_ATOMIC); | ||
365 | - if (!ctx->dec_cd) { | ||
366 | - goto out_free_enc; | ||
367 | - } | ||
368 | + inst = qat_crypto_get_instance_node(node); | ||
369 | + if (!inst) | ||
370 | + return -EINVAL; | ||
371 | + dev = &GET_DEV(inst->accel_dev); | ||
372 | + ctx->inst = inst; | ||
373 | + ctx->enc_cd = dma_alloc_coherent(dev, sizeof(*ctx->enc_cd), | ||
374 | + &ctx->enc_cd_paddr, | ||
375 | + GFP_ATOMIC); | ||
376 | + if (!ctx->enc_cd) { | ||
377 | + ret = -ENOMEM; | ||
378 | + goto out_free_inst; | ||
379 | } | ||
380 | - if (qat_alg_aead_init_sessions(tfm, key, keylen, | ||
381 | - ICP_QAT_HW_CIPHER_CBC_MODE)) | ||
382 | + ctx->dec_cd = dma_alloc_coherent(dev, sizeof(*ctx->dec_cd), | ||
383 | + &ctx->dec_cd_paddr, | ||
384 | + GFP_ATOMIC); | ||
385 | + if (!ctx->dec_cd) { | ||
386 | + ret = -ENOMEM; | ||
387 | + goto out_free_enc; | ||
388 | + } | ||
389 | + | ||
390 | + ret = qat_alg_aead_init_sessions(tfm, key, keylen, | ||
391 | + ICP_QAT_HW_CIPHER_CBC_MODE); | ||
392 | + if (ret) | ||
393 | goto out_free_all; | ||
394 | |||
395 | return 0; | ||
396 | |||
397 | out_free_all: | ||
398 | - memzero_explicit(ctx->dec_cd, sizeof(struct qat_alg_cd)); | ||
399 | + memset(ctx->dec_cd, 0, sizeof(struct qat_alg_cd)); | ||
400 | dma_free_coherent(dev, sizeof(struct qat_alg_cd), | ||
401 | ctx->dec_cd, ctx->dec_cd_paddr); | ||
402 | ctx->dec_cd = NULL; | ||
403 | out_free_enc: | ||
404 | - memzero_explicit(ctx->enc_cd, sizeof(struct qat_alg_cd)); | ||
405 | + memset(ctx->enc_cd, 0, sizeof(struct qat_alg_cd)); | ||
406 | dma_free_coherent(dev, sizeof(struct qat_alg_cd), | ||
407 | ctx->enc_cd, ctx->enc_cd_paddr); | ||
408 | ctx->enc_cd = NULL; | ||
409 | - return -ENOMEM; | ||
410 | +out_free_inst: | ||
411 | + ctx->inst = NULL; | ||
412 | + qat_crypto_put_instance(inst); | ||
413 | + return ret; | ||
414 | +} | ||
415 | + | ||
416 | +static int qat_alg_aead_setkey(struct crypto_aead *tfm, const uint8_t *key, | ||
417 | + unsigned int keylen) | ||
418 | +{ | ||
419 | + struct qat_alg_aead_ctx *ctx = crypto_aead_ctx(tfm); | ||
420 | + | ||
421 | + if (ctx->enc_cd) | ||
422 | + return qat_alg_aead_rekey(tfm, key, keylen); | ||
423 | + else | ||
424 | + return qat_alg_aead_newkey(tfm, key, keylen); | ||
425 | } | ||
426 | |||
427 | static void qat_alg_free_bufl(struct qat_crypto_instance *inst, | ||
428 | @@ -675,8 +718,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | ||
429 | dma_addr_t blp; | ||
430 | dma_addr_t bloutp = 0; | ||
431 | struct scatterlist *sg; | ||
432 | - size_t sz_out, sz = sizeof(struct qat_alg_buf_list) + | ||
433 | - ((1 + n) * sizeof(struct qat_alg_buf)); | ||
434 | + size_t sz_out, sz = struct_size(bufl, bufers, n + 1); | ||
435 | |||
436 | if (unlikely(!n)) | ||
437 | return -EINVAL; | ||
438 | @@ -688,7 +730,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | ||
439 | |||
440 | blp = dma_map_single(dev, bufl, sz, DMA_TO_DEVICE); | ||
441 | if (unlikely(dma_mapping_error(dev, blp))) | ||
442 | - goto err; | ||
443 | + goto err_in; | ||
444 | |||
445 | for_each_sg(sgl, sg, n, i) { | ||
446 | int y = sg_nctr; | ||
447 | @@ -701,7 +743,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | ||
448 | DMA_BIDIRECTIONAL); | ||
449 | bufl->bufers[y].len = sg->length; | ||
450 | if (unlikely(dma_mapping_error(dev, bufl->bufers[y].addr))) | ||
451 | - goto err; | ||
452 | + goto err_in; | ||
453 | sg_nctr++; | ||
454 | } | ||
455 | bufl->num_bufs = sg_nctr; | ||
456 | @@ -713,16 +755,15 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | ||
457 | struct qat_alg_buf *bufers; | ||
458 | |||
459 | n = sg_nents(sglout); | ||
460 | - sz_out = sizeof(struct qat_alg_buf_list) + | ||
461 | - ((1 + n) * sizeof(struct qat_alg_buf)); | ||
462 | + sz_out = struct_size(buflout, bufers, n + 1); | ||
463 | sg_nctr = 0; | ||
464 | buflout = kzalloc_node(sz_out, GFP_ATOMIC, | ||
465 | dev_to_node(&GET_DEV(inst->accel_dev))); | ||
466 | if (unlikely(!buflout)) | ||
467 | - goto err; | ||
468 | + goto err_in; | ||
469 | bloutp = dma_map_single(dev, buflout, sz_out, DMA_TO_DEVICE); | ||
470 | if (unlikely(dma_mapping_error(dev, bloutp))) | ||
471 | - goto err; | ||
472 | + goto err_out; | ||
473 | bufers = buflout->bufers; | ||
474 | for_each_sg(sglout, sg, n, i) { | ||
475 | int y = sg_nctr; | ||
476 | @@ -734,7 +775,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | ||
477 | sg->length, | ||
478 | DMA_BIDIRECTIONAL); | ||
479 | if (unlikely(dma_mapping_error(dev, bufers[y].addr))) | ||
480 | - goto err; | ||
481 | + goto err_out; | ||
482 | bufers[y].len = sg->length; | ||
483 | sg_nctr++; | ||
484 | } | ||
485 | @@ -749,8 +790,20 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | ||
486 | qat_req->buf.sz_out = 0; | ||
487 | } | ||
488 | return 0; | ||
489 | -err: | ||
490 | - dev_err(dev, "Failed to map buf for dma\n"); | ||
491 | + | ||
492 | +err_out: | ||
493 | + n = sg_nents(sglout); | ||
494 | + for (i = 0; i < n; i++) | ||
495 | + if (!dma_mapping_error(dev, buflout->bufers[i].addr)) | ||
496 | + dma_unmap_single(dev, buflout->bufers[i].addr, | ||
497 | + buflout->bufers[i].len, | ||
498 | + DMA_BIDIRECTIONAL); | ||
499 | + if (!dma_mapping_error(dev, bloutp)) | ||
500 | + dma_unmap_single(dev, bloutp, sz_out, DMA_TO_DEVICE); | ||
501 | + kfree(buflout); | ||
502 | + | ||
503 | +err_in: | ||
504 | + n = sg_nents(sgl); | ||
505 | for (i = 0; i < n; i++) | ||
506 | if (!dma_mapping_error(dev, bufl->bufers[i].addr)) | ||
507 | dma_unmap_single(dev, bufl->bufers[i].addr, | ||
508 | @@ -760,17 +813,8 @@ err: | ||
509 | if (!dma_mapping_error(dev, blp)) | ||
510 | dma_unmap_single(dev, blp, sz, DMA_TO_DEVICE); | ||
511 | kfree(bufl); | ||
512 | - if (sgl != sglout && buflout) { | ||
513 | - n = sg_nents(sglout); | ||
514 | - for (i = 0; i < n; i++) | ||
515 | - if (!dma_mapping_error(dev, buflout->bufers[i].addr)) | ||
516 | - dma_unmap_single(dev, buflout->bufers[i].addr, | ||
517 | - buflout->bufers[i].len, | ||
518 | - DMA_BIDIRECTIONAL); | ||
519 | - if (!dma_mapping_error(dev, bloutp)) | ||
520 | - dma_unmap_single(dev, bloutp, sz_out, DMA_TO_DEVICE); | ||
521 | - kfree(buflout); | ||
522 | - } | ||
523 | + | ||
524 | + dev_err(dev, "Failed to map buf for dma\n"); | ||
525 | return -ENOMEM; | ||
526 | } | ||
527 | |||
528 | @@ -789,19 +833,25 @@ static void qat_aead_alg_callback(struct icp_qat_fw_la_resp *qat_resp, | ||
529 | areq->base.complete(&areq->base, res); | ||
530 | } | ||
531 | |||
532 | -static void qat_ablkcipher_alg_callback(struct icp_qat_fw_la_resp *qat_resp, | ||
533 | - struct qat_crypto_request *qat_req) | ||
534 | +static void qat_skcipher_alg_callback(struct icp_qat_fw_la_resp *qat_resp, | ||
535 | + struct qat_crypto_request *qat_req) | ||
536 | { | ||
537 | - struct qat_alg_ablkcipher_ctx *ctx = qat_req->ablkcipher_ctx; | ||
538 | + struct qat_alg_skcipher_ctx *ctx = qat_req->skcipher_ctx; | ||
539 | struct qat_crypto_instance *inst = ctx->inst; | ||
540 | - struct ablkcipher_request *areq = qat_req->ablkcipher_req; | ||
541 | + struct skcipher_request *sreq = qat_req->skcipher_req; | ||
542 | uint8_t stat_filed = qat_resp->comn_resp.comn_status; | ||
543 | + struct device *dev = &GET_DEV(ctx->inst->accel_dev); | ||
544 | int res = 0, qat_res = ICP_QAT_FW_COMN_RESP_CRYPTO_STAT_GET(stat_filed); | ||
545 | |||
546 | qat_alg_free_bufl(inst, qat_req); | ||
547 | if (unlikely(qat_res != ICP_QAT_FW_COMN_STATUS_FLAG_OK)) | ||
548 | res = -EINVAL; | ||
549 | - areq->base.complete(&areq->base, res); | ||
550 | + | ||
551 | + memcpy(sreq->iv, qat_req->iv, AES_BLOCK_SIZE); | ||
552 | + dma_free_coherent(dev, AES_BLOCK_SIZE, qat_req->iv, | ||
553 | + qat_req->iv_paddr); | ||
554 | + | ||
555 | + sreq->base.complete(&sreq->base, res); | ||
556 | } | ||
557 | |||
558 | void qat_alg_callback(void *resp) | ||
559 | @@ -823,7 +873,7 @@ static int qat_alg_aead_dec(struct aead_request *areq) | ||
560 | struct icp_qat_fw_la_auth_req_params *auth_param; | ||
561 | struct icp_qat_fw_la_bulk_req *msg; | ||
562 | int digst_size = crypto_aead_authsize(aead_tfm); | ||
563 | - int ret; | ||
564 | + int ret, ctr = 0; | ||
565 | |||
566 | ret = qat_alg_sgl_to_bufl(ctx->inst, areq->src, areq->dst, qat_req); | ||
567 | if (unlikely(ret)) | ||
568 | @@ -844,13 +894,14 @@ static int qat_alg_aead_dec(struct aead_request *areq) | ||
569 | auth_param = (void *)((uint8_t *)cipher_param + sizeof(*cipher_param)); | ||
570 | auth_param->auth_off = 0; | ||
571 | auth_param->auth_len = areq->assoclen + cipher_param->cipher_length; | ||
572 | - | ||
573 | do { | ||
574 | ret = adf_send_message(ctx->inst->sym_tx, (uint32_t *)msg); | ||
575 | - if (ret) | ||
576 | - cond_resched(); | ||
577 | - } while (ret == -EAGAIN); | ||
578 | + } while (ret == -EAGAIN && ctr++ < 10); | ||
579 | |||
580 | + if (ret == -EAGAIN) { | ||
581 | + qat_alg_free_bufl(ctx->inst, qat_req); | ||
582 | + return -EBUSY; | ||
583 | + } | ||
584 | return -EINPROGRESS; | ||
585 | } | ||
586 | |||
587 | @@ -864,7 +915,7 @@ static int qat_alg_aead_enc(struct aead_request *areq) | ||
588 | struct icp_qat_fw_la_auth_req_params *auth_param; | ||
589 | struct icp_qat_fw_la_bulk_req *msg; | ||
590 | uint8_t *iv = areq->iv; | ||
591 | - int ret; | ||
592 | + int ret, ctr = 0; | ||
593 | |||
594 | ret = qat_alg_sgl_to_bufl(ctx->inst, areq->src, areq->dst, qat_req); | ||
595 | if (unlikely(ret)) | ||
596 | @@ -890,159 +941,230 @@ static int qat_alg_aead_enc(struct aead_request *areq) | ||
597 | |||
598 | do { | ||
599 | ret = adf_send_message(ctx->inst->sym_tx, (uint32_t *)msg); | ||
600 | - if (ret) | ||
601 | - cond_resched(); | ||
602 | - } while (ret == -EAGAIN); | ||
603 | + } while (ret == -EAGAIN && ctr++ < 10); | ||
604 | |||
605 | + if (ret == -EAGAIN) { | ||
606 | + qat_alg_free_bufl(ctx->inst, qat_req); | ||
607 | + return -EBUSY; | ||
608 | + } | ||
609 | return -EINPROGRESS; | ||
610 | } | ||
611 | |||
612 | -static int qat_alg_ablkcipher_setkey(struct crypto_ablkcipher *tfm, | ||
613 | - const u8 *key, unsigned int keylen, | ||
614 | - int mode) | ||
615 | +static int qat_alg_skcipher_rekey(struct qat_alg_skcipher_ctx *ctx, | ||
616 | + const u8 *key, unsigned int keylen, | ||
617 | + int mode) | ||
618 | { | ||
619 | - struct qat_alg_ablkcipher_ctx *ctx = crypto_ablkcipher_ctx(tfm); | ||
620 | - struct device *dev; | ||
621 | + memset(ctx->enc_cd, 0, sizeof(*ctx->enc_cd)); | ||
622 | + memset(ctx->dec_cd, 0, sizeof(*ctx->dec_cd)); | ||
623 | + memset(&ctx->enc_fw_req, 0, sizeof(ctx->enc_fw_req)); | ||
624 | + memset(&ctx->dec_fw_req, 0, sizeof(ctx->dec_fw_req)); | ||
625 | |||
626 | - if (ctx->enc_cd) { | ||
627 | - /* rekeying */ | ||
628 | - dev = &GET_DEV(ctx->inst->accel_dev); | ||
629 | - memset(ctx->enc_cd, 0, sizeof(*ctx->enc_cd)); | ||
630 | - memset(ctx->dec_cd, 0, sizeof(*ctx->dec_cd)); | ||
631 | - memset(&ctx->enc_fw_req, 0, sizeof(ctx->enc_fw_req)); | ||
632 | - memset(&ctx->dec_fw_req, 0, sizeof(ctx->dec_fw_req)); | ||
633 | - } else { | ||
634 | - /* new key */ | ||
635 | - int node = get_current_node(); | ||
636 | - struct qat_crypto_instance *inst = | ||
637 | - qat_crypto_get_instance_node(node); | ||
638 | - if (!inst) | ||
639 | - return -EINVAL; | ||
640 | + return qat_alg_skcipher_init_sessions(ctx, key, keylen, mode); | ||
641 | +} | ||
642 | + | ||
643 | +static int qat_alg_skcipher_newkey(struct qat_alg_skcipher_ctx *ctx, | ||
644 | + const u8 *key, unsigned int keylen, | ||
645 | + int mode) | ||
646 | +{ | ||
647 | + struct qat_crypto_instance *inst = NULL; | ||
648 | + struct device *dev; | ||
649 | + int node = get_current_node(); | ||
650 | + int ret; | ||
651 | |||
652 | - dev = &GET_DEV(inst->accel_dev); | ||
653 | - ctx->inst = inst; | ||
654 | - ctx->enc_cd = dma_alloc_coherent(dev, sizeof(*ctx->enc_cd), | ||
655 | - &ctx->enc_cd_paddr, | ||
656 | - GFP_ATOMIC); | ||
657 | - if (!ctx->enc_cd) | ||
658 | - return -ENOMEM; | ||
659 | - ctx->dec_cd = dma_alloc_coherent(dev, sizeof(*ctx->dec_cd), | ||
660 | - &ctx->dec_cd_paddr, | ||
661 | - GFP_ATOMIC); | ||
662 | - if (!ctx->dec_cd) | ||
663 | - goto out_free_enc; | ||
664 | + inst = qat_crypto_get_instance_node(node); | ||
665 | + if (!inst) | ||
666 | + return -EINVAL; | ||
667 | + dev = &GET_DEV(inst->accel_dev); | ||
668 | + ctx->inst = inst; | ||
669 | + ctx->enc_cd = dma_alloc_coherent(dev, sizeof(*ctx->enc_cd), | ||
670 | + &ctx->enc_cd_paddr, | ||
671 | + GFP_ATOMIC); | ||
672 | + if (!ctx->enc_cd) { | ||
673 | + ret = -ENOMEM; | ||
674 | + goto out_free_instance; | ||
675 | + } | ||
676 | + ctx->dec_cd = dma_alloc_coherent(dev, sizeof(*ctx->dec_cd), | ||
677 | + &ctx->dec_cd_paddr, | ||
678 | + GFP_ATOMIC); | ||
679 | + if (!ctx->dec_cd) { | ||
680 | + ret = -ENOMEM; | ||
681 | + goto out_free_enc; | ||
682 | } | ||
683 | - if (qat_alg_ablkcipher_init_sessions(ctx, key, keylen, mode)) | ||
684 | + | ||
685 | + ret = qat_alg_skcipher_init_sessions(ctx, key, keylen, mode); | ||
686 | + if (ret) | ||
687 | goto out_free_all; | ||
688 | |||
689 | return 0; | ||
690 | |||
691 | out_free_all: | ||
692 | - memzero_explicit(ctx->dec_cd, sizeof(*ctx->dec_cd)); | ||
693 | + memset(ctx->dec_cd, 0, sizeof(*ctx->dec_cd)); | ||
694 | dma_free_coherent(dev, sizeof(*ctx->dec_cd), | ||
695 | ctx->dec_cd, ctx->dec_cd_paddr); | ||
696 | ctx->dec_cd = NULL; | ||
697 | out_free_enc: | ||
698 | - memzero_explicit(ctx->enc_cd, sizeof(*ctx->enc_cd)); | ||
699 | + memset(ctx->enc_cd, 0, sizeof(*ctx->enc_cd)); | ||
700 | dma_free_coherent(dev, sizeof(*ctx->enc_cd), | ||
701 | ctx->enc_cd, ctx->enc_cd_paddr); | ||
702 | ctx->enc_cd = NULL; | ||
703 | - return -ENOMEM; | ||
704 | +out_free_instance: | ||
705 | + ctx->inst = NULL; | ||
706 | + qat_crypto_put_instance(inst); | ||
707 | + return ret; | ||
708 | } | ||
709 | |||
710 | -static int qat_alg_ablkcipher_cbc_setkey(struct crypto_ablkcipher *tfm, | ||
711 | - const u8 *key, unsigned int keylen) | ||
712 | +static int qat_alg_skcipher_setkey(struct crypto_skcipher *tfm, | ||
713 | + const u8 *key, unsigned int keylen, | ||
714 | + int mode) | ||
715 | { | ||
716 | - return qat_alg_ablkcipher_setkey(tfm, key, keylen, | ||
717 | - ICP_QAT_HW_CIPHER_CBC_MODE); | ||
718 | + struct qat_alg_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm); | ||
719 | + | ||
720 | + if (ctx->enc_cd) | ||
721 | + return qat_alg_skcipher_rekey(ctx, key, keylen, mode); | ||
722 | + else | ||
723 | + return qat_alg_skcipher_newkey(ctx, key, keylen, mode); | ||
724 | +} | ||
725 | + | ||
726 | +static int qat_alg_skcipher_cbc_setkey(struct crypto_skcipher *tfm, | ||
727 | + const u8 *key, unsigned int keylen) | ||
728 | +{ | ||
729 | + return qat_alg_skcipher_setkey(tfm, key, keylen, | ||
730 | + ICP_QAT_HW_CIPHER_CBC_MODE); | ||
731 | } | ||
732 | |||
733 | -static int qat_alg_ablkcipher_ctr_setkey(struct crypto_ablkcipher *tfm, | ||
734 | - const u8 *key, unsigned int keylen) | ||
735 | +static int qat_alg_skcipher_ctr_setkey(struct crypto_skcipher *tfm, | ||
736 | + const u8 *key, unsigned int keylen) | ||
737 | { | ||
738 | - return qat_alg_ablkcipher_setkey(tfm, key, keylen, | ||
739 | - ICP_QAT_HW_CIPHER_CTR_MODE); | ||
740 | + return qat_alg_skcipher_setkey(tfm, key, keylen, | ||
741 | + ICP_QAT_HW_CIPHER_CTR_MODE); | ||
742 | } | ||
743 | |||
744 | -static int qat_alg_ablkcipher_xts_setkey(struct crypto_ablkcipher *tfm, | ||
745 | - const u8 *key, unsigned int keylen) | ||
746 | +static int qat_alg_skcipher_xts_setkey(struct crypto_skcipher *tfm, | ||
747 | + const u8 *key, unsigned int keylen) | ||
748 | { | ||
749 | - return qat_alg_ablkcipher_setkey(tfm, key, keylen, | ||
750 | - ICP_QAT_HW_CIPHER_XTS_MODE); | ||
751 | + return qat_alg_skcipher_setkey(tfm, key, keylen, | ||
752 | + ICP_QAT_HW_CIPHER_XTS_MODE); | ||
753 | } | ||
754 | |||
755 | -static int qat_alg_ablkcipher_encrypt(struct ablkcipher_request *req) | ||
756 | +static int qat_alg_skcipher_encrypt(struct skcipher_request *req) | ||
757 | { | ||
758 | - struct crypto_ablkcipher *atfm = crypto_ablkcipher_reqtfm(req); | ||
759 | - struct crypto_tfm *tfm = crypto_ablkcipher_tfm(atfm); | ||
760 | - struct qat_alg_ablkcipher_ctx *ctx = crypto_tfm_ctx(tfm); | ||
761 | - struct qat_crypto_request *qat_req = ablkcipher_request_ctx(req); | ||
762 | + struct crypto_skcipher *stfm = crypto_skcipher_reqtfm(req); | ||
763 | + struct crypto_tfm *tfm = crypto_skcipher_tfm(stfm); | ||
764 | + struct qat_alg_skcipher_ctx *ctx = crypto_tfm_ctx(tfm); | ||
765 | + struct qat_crypto_request *qat_req = skcipher_request_ctx(req); | ||
766 | struct icp_qat_fw_la_cipher_req_params *cipher_param; | ||
767 | struct icp_qat_fw_la_bulk_req *msg; | ||
768 | - int ret; | ||
769 | + struct device *dev = &GET_DEV(ctx->inst->accel_dev); | ||
770 | + int ret, ctr = 0; | ||
771 | + | ||
772 | + if (req->cryptlen == 0) | ||
773 | + return 0; | ||
774 | + | ||
775 | + qat_req->iv = dma_alloc_coherent(dev, AES_BLOCK_SIZE, | ||
776 | + &qat_req->iv_paddr, GFP_ATOMIC); | ||
777 | + if (!qat_req->iv) | ||
778 | + return -ENOMEM; | ||
779 | |||
780 | ret = qat_alg_sgl_to_bufl(ctx->inst, req->src, req->dst, qat_req); | ||
781 | - if (unlikely(ret)) | ||
782 | + if (unlikely(ret)) { | ||
783 | + dma_free_coherent(dev, AES_BLOCK_SIZE, qat_req->iv, | ||
784 | + qat_req->iv_paddr); | ||
785 | return ret; | ||
786 | + } | ||
787 | |||
788 | msg = &qat_req->req; | ||
789 | *msg = ctx->enc_fw_req; | ||
790 | - qat_req->ablkcipher_ctx = ctx; | ||
791 | - qat_req->ablkcipher_req = req; | ||
792 | - qat_req->cb = qat_ablkcipher_alg_callback; | ||
793 | + qat_req->skcipher_ctx = ctx; | ||
794 | + qat_req->skcipher_req = req; | ||
795 | + qat_req->cb = qat_skcipher_alg_callback; | ||
796 | qat_req->req.comn_mid.opaque_data = (uint64_t)(__force long)qat_req; | ||
797 | qat_req->req.comn_mid.src_data_addr = qat_req->buf.blp; | ||
798 | qat_req->req.comn_mid.dest_data_addr = qat_req->buf.bloutp; | ||
799 | cipher_param = (void *)&qat_req->req.serv_specif_rqpars; | ||
800 | - cipher_param->cipher_length = req->nbytes; | ||
801 | + cipher_param->cipher_length = req->cryptlen; | ||
802 | cipher_param->cipher_offset = 0; | ||
803 | - memcpy(cipher_param->u.cipher_IV_array, req->info, AES_BLOCK_SIZE); | ||
804 | - | ||
805 | + cipher_param->u.s.cipher_IV_ptr = qat_req->iv_paddr; | ||
806 | + memcpy(qat_req->iv, req->iv, AES_BLOCK_SIZE); | ||
807 | do { | ||
808 | ret = adf_send_message(ctx->inst->sym_tx, (uint32_t *)msg); | ||
809 | - if (ret) | ||
810 | - cond_resched(); | ||
811 | - } while (ret == -EAGAIN); | ||
812 | + } while (ret == -EAGAIN && ctr++ < 10); | ||
813 | |||
814 | + if (ret == -EAGAIN) { | ||
815 | + qat_alg_free_bufl(ctx->inst, qat_req); | ||
816 | + dma_free_coherent(dev, AES_BLOCK_SIZE, qat_req->iv, | ||
817 | + qat_req->iv_paddr); | ||
818 | + return -EBUSY; | ||
819 | + } | ||
820 | return -EINPROGRESS; | ||
821 | } | ||
822 | |||
823 | -static int qat_alg_ablkcipher_decrypt(struct ablkcipher_request *req) | ||
824 | +static int qat_alg_skcipher_blk_encrypt(struct skcipher_request *req) | ||
825 | +{ | ||
826 | + if (req->cryptlen % AES_BLOCK_SIZE != 0) | ||
827 | + return -EINVAL; | ||
828 | + | ||
829 | + return qat_alg_skcipher_encrypt(req); | ||
830 | +} | ||
831 | + | ||
832 | +static int qat_alg_skcipher_decrypt(struct skcipher_request *req) | ||
833 | { | ||
834 | - struct crypto_ablkcipher *atfm = crypto_ablkcipher_reqtfm(req); | ||
835 | - struct crypto_tfm *tfm = crypto_ablkcipher_tfm(atfm); | ||
836 | - struct qat_alg_ablkcipher_ctx *ctx = crypto_tfm_ctx(tfm); | ||
837 | - struct qat_crypto_request *qat_req = ablkcipher_request_ctx(req); | ||
838 | + struct crypto_skcipher *stfm = crypto_skcipher_reqtfm(req); | ||
839 | + struct crypto_tfm *tfm = crypto_skcipher_tfm(stfm); | ||
840 | + struct qat_alg_skcipher_ctx *ctx = crypto_tfm_ctx(tfm); | ||
841 | + struct qat_crypto_request *qat_req = skcipher_request_ctx(req); | ||
842 | struct icp_qat_fw_la_cipher_req_params *cipher_param; | ||
843 | struct icp_qat_fw_la_bulk_req *msg; | ||
844 | - int ret; | ||
845 | + struct device *dev = &GET_DEV(ctx->inst->accel_dev); | ||
846 | + int ret, ctr = 0; | ||
847 | + | ||
848 | + if (req->cryptlen == 0) | ||
849 | + return 0; | ||
850 | + | ||
851 | + qat_req->iv = dma_alloc_coherent(dev, AES_BLOCK_SIZE, | ||
852 | + &qat_req->iv_paddr, GFP_ATOMIC); | ||
853 | + if (!qat_req->iv) | ||
854 | + return -ENOMEM; | ||
855 | |||
856 | ret = qat_alg_sgl_to_bufl(ctx->inst, req->src, req->dst, qat_req); | ||
857 | - if (unlikely(ret)) | ||
858 | + if (unlikely(ret)) { | ||
859 | + dma_free_coherent(dev, AES_BLOCK_SIZE, qat_req->iv, | ||
860 | + qat_req->iv_paddr); | ||
861 | return ret; | ||
862 | + } | ||
863 | |||
864 | msg = &qat_req->req; | ||
865 | *msg = ctx->dec_fw_req; | ||
866 | - qat_req->ablkcipher_ctx = ctx; | ||
867 | - qat_req->ablkcipher_req = req; | ||
868 | - qat_req->cb = qat_ablkcipher_alg_callback; | ||
869 | + qat_req->skcipher_ctx = ctx; | ||
870 | + qat_req->skcipher_req = req; | ||
871 | + qat_req->cb = qat_skcipher_alg_callback; | ||
872 | qat_req->req.comn_mid.opaque_data = (uint64_t)(__force long)qat_req; | ||
873 | qat_req->req.comn_mid.src_data_addr = qat_req->buf.blp; | ||
874 | qat_req->req.comn_mid.dest_data_addr = qat_req->buf.bloutp; | ||
875 | cipher_param = (void *)&qat_req->req.serv_specif_rqpars; | ||
876 | - cipher_param->cipher_length = req->nbytes; | ||
877 | + cipher_param->cipher_length = req->cryptlen; | ||
878 | cipher_param->cipher_offset = 0; | ||
879 | - memcpy(cipher_param->u.cipher_IV_array, req->info, AES_BLOCK_SIZE); | ||
880 | - | ||
881 | + cipher_param->u.s.cipher_IV_ptr = qat_req->iv_paddr; | ||
882 | + memcpy(qat_req->iv, req->iv, AES_BLOCK_SIZE); | ||
883 | do { | ||
884 | ret = adf_send_message(ctx->inst->sym_tx, (uint32_t *)msg); | ||
885 | - if (ret) | ||
886 | - cond_resched(); | ||
887 | - } while (ret == -EAGAIN); | ||
888 | + } while (ret == -EAGAIN && ctr++ < 10); | ||
889 | |||
890 | + if (ret == -EAGAIN) { | ||
891 | + qat_alg_free_bufl(ctx->inst, qat_req); | ||
892 | + dma_free_coherent(dev, AES_BLOCK_SIZE, qat_req->iv, | ||
893 | + qat_req->iv_paddr); | ||
894 | + return -EBUSY; | ||
895 | + } | ||
896 | return -EINPROGRESS; | ||
897 | } | ||
898 | |||
899 | +static int qat_alg_skcipher_blk_decrypt(struct skcipher_request *req) | ||
900 | +{ | ||
901 | + if (req->cryptlen % AES_BLOCK_SIZE != 0) | ||
902 | + return -EINVAL; | ||
903 | + | ||
904 | + return qat_alg_skcipher_decrypt(req); | ||
905 | +} | ||
906 | static int qat_alg_aead_init(struct crypto_aead *tfm, | ||
907 | enum icp_qat_hw_auth_algo hash, | ||
908 | const char *hash_name) | ||
909 | @@ -1085,30 +1207,30 @@ static void qat_alg_aead_exit(struct crypto_aead *tfm) | ||
910 | |||
911 | dev = &GET_DEV(inst->accel_dev); | ||
912 | if (ctx->enc_cd) { | ||
913 | - memzero_explicit(ctx->enc_cd, sizeof(struct qat_alg_cd)); | ||
914 | + memset(ctx->enc_cd, 0, sizeof(struct qat_alg_cd)); | ||
915 | dma_free_coherent(dev, sizeof(struct qat_alg_cd), | ||
916 | ctx->enc_cd, ctx->enc_cd_paddr); | ||
917 | } | ||
918 | if (ctx->dec_cd) { | ||
919 | - memzero_explicit(ctx->dec_cd, sizeof(struct qat_alg_cd)); | ||
920 | + memset(ctx->dec_cd, 0, sizeof(struct qat_alg_cd)); | ||
921 | dma_free_coherent(dev, sizeof(struct qat_alg_cd), | ||
922 | ctx->dec_cd, ctx->dec_cd_paddr); | ||
923 | } | ||
924 | qat_crypto_put_instance(inst); | ||
925 | } | ||
926 | |||
927 | -static int qat_alg_ablkcipher_init(struct crypto_tfm *tfm) | ||
928 | +static int qat_alg_skcipher_init_tfm(struct crypto_skcipher *tfm) | ||
929 | { | ||
930 | - struct qat_alg_ablkcipher_ctx *ctx = crypto_tfm_ctx(tfm); | ||
931 | + struct qat_alg_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm); | ||
932 | |||
933 | - tfm->crt_ablkcipher.reqsize = sizeof(struct qat_crypto_request); | ||
934 | + crypto_skcipher_set_reqsize(tfm, sizeof(struct qat_crypto_request)); | ||
935 | ctx->tfm = tfm; | ||
936 | return 0; | ||
937 | } | ||
938 | |||
939 | -static void qat_alg_ablkcipher_exit(struct crypto_tfm *tfm) | ||
940 | +static void qat_alg_skcipher_exit_tfm(struct crypto_skcipher *tfm) | ||
941 | { | ||
942 | - struct qat_alg_ablkcipher_ctx *ctx = crypto_tfm_ctx(tfm); | ||
943 | + struct qat_alg_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm); | ||
944 | struct qat_crypto_instance *inst = ctx->inst; | ||
945 | struct device *dev; | ||
946 | |||
947 | @@ -1117,15 +1239,15 @@ static void qat_alg_ablkcipher_exit(struct crypto_tfm *tfm) | ||
948 | |||
949 | dev = &GET_DEV(inst->accel_dev); | ||
950 | if (ctx->enc_cd) { | ||
951 | - memzero_explicit(ctx->enc_cd, | ||
952 | - sizeof(struct icp_qat_hw_cipher_algo_blk)); | ||
953 | + memset(ctx->enc_cd, 0, | ||
954 | + sizeof(struct icp_qat_hw_cipher_algo_blk)); | ||
955 | dma_free_coherent(dev, | ||
956 | sizeof(struct icp_qat_hw_cipher_algo_blk), | ||
957 | ctx->enc_cd, ctx->enc_cd_paddr); | ||
958 | } | ||
959 | if (ctx->dec_cd) { | ||
960 | - memzero_explicit(ctx->dec_cd, | ||
961 | - sizeof(struct icp_qat_hw_cipher_algo_blk)); | ||
962 | + memset(ctx->dec_cd, 0, | ||
963 | + sizeof(struct icp_qat_hw_cipher_algo_blk)); | ||
964 | dma_free_coherent(dev, | ||
965 | sizeof(struct icp_qat_hw_cipher_algo_blk), | ||
966 | ctx->dec_cd, ctx->dec_cd_paddr); | ||
967 | @@ -1187,92 +1309,75 @@ static struct aead_alg qat_aeads[] = { { | ||
968 | .maxauthsize = SHA512_DIGEST_SIZE, | ||
969 | } }; | ||
970 | |||
971 | -static struct crypto_alg qat_algs[] = { { | ||
972 | - .cra_name = "cbc(aes)", | ||
973 | - .cra_driver_name = "qat_aes_cbc", | ||
974 | - .cra_priority = 4001, | ||
975 | - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, | ||
976 | - .cra_blocksize = AES_BLOCK_SIZE, | ||
977 | - .cra_ctxsize = sizeof(struct qat_alg_ablkcipher_ctx), | ||
978 | - .cra_alignmask = 0, | ||
979 | - .cra_type = &crypto_ablkcipher_type, | ||
980 | - .cra_module = THIS_MODULE, | ||
981 | - .cra_init = qat_alg_ablkcipher_init, | ||
982 | - .cra_exit = qat_alg_ablkcipher_exit, | ||
983 | - .cra_u = { | ||
984 | - .ablkcipher = { | ||
985 | - .setkey = qat_alg_ablkcipher_cbc_setkey, | ||
986 | - .decrypt = qat_alg_ablkcipher_decrypt, | ||
987 | - .encrypt = qat_alg_ablkcipher_encrypt, | ||
988 | - .min_keysize = AES_MIN_KEY_SIZE, | ||
989 | - .max_keysize = AES_MAX_KEY_SIZE, | ||
990 | - .ivsize = AES_BLOCK_SIZE, | ||
991 | - }, | ||
992 | - }, | ||
993 | +static struct skcipher_alg qat_skciphers[] = { { | ||
994 | + .base.cra_name = "cbc(aes)", | ||
995 | + .base.cra_driver_name = "qat_aes_cbc", | ||
996 | + .base.cra_priority = 4001, | ||
997 | + .base.cra_flags = CRYPTO_ALG_ASYNC, | ||
998 | + .base.cra_blocksize = AES_BLOCK_SIZE, | ||
999 | + .base.cra_ctxsize = sizeof(struct qat_alg_skcipher_ctx), | ||
1000 | + .base.cra_alignmask = 0, | ||
1001 | + .base.cra_module = THIS_MODULE, | ||
1002 | + | ||
1003 | + .init = qat_alg_skcipher_init_tfm, | ||
1004 | + .exit = qat_alg_skcipher_exit_tfm, | ||
1005 | + .setkey = qat_alg_skcipher_cbc_setkey, | ||
1006 | + .decrypt = qat_alg_skcipher_blk_decrypt, | ||
1007 | + .encrypt = qat_alg_skcipher_blk_encrypt, | ||
1008 | + .min_keysize = AES_MIN_KEY_SIZE, | ||
1009 | + .max_keysize = AES_MAX_KEY_SIZE, | ||
1010 | + .ivsize = AES_BLOCK_SIZE, | ||
1011 | }, { | ||
1012 | - .cra_name = "ctr(aes)", | ||
1013 | - .cra_driver_name = "qat_aes_ctr", | ||
1014 | - .cra_priority = 4001, | ||
1015 | - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, | ||
1016 | - .cra_blocksize = AES_BLOCK_SIZE, | ||
1017 | - .cra_ctxsize = sizeof(struct qat_alg_ablkcipher_ctx), | ||
1018 | - .cra_alignmask = 0, | ||
1019 | - .cra_type = &crypto_ablkcipher_type, | ||
1020 | - .cra_module = THIS_MODULE, | ||
1021 | - .cra_init = qat_alg_ablkcipher_init, | ||
1022 | - .cra_exit = qat_alg_ablkcipher_exit, | ||
1023 | - .cra_u = { | ||
1024 | - .ablkcipher = { | ||
1025 | - .setkey = qat_alg_ablkcipher_ctr_setkey, | ||
1026 | - .decrypt = qat_alg_ablkcipher_decrypt, | ||
1027 | - .encrypt = qat_alg_ablkcipher_encrypt, | ||
1028 | - .min_keysize = AES_MIN_KEY_SIZE, | ||
1029 | - .max_keysize = AES_MAX_KEY_SIZE, | ||
1030 | - .ivsize = AES_BLOCK_SIZE, | ||
1031 | - }, | ||
1032 | - }, | ||
1033 | + .base.cra_name = "ctr(aes)", | ||
1034 | + .base.cra_driver_name = "qat_aes_ctr", | ||
1035 | + .base.cra_priority = 4001, | ||
1036 | + .base.cra_flags = CRYPTO_ALG_ASYNC, | ||
1037 | + .base.cra_blocksize = 1, | ||
1038 | + .base.cra_ctxsize = sizeof(struct qat_alg_skcipher_ctx), | ||
1039 | + .base.cra_alignmask = 0, | ||
1040 | + .base.cra_module = THIS_MODULE, | ||
1041 | + | ||
1042 | + .init = qat_alg_skcipher_init_tfm, | ||
1043 | + .exit = qat_alg_skcipher_exit_tfm, | ||
1044 | + .setkey = qat_alg_skcipher_ctr_setkey, | ||
1045 | + .decrypt = qat_alg_skcipher_decrypt, | ||
1046 | + .encrypt = qat_alg_skcipher_encrypt, | ||
1047 | + .min_keysize = AES_MIN_KEY_SIZE, | ||
1048 | + .max_keysize = AES_MAX_KEY_SIZE, | ||
1049 | + .ivsize = AES_BLOCK_SIZE, | ||
1050 | }, { | ||
1051 | - .cra_name = "xts(aes)", | ||
1052 | - .cra_driver_name = "qat_aes_xts", | ||
1053 | - .cra_priority = 4001, | ||
1054 | - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, | ||
1055 | - .cra_blocksize = AES_BLOCK_SIZE, | ||
1056 | - .cra_ctxsize = sizeof(struct qat_alg_ablkcipher_ctx), | ||
1057 | - .cra_alignmask = 0, | ||
1058 | - .cra_type = &crypto_ablkcipher_type, | ||
1059 | - .cra_module = THIS_MODULE, | ||
1060 | - .cra_init = qat_alg_ablkcipher_init, | ||
1061 | - .cra_exit = qat_alg_ablkcipher_exit, | ||
1062 | - .cra_u = { | ||
1063 | - .ablkcipher = { | ||
1064 | - .setkey = qat_alg_ablkcipher_xts_setkey, | ||
1065 | - .decrypt = qat_alg_ablkcipher_decrypt, | ||
1066 | - .encrypt = qat_alg_ablkcipher_encrypt, | ||
1067 | - .min_keysize = 2 * AES_MIN_KEY_SIZE, | ||
1068 | - .max_keysize = 2 * AES_MAX_KEY_SIZE, | ||
1069 | - .ivsize = AES_BLOCK_SIZE, | ||
1070 | - }, | ||
1071 | - }, | ||
1072 | + .base.cra_name = "xts(aes)", | ||
1073 | + .base.cra_driver_name = "qat_aes_xts", | ||
1074 | + .base.cra_priority = 4001, | ||
1075 | + .base.cra_flags = CRYPTO_ALG_ASYNC, | ||
1076 | + .base.cra_blocksize = AES_BLOCK_SIZE, | ||
1077 | + .base.cra_ctxsize = sizeof(struct qat_alg_skcipher_ctx), | ||
1078 | + .base.cra_alignmask = 0, | ||
1079 | + .base.cra_module = THIS_MODULE, | ||
1080 | + | ||
1081 | + .init = qat_alg_skcipher_init_tfm, | ||
1082 | + .exit = qat_alg_skcipher_exit_tfm, | ||
1083 | + .setkey = qat_alg_skcipher_xts_setkey, | ||
1084 | + .decrypt = qat_alg_skcipher_blk_decrypt, | ||
1085 | + .encrypt = qat_alg_skcipher_blk_encrypt, | ||
1086 | + .min_keysize = 2 * AES_MIN_KEY_SIZE, | ||
1087 | + .max_keysize = 2 * AES_MAX_KEY_SIZE, | ||
1088 | + .ivsize = AES_BLOCK_SIZE, | ||
1089 | } }; | ||
1090 | |||
1091 | int qat_algs_register(void) | ||
1092 | { | ||
1093 | - int ret = 0, i; | ||
1094 | + int ret = 0; | ||
1095 | |||
1096 | mutex_lock(&algs_lock); | ||
1097 | if (++active_devs != 1) | ||
1098 | goto unlock; | ||
1099 | |||
1100 | - for (i = 0; i < ARRAY_SIZE(qat_algs); i++) | ||
1101 | - qat_algs[i].cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC; | ||
1102 | - | ||
1103 | - ret = crypto_register_algs(qat_algs, ARRAY_SIZE(qat_algs)); | ||
1104 | + ret = crypto_register_skciphers(qat_skciphers, | ||
1105 | + ARRAY_SIZE(qat_skciphers)); | ||
1106 | if (ret) | ||
1107 | goto unlock; | ||
1108 | |||
1109 | - for (i = 0; i < ARRAY_SIZE(qat_aeads); i++) | ||
1110 | - qat_aeads[i].base.cra_flags = CRYPTO_ALG_ASYNC; | ||
1111 | - | ||
1112 | ret = crypto_register_aeads(qat_aeads, ARRAY_SIZE(qat_aeads)); | ||
1113 | if (ret) | ||
1114 | goto unreg_algs; | ||
1115 | @@ -1282,7 +1387,7 @@ unlock: | ||
1116 | return ret; | ||
1117 | |||
1118 | unreg_algs: | ||
1119 | - crypto_unregister_algs(qat_algs, ARRAY_SIZE(qat_algs)); | ||
1120 | + crypto_unregister_skciphers(qat_skciphers, ARRAY_SIZE(qat_skciphers)); | ||
1121 | goto unlock; | ||
1122 | } | ||
1123 | |||
1124 | @@ -1293,9 +1398,8 @@ void qat_algs_unregister(void) | ||
1125 | goto unlock; | ||
1126 | |||
1127 | crypto_unregister_aeads(qat_aeads, ARRAY_SIZE(qat_aeads)); | ||
1128 | - crypto_unregister_algs(qat_algs, ARRAY_SIZE(qat_algs)); | ||
1129 | + crypto_unregister_skciphers(qat_skciphers, ARRAY_SIZE(qat_skciphers)); | ||
1130 | |||
1131 | unlock: | ||
1132 | mutex_unlock(&algs_lock); | ||
1133 | } | ||
1134 | -#endif | ||
1135 | diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/qat_crypto.h b/quickassist/qat/drivers/crypto/qat/qat_common/qat_crypto.h | ||
1136 | index dc0273f..300bb91 100644 | ||
1137 | --- a/quickassist/qat/drivers/crypto/qat/qat_common/qat_crypto.h | ||
1138 | +++ b/quickassist/qat/drivers/crypto/qat/qat_common/qat_crypto.h | ||
1139 | @@ -79,15 +79,17 @@ struct qat_crypto_request { | ||
1140 | struct icp_qat_fw_la_bulk_req req; | ||
1141 | union { | ||
1142 | struct qat_alg_aead_ctx *aead_ctx; | ||
1143 | - struct qat_alg_ablkcipher_ctx *ablkcipher_ctx; | ||
1144 | + struct qat_alg_skcipher_ctx *skcipher_ctx; | ||
1145 | }; | ||
1146 | union { | ||
1147 | struct aead_request *aead_req; | ||
1148 | - struct ablkcipher_request *ablkcipher_req; | ||
1149 | + struct skcipher_request *skcipher_req; | ||
1150 | }; | ||
1151 | struct qat_crypto_request_buffs buf; | ||
1152 | void (*cb)(struct icp_qat_fw_la_resp *resp, | ||
1153 | struct qat_crypto_request *req); | ||
1154 | + void *iv; | ||
1155 | + dma_addr_t iv_paddr; | ||
1156 | }; | ||
1157 | |||
1158 | #endif | ||
1159 | -- | ||
1160 | 2.24.1 | ||
1161 | |||
diff --git a/recipes-extended/qat/qat17_4.2.0-00012.bb b/recipes-extended/qat/qat17_4.7.0-00006.bb index a5902dc..693a2f8 100644 --- a/recipes-extended/qat/qat17_4.2.0-00012.bb +++ b/recipes-extended/qat/qat17_4.7.0-00006.bb | |||
@@ -12,17 +12,24 @@ PROVIDES += "virtual/qat" | |||
12 | 12 | ||
13 | TARGET_CC_ARCH += "${LDFLAGS}" | 13 | TARGET_CC_ARCH += "${LDFLAGS}" |
14 | 14 | ||
15 | SRC_URI="https://01.org/sites/default/files/downloads/intelr-quickassist-technology/qat1.7.l.${PV}.tar.gz;subdir=qat17 \ | 15 | SRC_URI = "https://01.org/sites/default/files/downloads/qat1.7.l.4.7.0-00006.tar.gz;subdir=qat17 \ |
16 | file://qat16_2.3.0-34-qat-remove-local-path-from-makefile.patch \ | 16 | file://qat16_2.3.0-34-qat-remove-local-path-from-makefile.patch \ |
17 | file://qat16_2.6.0-65-qat-override-CC-LD-AR-only-when-it-is-not-define.patch \ | 17 | file://qat16_2.6.0-65-qat-override-CC-LD-AR-only-when-it-is-not-define.patch \ |
18 | file://qat17_0.6.0-1-qat-update-KDIR-for-cross-compilation.patch \ | 18 | file://qat17_0.6.0-1-qat-update-KDIR-for-cross-compilation.patch \ |
19 | file://qat17_0.8.0-37-qat-added-include-dir-path.patch \ | 19 | file://qat17_0.8.0-37-qat-added-include-dir-path.patch \ |
20 | file://qat17_0.9.0-4-qat-add-install-target-and-add-folder.patch \ | 20 | file://qat17_0.9.0-4-qat-add-install-target-and-add-folder.patch \ |
21 | file://qat17_4.1.0-00022-qat-use-static-lib-for-linking.patch \ | 21 | file://qat17_4.1.0-00022-qat-use-static-lib-for-linking.patch \ |
22 | " | 22 | file://qat17_4.7.0-00006-Link-driver-with-object-files.patch \ |
23 | 23 | file://qat17_4.7.0-00006-Drop-pr_warning-definition.patch \ | |
24 | SRC_URI[md5sum] = "2fe81587e8b85747d5461b031241beb2" | 24 | " |
25 | SRC_URI[sha256sum] = "47990b3283ded748799dba42d4b0e1bdc0be3cf3978bd587533cd12788b03856" | 25 | |
26 | python __anonymous () { | ||
27 | if d.getVar("KERNEL_VERSION") >= "5.5%": | ||
28 | d.appendVar('SRC_URI', "file://qat17_4.7.0-00006-Switch-to-skcipher-API.patch") | ||
29 | } | ||
30 | |||
31 | SRC_URI[md5sum] = "ac939b51cc8836c182e31e309c065002" | ||
32 | SRC_URI[sha256sum] = "5c8bdc35fd7a42f212f1f87eb9e3d8584df7af56dae366debc487981e531fa5c" | ||
26 | 33 | ||
27 | COMPATIBLE_MACHINE = "null" | 34 | COMPATIBLE_MACHINE = "null" |
28 | COMPATIBLE_HOST_x86-x32 = 'null' | 35 | COMPATIBLE_HOST_x86-x32 = 'null' |
@@ -65,13 +72,13 @@ do_compile () { | |||
65 | export LD="${LD} --hash-style=gnu" | 72 | export LD="${LD} --hash-style=gnu" |
66 | export MACHINE="${TARGET_ARCH}" | 73 | export MACHINE="${TARGET_ARCH}" |
67 | 74 | ||
68 | cd ${S}/quickassist | ||
69 | oe_runmake | ||
70 | |||
71 | cd ${S}/quickassist/qat | 75 | cd ${S}/quickassist/qat |
72 | oe_runmake 'clean' | 76 | oe_runmake |
73 | oe_runmake 'modules_install' | 77 | oe_runmake 'modules_install' |
74 | 78 | ||
79 | cd ${S}/quickassist | ||
80 | oe_runmake | ||
81 | |||
75 | cd ${S}/quickassist/utilities/adf_ctl | 82 | cd ${S}/quickassist/utilities/adf_ctl |
76 | oe_runmake | 83 | oe_runmake |
77 | 84 | ||
@@ -109,27 +116,22 @@ do_install() { | |||
109 | echo 'KERNEL=="uio*" MODE="0660" GROUP="qat"' >> ${D}/etc/udev/rules.d/00-qat.rules | 116 | echo 'KERNEL=="uio*" MODE="0660" GROUP="qat"' >> ${D}/etc/udev/rules.d/00-qat.rules |
110 | echo 'KERNEL=="hugepages" MODE="0660" GROUP="qat"' >> ${D}/etc/udev/rules.d/00-qat.rules | 117 | echo 'KERNEL=="hugepages" MODE="0660" GROUP="qat"' >> ${D}/etc/udev/rules.d/00-qat.rules |
111 | 118 | ||
119 | mkdir -p ${D}${base_libdir} | ||
120 | |||
112 | install -D -m 0755 ${S}/quickassist/lookaside/access_layer/src/build/linux_2.6/user_space/libqat_s.so ${D}${base_libdir} | 121 | install -D -m 0755 ${S}/quickassist/lookaside/access_layer/src/build/linux_2.6/user_space/libqat_s.so ${D}${base_libdir} |
113 | install -D -m 0755 ${S}/quickassist/lookaside/access_layer/src/build/linux_2.6/user_space/libqat.a ${D}${base_libdir} | 122 | install -D -m 0755 ${S}/quickassist/lookaside/access_layer/src/build/linux_2.6/user_space/libqat.a ${D}${base_libdir} |
114 | install -D -m 0755 ${S}/quickassist/utilities/osal/src/build/linux_2.6/user_space/libosal_s.so ${D}${base_libdir} | 123 | install -D -m 0755 ${S}/quickassist/utilities/osal/src/build/linux_2.6/user_space/libosal_s.so ${D}${base_libdir} |
115 | install -D -m 0755 ${S}/quickassist/utilities/osal/src/build/linux_2.6/user_space/libosal.a ${D}${base_libdir} | 124 | install -D -m 0755 ${S}/quickassist/utilities/osal/src/build/linux_2.6/user_space/libosal.a ${D}${base_libdir} |
116 | install -D -m 0755 ${S}/quickassist/lookaside/access_layer/src/qat_direct/src/build/linux_2.6/user_space/libadf.a ${D}${base_libdir} | 125 | install -D -m 0755 ${S}/quickassist/lookaside/access_layer/src/qat_direct/src/build/linux_2.6/user_space/libadf_user.a ${D}${base_libdir}/libadf.a |
117 | install -D -m 0755 ${S}/quickassist/utilities/libusdm_drv/libusdm_drv_s.so ${D}${base_libdir} | 126 | install -D -m 0755 ${S}/quickassist/utilities/libusdm_drv/libusdm_drv_s.so ${D}${base_libdir} |
118 | install -D -m 0755 ${S}/quickassist/utilities/libusdm_drv/libusdm_drv.a ${D}${base_libdir} | 127 | install -D -m 0755 ${S}/quickassist/utilities/libusdm_drv/libusdm_drv.a ${D}${base_libdir} |
119 | install -D -m 0750 ${S}/quickassist/utilities/adf_ctl/adf_ctl ${D}${sbindir} | 128 | install -D -m 0750 ${S}/quickassist/utilities/adf_ctl/adf_ctl ${D}${sbindir} |
120 | 129 | ||
121 | install -D -m 640 ${S}/quickassist/utilities/adf_ctl/conf_files/c3xxx_dev0.conf ${D}${sysconfdir} | ||
122 | install -D -m 640 ${S}/quickassist/utilities/adf_ctl/conf_files/*.conf ${D}${sysconfdir}/conf_files | 130 | install -D -m 640 ${S}/quickassist/utilities/adf_ctl/conf_files/*.conf ${D}${sysconfdir}/conf_files |
123 | install -D -m 640 ${S}/quickassist/utilities/adf_ctl/conf_files/*.conf.vm ${D}${sysconfdir}/conf_files | 131 | install -D -m 640 ${S}/quickassist/utilities/adf_ctl/conf_files/*.conf.vm ${D}${sysconfdir}/conf_files |
124 | 132 | ||
125 | install -m 0755 ${S}/quickassist/qat/fw/qat_c3xxx.bin ${D}${base_libdir}/firmware | 133 | install -m 0755 ${S}/quickassist/qat/fw/qat_d15xx.bin ${D}${nonarch_base_libdir}/firmware |
126 | install -m 0755 ${S}/quickassist/qat/fw/qat_c3xxx_mmp.bin ${D}${base_libdir}/firmware | 134 | install -m 0755 ${S}/quickassist/qat/fw/qat_d15xx_mmp.bin ${D}${nonarch_base_libdir}/firmware |
127 | install -m 0755 ${S}/quickassist/qat/fw/qat_c62x.bin ${D}${base_libdir}/firmware | ||
128 | install -m 0755 ${S}/quickassist/qat/fw/qat_c62x_mmp.bin ${D}${base_libdir}/firmware | ||
129 | install -m 0755 ${S}/quickassist/qat/fw/qat_895xcc.bin ${D}${base_libdir}/firmware | ||
130 | install -m 0755 ${S}/quickassist/qat/fw/qat_895xcc_mmp.bin ${D}${base_libdir}/firmware | ||
131 | install -m 0755 ${S}/quickassist/qat/fw/qat_d15xx.bin ${D}${base_libdir}/firmware | ||
132 | install -m 0755 ${S}/quickassist/qat/fw/qat_d15xx_mmp.bin ${D}${base_libdir}/firmware | ||
133 | 135 | ||
134 | install -m 640 ${S}/quickassist/include/*.h ${D}${includedir} | 136 | install -m 640 ${S}/quickassist/include/*.h ${D}${includedir} |
135 | install -m 640 ${S}/quickassist/include/dc/*.h ${D}${includedir}/dc/ | 137 | install -m 640 ${S}/quickassist/include/dc/*.h ${D}${includedir}/dc/ |
@@ -137,25 +139,27 @@ do_install() { | |||
137 | install -m 640 ${S}/quickassist/lookaside/access_layer/include/*.h ${D}${includedir} | 139 | install -m 640 ${S}/quickassist/lookaside/access_layer/include/*.h ${D}${includedir} |
138 | install -m 640 ${S}/quickassist/utilities/libusdm_drv/*.h ${D}${includedir} | 140 | install -m 640 ${S}/quickassist/utilities/libusdm_drv/*.h ${D}${includedir} |
139 | 141 | ||
140 | install -m 0755 ${S}/quickassist/lookaside/access_layer/src/sample_code/performance/compression/calgary ${D}${base_libdir}/firmware | 142 | install -m 0755 ${S}/quickassist/lookaside/access_layer/src/sample_code/performance/compression/calgary ${D}${nonarch_base_libdir}/firmware |
141 | install -m 0755 ${S}/quickassist/lookaside/access_layer/src/sample_code/performance/compression/calgary32 ${D}${base_libdir}/firmware | 143 | install -m 0755 ${S}/quickassist/lookaside/access_layer/src/sample_code/performance/compression/calgary32 ${D}${nonarch_base_libdir}/firmware |
142 | install -m 0755 ${S}/quickassist/lookaside/access_layer/src/sample_code/performance/compression/canterbury ${D}${base_libdir}/firmware | 144 | install -m 0755 ${S}/quickassist/lookaside/access_layer/src/sample_code/performance/compression/canterbury ${D}${nonarch_base_libdir}/firmware |
143 | 145 | ||
144 | #install qat source | 146 | #install qat source |
145 | 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/ |
146 | } | 148 | } |
147 | 149 | ||
148 | PACKAGES += "${PN}-app ${PN}-src" | 150 | PACKAGES += "${PN}-app" |
149 | 151 | ||
150 | FILES_${PN}-dev = "${includedir}/ \ | 152 | FILES_${PN}-dev = "${includedir}/ \ |
153 | ${nonarch_base_libdir}/*.a \ | ||
151 | " | 154 | " |
152 | 155 | ||
153 | FILES_${PN} += "\ | 156 | FILES_${PN} += "\ |
154 | ${libdir}/ \ | 157 | ${libdir}/ \ |
155 | ${base_libdir}/firmware \ | 158 | ${nonarch_base_libdir}/firmware \ |
156 | ${sysconfdir}/ \ | 159 | ${sysconfdir}/ \ |
157 | ${sbindir}/ \ | 160 | ${sbindir}/ \ |
158 | ${base_libdir}/*.so \ | 161 | ${base_libdir}/*.so \ |
162 | ${prefix}/src/qat \ | ||
159 | " | 163 | " |
160 | 164 | ||
161 | FILES_${PN}-dbg += "${sysconfdir}/init.d/.debug/ \ | 165 | FILES_${PN}-dbg += "${sysconfdir}/init.d/.debug/ \ |
@@ -164,6 +168,3 @@ FILES_${PN}-dbg += "${sysconfdir}/init.d/.debug/ \ | |||
164 | FILES_${PN}-app += "${bindir}/* \ | 168 | FILES_${PN}-app += "${bindir}/* \ |
165 | ${prefix}/qat \ | 169 | ${prefix}/qat \ |
166 | " | 170 | " |
167 | |||
168 | FILES_${PN}-src += "${prefix}/src/* \ | ||
169 | " | ||