summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJason Liu <jason.hui.liu@nxp.com>2016-01-25 17:19:39 +0800
committerDan Douglass <dan.douglass@freescale.com>2016-01-25 14:01:28 -0600
commit9d4fa487044cd3757a8e7cc508c6f4ebf8592480 (patch)
tree2dcff7d830a6caf3332ab7f66e5f7e980d40231a /drivers
parentc00b2ec0b48b1cd72762528df8882e6c9e898044 (diff)
crypto: caam: fix the DMA handle checking for the DMA maintainance
Fix the DMA handle checking for the DMA maintainance. Should not call the dma_sync_single_for_device if the handle is NULL, otherwise, kernel will throw out the following complains: when do the following test: insmod ./tcrypt.ko mode=402 Unable to handle kernel paging request at virtual address 70000000 pgd = d8c64000 [70000000] *pgd=00000000 Internal error: Oops: 805 [#1] PREEMPT SMP ARM Modules linked in: tcrypt(+) CPU: 1 PID: 789 Comm: insmod Not tainted 4.1.15-01516-g116e2fc-dirty #14 Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) task: d8b54280 ti: d8882000 task.ti: d8882000 PC is at v7_dma_clean_range+0x20/0x38 LR is at dma_cache_maint_page+0xc8/0x22c pc : [<8001e81c>] lr : [<8001b018>] psr: 200b0013 sp : d8883d08 ip : 8001e86c fp : 000004c0 r10: 80b8b000 r9 : 80b244f8 r8 : ee557000 r7 : 00000000 r6 : 80b8f41c r5 : 00000000 r4 : 70000000 r3 : 0000001f r2 : 00000020 r1 : 70000000 r0 : 70000000 Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user Control: 10c53c7d Table: 68c6404a DAC: 00000015 Process insmod (pid: 789, stack limit = 0xd8882210) Stack: (0xd8883d08 to 0xd8884000) 3d00: ef26bfe0 00000002 00000018 00000001 00000000 00000000 3d20: ee557000 00000001 00000000 d86f0a10 00000000 d8bc2040 d8a7f5c4 8001b1a0 3d40: 8001e86c 8001b2c8 d88a5c40 d88a5c40 80b28bc4 d8a7f400 80beec48 8057f1dc 3d60: 00000002 00000000 00000000 00000038 00000018 80bdc1c0 68bc2128 d8a7f480 3d80: 00000000 80068c10 600b0013 00000100 00000000 d8a7f400 00000040 00000004 3da0: d871ca00 00000040 00000000 8057a9b0 8057a9a4 7f000d14 00000100 80068c10 3dc0: 7f005580 d8883de4 00000100 00000004 d8a7f400 7f005e80 7f005eb0 0000000c 3de0: d871ca00 00000040 00000100 7f0015ec 00000004 80b24648 00000000 00000000 3e00: d8bc2000 d8bc2040 00000008 ef26fa80 00000000 00001000 68c54000 ef26ae80 3e20: 00000000 00001000 00000000 ef270bc0 00000000 00001000 00000000 ef26db02 3e40: 00000000 00001000 00000000 00000000 02880288 d8883e54 d8883e54 00000000 3e60: 00000000 00000010 7f0062f8 80b27698 80b27698 d871ca00 d8882000 00000000 3e80: 00000008 7f003124 7f0062f8 80b27698 00000010 7f0062f8 80b27698 80b27698 3ea0: d871ca00 d8882000 00000000 7f009048 7f009000 00000000 80b27698 80009704 3ec0: 000000d0 ef26fa80 00000000 8040003e 00000001 00000001 d8883eec ef2709c0 3ee0: d8001f00 80b246bc 00000001 8040003e d8883f04 800905a8 00000001 00000001 3f00: d8883f14 d8001f00 000000d0 80b23260 00000008 7f0061a0 d871c3c0 0131e008 3f20: 0000017b 8000f684 d8882000 00000000 00000008 8008f968 00000000 00000000 3f40: 00000003 00000000 00000003 0131e008 0000017b 800906fc f0679000 0000b857 3f60: f0680070 f067ff25 f06840d0 0000671c 00006e8c 00000000 00000000 00000000 3f80: 0000001f 00000020 00000017 00000014 00000012 00000000 0131e018 00000008 3fa0: 0131e008 8000f500 0131e018 00000008 00000003 0131e008 00000000 00000000 3fc0: 0131e018 00000008 0131e008 0000017b 00000003 00000008 0131e008 00000008 3fe0: 7e8a6c38 7e8a6c28 0001f2c0 76f22340 600d0010 00000003 00000000 00000000 [<8001e81c>] (v7_dma_clean_range) from [<8001b018>] (dma_cache_maint_page+0xc8/0x22c) [<8001b018>] (dma_cache_maint_page) from [<8001b1a0>] (__dma_page_cpu_to_dev+0x24/0x88) [<8001b1a0>] (__dma_page_cpu_to_dev) from [<8057f1dc>] (ahash_update_first+0x3cc/0x6f4) [<8057f1dc>] (ahash_update_first) from [<8057a9b0>] (ahash_update+0xc/0x10) [<8057a9b0>] (ahash_update) from [<7f000d14>] (test_ahash_cycles+0x70/0x220 [tcrypt]) [<7f000d14>] (test_ahash_cycles [tcrypt]) from [<7f0015ec>] (test_ahash_speed.constprop.1+0x19c/0x25c [tcrypt]) [<7f0015ec>] (test_ahash_speed.constprop.1 [tcrypt]) from [<7f003124>] (do_test+0xff8/0x301c [tcrypt]) [<7f003124>] (do_test [tcrypt]) from [<7f009048>] (tcrypt_mod_init+0x48/0xa0 [tcrypt]) [<7f009048>] (tcrypt_mod_init [tcrypt]) from [<80009704>] (do_one_initcall+0x80/0x1d0) [<80009704>] (do_one_initcall) from [<8008f968>] (do_init_module+0x58/0x1b4) [<8008f968>] (do_init_module) from [<800906fc>] (SyS_finit_module+0x68/0x6c) [<800906fc>] (SyS_finit_module) from [<8000f500>] (ret_fast_syscall+0x0/0x3c) Code: e1a02312 e2423001 e1c00003 f57ff04f (ee070f3a) ---[ end trace 63ad5840e079f2a5 ]--- Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/crypto/caam/caamhash.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c
index b1bbe2bbd222..7fa85c294611 100644
--- a/drivers/crypto/caam/caamhash.c
+++ b/drivers/crypto/caam/caamhash.c
@@ -1360,8 +1360,6 @@ static int ahash_digest(struct ahash_request *req)
}
edesc->sec4_sg = (void *)edesc + sizeof(struct ahash_edesc) +
DESC_JOB_IO_LEN;
- edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg,
- sec4_sg_bytes, DMA_TO_DEVICE);
edesc->sec4_sg_bytes = sec4_sg_bytes;
edesc->src_nents = src_nents;
edesc->chained = chained;
@@ -1386,7 +1384,8 @@ static int ahash_digest(struct ahash_request *req)
}
append_seq_in_ptr(desc, src_dma, req->nbytes, options);
- dma_sync_single_for_device(jrdev, edesc->sec4_sg_dma,
+ if (edesc->sec4_sg_dma)
+ dma_sync_single_for_device(jrdev, edesc->sec4_sg_dma,
edesc->sec4_sg_bytes, DMA_TO_DEVICE);
edesc->dst_dma = map_seq_out_ptr_result(desc, jrdev, req->result,
@@ -1768,7 +1767,8 @@ static int ahash_update_first(struct ahash_request *req)
if (ret)
return ret;
- dma_sync_single_for_device(jrdev, edesc->sec4_sg_dma,
+ if (edesc->sec4_sg_dma)
+ dma_sync_single_for_device(jrdev, edesc->sec4_sg_dma,
sec4_sg_bytes, DMA_TO_DEVICE);
#ifdef DEBUG
print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",