On 1/23/2020 9:43 PM, Corentin Labbe wrote: > On Mon, Jan 20, 2020 at 02:23:59PM +0200, Iuliana Prodan wrote: >> Integrate crypto_engine framework into CAAM, to make use of >> the engine queue. >> Added support for SKCIPHER, HASH, RSA and AEAD algorithms. >> This is intended to be used for CAAM backlogging support. >> The requests, with backlog flag (e.g. from dm-crypt) will be >> listed into crypto-engine queue and processed by CAAM when free. >> >> While here, I've also made some refactorization. >> Patches #1 - #4 include some refactorizations on caamalg, caamhash >> and caampkc. >> Patch #5 changes the return code of caam_jr_enqueue function >> to -EINPROGRESS, in case of success, -ENOSPC in case the CAAM is >> busy, -EIO if it cannot map the caller's descriptor. >> Patches #6 - #9 integrate crypto_engine into CAAM, for >> SKCIPHER/AEAD/RSA/HASH algorithms. >> >> --- >> Changes since V3: >> - update return on ahash_enqueue_req function from patch #9. >> >> Changes since V2: >> - remove patch ("crypto: caam - refactor caam_jr_enqueue"), >> that added some structures not needed anymore; >> - use _done_ callback function directly for skcipher and aead; >> - handle resource leak in case of transfer request to crypto-engine; >> - update commit messages. >> >> Changes since V1: >> - remove helper function - akcipher_request_cast; >> - remove any references to crypto_async_request, >> use specific request type; >> - remove bypass crypto-engine queue, in case is empty; >> - update some commit messages; >> - remove unrelated changes, like whitespaces; >> - squash some changes from patch #9 to patch #6; >> - added Reviewed-by. >> --- >> >> Iuliana Prodan (9): >> crypto: caam - refactor skcipher/aead/gcm/chachapoly {en,de}crypt >> functions >> crypto: caam - refactor ahash_done callbacks >> crypto: caam - refactor ahash_edesc_alloc >> crypto: caam - refactor RSA private key _done callbacks >> crypto: caam - change return code in caam_jr_enqueue function >> crypto: caam - support crypto_engine framework for SKCIPHER algorithms >> crypto: caam - add crypto_engine support for AEAD algorithms >> crypto: caam - add crypto_engine support for RSA algorithms >> crypto: caam - add crypto_engine support for HASH algorithms >> >> drivers/crypto/caam/Kconfig | 1 + >> drivers/crypto/caam/caamalg.c | 416 ++++++++++++++++++----------------------- >> drivers/crypto/caam/caamhash.c | 341 ++++++++++++++++----------------- >> drivers/crypto/caam/caampkc.c | 187 +++++++++++------- >> drivers/crypto/caam/caampkc.h | 10 + >> drivers/crypto/caam/caamrng.c | 4 +- >> drivers/crypto/caam/intern.h | 2 + >> drivers/crypto/caam/jr.c | 37 +++- >> drivers/crypto/caam/key_gen.c | 2 +- >> 9 files changed, 523 insertions(+), 477 deletions(-) >> > > Hello > > I have tested this serie on a imx8mn-ddr4-evk and get the follwing crash: > [ 34.367787] Unable to handle kernel paging request at virtual address cccccccccccccccc > [ 34.375715] Mem abort info: > [ 34.378506] ESR = 0x96000004 > [ 34.381572] EC = 0x25: DABT (current EL), IL = 32 bits > [ 34.386888] SET = 0, FnV = 0 > [ 34.389948] EA = 0, S1PTW = 0 > [ 34.393091] Data abort info: > [ 34.395978] ISV = 0, ISS = 0x00000004 > [ 34.399816] CM = 0, WnR = 0 > [ 34.402781] [cccccccccccccccc] address between user and kernel address ranges > [ 34.409922] Internal error: Oops: 96000004 [#1] PREEMPT SMP > [ 34.415492] Modules linked in: ctr des_generic caam_jr(+) caamhash_desc caamalg_desc rng_core authenc libdes fsl_imx8_ddr_perf snvs_pwrkey rtc_snvs caam error imx_cpufreq_dt > [ 34.430977] CPU: 2 PID: 267 Comm: cryptomgr_test Not tainted 5.5.0-rc7-next-20200122-00009-geed96b480af6 #39 > [ 34.440799] Hardware name: NXP i.MX8MNano DDR4 EVK board (DT) > [ 34.446542] pstate: 60000005 (nZCv daif -PAN -UAO) > [ 34.451337] pc : __kmalloc+0xc4/0x290 > [ 34.454997] lr : __kmalloc+0x48/0x290 > [ 34.458655] sp : ffff800011b0b740 > [ 34.461965] x29: ffff800011b0b740 x28: 0000000000000002 > [ 34.467275] x27: 0000000000000080 x26: ffff800010c4b598 > [ 34.472584] x25: 0000000000000cc0 x24: ffff00007b79b000 > [ 34.477894] x23: 000000000000ac02 x22: ffff800008c5c254 > [ 34.483203] x21: 0000000000000dc1 x20: cccccccccccccccc > [ 34.488512] x19: ffff00007d404200 x18: 0000000000000002 > [ 34.493821] x17: 0000000008080040 x16: 0000000008182040 > [ 34.499131] x15: 0000000002004800 x14: 0000000000000000 > [ 34.504440] x13: 0000000000000000 x12: 0000000300000017 > [ 34.509749] x11: fffffe0001ca2702 x10: 0000000000000000 > [ 34.515058] x9 : 0000000000000000 x8 : ffff8000115e98c8 > [ 34.520368] x7 : ffff800011776000 x6 : 0000000000000000 > [ 34.525677] x5 : 000000000000ac02 x4 : 0000000000000011 > [ 34.530986] x3 : 0000000000000002 x2 : 0000000000000000 > [ 34.536295] x1 : ffff00007aaaf000 x0 : 0000000000000001 > [ 34.541606] Call trace: > [ 34.544051] __kmalloc+0xc4/0x290 > [ 34.547377] skcipher_edesc_alloc+0x154/0xab0 [caam_jr] > [ 34.552607] skcipher_encrypt+0x58/0x118 [caam_jr] > [ 34.557397] crypto_skcipher_encrypt+0x40/0x70 > [ 34.561839] test_skcipher_vec_cfg+0x254/0x768 > [ 34.566279] test_skcipher_vec+0xfc/0x148 > [ 34.570285] alg_test_skcipher+0xc0/0x1e8 > [ 34.574294] alg_test.part.32+0xb0/0x378 > [ 34.578214] alg_test+0x3c/0x68 > [ 34.581354] cryptomgr_test+0x44/0x50 > [ 34.585015] kthread+0x118/0x120 > [ 34.588241] ret_from_fork+0x10/0x18 > [ 34.591818] Code: d5384101 b9402262 b9401020 11000400 (f8626a98) > [ 34.597910] ---[ end trace 3e4862893c99a748 ]--- > Thanks for testing this. I'll fix it in v5. Iulia