Subject: [7/7] crypto: caam/qi - add ablkcipher and authenc algorithms

From: [email-masked] (Laurentiu Tudor)
Date: Tue, 4 Apr 2017 13:28:49 +0000

Hi Michael,

Just a couple of basic things to check:
  - was the dtb updated to the newest?
  - is the qman node present? This should be easily visible in 
/proc/device-tree/soc at ffe000000/qman at 318000.

---
Best Regards, Laurentiu

On 04/04/2017 08:03 AM, Michael Ellerman wrote:
> Horia Geant? <[email-masked]> writes:
>
>> Add support to submit ablkcipher and authenc algorithms
>> via the QI backend:
>> -ablkcipher:
>> cbc({aes,des,des3_ede})
>> ctr(aes), rfc3686(ctr(aes))
>> xts(aes)
>> -authenc:
>> authenc(hmac(md5),cbc({aes,des,des3_ede}))
>> authenc(hmac(sha*),cbc({aes,des,des3_ede}))
>>
>> caam/qi being a new driver, let's wait some time to settle down without
>> interfering with existing caam/jr driver.
>> Accordingly, for now all caam/qi algorithms (caamalg_qi module) are
>> marked to be of lower priority than caam/jr ones (caamalg module).
>>
>> Signed-off-by: Vakul Garg <[email-masked]>
>> Signed-off-by: Alex Porosanu <[email-masked]>
>> Signed-off-by: Horia Geant? <[email-masked]>
>> ---
>>   drivers/crypto/caam/Kconfig        |   20 +-
>>   drivers/crypto/caam/Makefile       |    1 +
>>   drivers/crypto/caam/caamalg.c      |    9 +-
>>   drivers/crypto/caam/caamalg_desc.c |   77 +-
>>   drivers/crypto/caam/caamalg_desc.h |   15 +-
>>   drivers/crypto/caam/caamalg_qi.c   | 2387 ++++++++++++++++++++++++++++++++++++
>>   drivers/crypto/caam/sg_sw_qm.h     |  108 ++
>>   7 files changed, 2601 insertions(+), 16 deletions(-)
>>   create mode 100644 drivers/crypto/caam/caamalg_qi.c
>>   create mode 100644 drivers/crypto/caam/sg_sw_qm.h
>
>
> This appears to be blowing up my Freescale (NXP) P5020DS board:
>
>    Unable to handle kernel paging request for data at address 0x00000020
>    Faulting instruction address: 0xc0000000004393e4
>    Oops: Kernel access of bad area, sig: 11 [#1]
>    SMP NR_CPUS=24
>    CoreNet Generic
>    Modules linked in:
>    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.11.0-rc3-compiler_gcc-4.6.3-00046-gb189817cf789 #5
>    task: c0000000f70c0000 task.stack: c0000000f70c8000
>    NIP: c0000000004393e4 LR: c0000000004aeba0 CTR: c0000000004fa7d8
>    REGS: c0000000f70cb160 TRAP: 0300   Not tainted  (4.11.0-rc3-compiler_gcc-4.6.3-00046-gb189817cf789)
>    MSR: 0000000080029000 <CE,EE,ME>
>      CR: 24adbe48  XER: 20000000
>    DEAR: 0000000000000020 ESR: 0000000000000000 SOFTE: 1
>    GPR00: c0000000006feba0 c0000000f70cb3e0 c000000000e60000 0000000000000000
>    GPR04: 0000000000000001 0000000000000000 c000000000e0b290 0000000000000003
>    GPR08: 0000000000000004 c000000000ea5280 0000000000000004 0000000000000004
>    GPR12: 0000000088adbe22 c00000003fff5000 c000000000ba3518 8000080088090fa8
>    GPR16: 0000000000001000 c000000000ba3500 c0000000f72c68d8 0000000000000004
>    GPR20: c000000000ea5280 c000000000ba34e8 0000000000000020 0000000000000004
>    GPR24: c000000000eab7c0 0000000000000000 c0000000f7fc8818 c000000000eb0000
>    GPR28: c0000000f786cc00 c000000000eab780 fffffffff786cc00 c000000000eab7c0
>    NIP [c0000000004393e4] .gen_pool_alloc+0x0/0xc
>    LR [c0000000004aeba0] .qman_alloc_cgrid_range+0x24/0x54
>    Call Trace:
>    [c0000000f70cb3e0] [c000000000504054] .platform_device_register_full+0x12c/0x150 (unreliable)
>    [c0000000f70cb460] [c0000000006feba0] .caam_qi_init+0x158/0x63c
>    [c0000000f70cb5f0] [c0000000006fc64c] .caam_probe+0x8b8/0x1830
>    [c0000000f70cb740] [c000000000503288] .platform_drv_probe+0x60/0xac
>    [c0000000f70cb7c0] [c000000000501194] .driver_probe_device+0x248/0x344
>    [c0000000f70cb870] [c0000000005013b4] .__driver_attach+0x124/0x128
>    [c0000000f70cb900] [c0000000004fed90] .bus_for_each_dev+0x80/0xcc
>    [c0000000f70cb9a0] [c000000000500858] .driver_attach+0x24/0x38
>    [c0000000f70cba10] [c00000000050043c] .bus_add_driver+0x14c/0x29c
>    [c0000000f70cbab0] [c000000000501d64] .driver_register+0x8c/0x154
>    [c0000000f70cbb30] [c000000000503000] .__platform_driver_register+0x48/0x5c
>    [c0000000f70cbba0] [c000000000c7f798] .caam_driver_init+0x1c/0x30
>    [c0000000f70cbc10] [c000000000001904] .do_one_initcall+0x60/0x1a8
>    [c0000000f70cbcf0] [c000000000c35f30] .kernel_init_freeable+0x248/0x334
>    [c0000000f70cbdb0] [c0000000000020fc] .kernel_init+0x1c/0xf20
>    [c0000000f70cbe30] [c0000000000009bc] .ret_from_kernel_thread+0x58/0x9c
>    Instruction dump:
>    eb61ffd8 eb81ffe0 eba1ffe8 ebc1fff0 ebe1fff8 4e800020 38600000 4bffffb0
>    7ce53b78 4bffff0c 7f67db78 4bffff24 <e8a30020> e8c30028 4bfffd30 fbe1fff8
>    ---[ end trace 9f61087068991b02 ]---
>
>
> home:linux-next(4)(I)> git bisect log
> ...
> git bisect bad b189817cf7894e03fd3700acd923221d3007259e
> # first bad commit: [b189817cf7894e03fd3700acd923221d3007259e] crypto: caam/qi - add ablkcipher and authenc algorithms
>
>
> The oops is saying gen_pool_alloc() was called with a NULL pointer, so
> it seems qm_cgralloc is NULL:
>
> static int qman_alloc_range(struct gen_pool *p, u32 *result, u32 cnt)
> {
> 	unsigned long addr;
>
> 	addr = gen_pool_alloc(p, cnt);
> 	...
>
> int qman_alloc_cgrid_range(u32 *result, u32 count)
> {
> 	return qman_alloc_range(qm_cgralloc, result, count);
> }
>
>
> I didn't pull the thread any further than that.
>
> cheers
>