1. 23 Jul, 2014 13 commits
    • Chen Gang's avatar
      crypto: qce - Let 'DEV_QCE' depend on both HAS_DMA and HAS_IOMEM · 71d932d9
      Chen Gang authored
      'DEV_QCE' needs both HAS_DMA and HAS_IOMEM, so let it depend on them.
      
      The related error (with allmodconfig under score):
      
          MODPOST 1365 modules
        ERROR: "devm_ioremap_resource" [drivers/crypto/qce/qcrypto.ko] undefined!
        ERROR: "dma_map_sg" [drivers/crypto/qce/qcrypto.ko] undefined!
        ERROR: "dma_set_mask" [drivers/crypto/qce/qcrypto.ko] undefined!
        ERROR: "dma_supported" [drivers/crypto/qce/qcrypto.ko] undefined!
        ERROR: "dma_unmap_sg" [drivers/crypto/qce/qcrypto.ko] undefined!
      Signed-off-by: default avatarChen Gang <gang.chen.5i5j@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      71d932d9
    • Horia Geanta's avatar
      crypto: caam - set DK (Decrypt Key) bit only for AES accelerator · a60384df
      Horia Geanta authored
      AES currently shares descriptor creation functions with DES and 3DES.
      DK bit is set in all cases, however it is valid only for
      the AES accelerator.
      Signed-off-by: default avatarHoria Geanta <horia.geanta@freescale.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      a60384df
    • Horia Geanta's avatar
      crypto: caam - fix uninitialized state->buf_dma field · de0e35ec
      Horia Geanta authored
      state->buf_dma not being initialized can cause try_buf_map_to_sec4_sg
      to try to free unallocated DMA memory:
      
      caam_jr ffe301000.jr: DMA-API: device driver tries to free DMA memory it has not allocated [device address=0x000000002eb15068] [size=0 bytes]
      WARNING: at lib/dma-debug.c:1080
      Modules linked in: caamhash(+) [last unloaded: caamhash]
      CPU: 0 PID: 1387 Comm: cryptomgr_test Tainted: G        W     3.16.0-rc1 #23
      task: eed24e90 ti: eebd0000 task.ti: eebd0000
      NIP: c02889fc LR: c02889fc CTR: c02d7020
      REGS: eebd1a50 TRAP: 0700   Tainted: G        W      (3.16.0-rc1)
      MSR: 00029002 <CE,EE,ME>  CR: 44042082  XER: 00000000
      
      GPR00: c02889fc eebd1b00 eed24e90 0000008d c1de3478 c1de382c 00000000 00029002
      GPR08: 00000007 00000000 01660000 00000000 24042082 00000000 c07a1900 eeda2a40
      GPR16: 005d62a0 c078ad4c 00000000 eeb15068 c07e1e10 c0da1180 00029002 c0d97408
      GPR24: c62497a0 00000014 eebd1b58 00000000 c078ad4c ee130210 00000000 2eb15068
      NIP [c02889fc] check_unmap+0x8ac/0xab0
      LR [c02889fc] check_unmap+0x8ac/0xab0
      Call Trace:
      [eebd1b00] [c02889fc] check_unmap+0x8ac/0xab0 (unreliable)
      --- Exception: 0 at   (null)
          LR =   (null)
      [eebd1b50] [c0288c78] debug_dma_unmap_page+0x78/0x90 (unreliable)
      [eebd1bd0] [f956f738] ahash_final_ctx+0x6d8/0x7b0 [caamhash]
      [eebd1c30] [c022ff4c] __test_hash+0x2ac/0x6c0
      [eebd1de0] [c0230388] test_hash+0x28/0xb0
      [eebd1e00] [c02304a4] alg_test_hash+0x94/0xc0
      [eebd1e20] [c022fa94] alg_test+0x114/0x2e0
      [eebd1ea0] [c022cd1c] cryptomgr_test+0x4c/0x60
      [eebd1eb0] [c00497a4] kthread+0xc4/0xe0
      [eebd1f40] [c000f2fc] ret_from_kernel_thread+0x5c/0x64
      Instruction dump:
      41de01c8 80a9002c 2f850000 40fe0008 80a90008 80fa0018 3c60c06d 811a001c
      3863f4a4 813a0020 815a0024 4830cd01 <0fe00000> 81340048 2f890000 40feff48
      Signed-off-by: default avatarHoria Geanta <horia.geanta@freescale.com>
      Acked-by: default avatarKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      de0e35ec
    • Horia Geanta's avatar
      crypto: caam - fix uninitialized edesc->dst_dma field · 76b99080
      Horia Geanta authored
      dst_dma not being properly initialized causes ahash_done_ctx_dst
      to try to free unallocated DMA memory:
      
      caam_jr ffe301000.jr: DMA-API: device driver tries to free DMA memory it has not allocated [device address=0x0000000006513340] [size=28 bytes]
      WARNING: at lib/dma-debug.c:1080
      Modules linked in: caamhash(+) [last unloaded: caamhash]
      CPU: 0 PID: 1373 Comm: cryptomgr_test Tainted: G        W     3.16.0-rc1 #23
      task: ee23e350 ti: effd2000 task.ti: ee1f6000
      NIP: c02889fc LR: c02889fc CTR: c02d7020
      REGS: effd3d50 TRAP: 0700   Tainted: G        W      (3.16.0-rc1)
      MSR: 00029002 <CE,EE,ME>  CR: 44048082  XER: 00000000
      
      GPR00: c02889fc effd3e00 ee23e350 0000008e c1de3478 c1de382c 00000000 00029002
      GPR08: 00000007 00000000 01660000 00000000 24048082 00000000 00000018 c07db080
      GPR16: 00000006 00000100 0000002c eeb4a7e0 c07e1e10 c0da1180 00029002 c0d9b3c8
      GPR24: eeb4a7c0 00000000 effd3e58 00000000 c078ad4c ee130210 00000000 06513340
      NIP [c02889fc] check_unmap+0x8ac/0xab0
      LR [c02889fc] check_unmap+0x8ac/0xab0
      Call Trace:
      [effd3e00] [c02889fc] check_unmap+0x8ac/0xab0 (unreliable)
      [effd3e50] [c0288c78] debug_dma_unmap_page+0x78/0x90
      [effd3ed0] [f94b89ec] ahash_done_ctx_dst+0x11c/0x200 [caamhash]
      [effd3f00] [c0429640] caam_jr_dequeue+0x1c0/0x280
      [effd3f50] [c002c94c] tasklet_action+0xcc/0x1a0
      [effd3f80] [c002cb30] __do_softirq+0x110/0x220
      [effd3fe0] [c002cf34] irq_exit+0xa4/0xe0
      [effd3ff0] [c000d834] call_do_irq+0x24/0x3c
      [ee1f7ae0] [c000489c] do_IRQ+0x8c/0x110
      [ee1f7b00] [c000f86c] ret_from_except+0x0/0x18
      --- Exception: 501 at _raw_spin_unlock_irq+0x30/0x50
          LR = _raw_spin_unlock_irq+0x2c/0x50
      [ee1f7bd0] [c0590158] wait_for_common+0xb8/0x170
      [ee1f7c10] [c059024c] wait_for_completion_interruptible+0x1c/0x40
      [ee1f7c20] [c022fc78] do_one_async_hash_op.isra.2.part.3+0x18/0x40
      [ee1f7c30] [c022ffb8] __test_hash+0x318/0x6c0
      [ee1f7de0] [c0230388] test_hash+0x28/0xb0
      [ee1f7e00] [c02304a4] alg_test_hash+0x94/0xc0
      [ee1f7e20] [c022fa94] alg_test+0x114/0x2e0
      [ee1f7ea0] [c022cd1c] cryptomgr_test+0x4c/0x60
      [ee1f7eb0] [c00497a4] kthread+0xc4/0xe0
      [ee1f7f40] [c000f2fc] ret_from_kernel_thread+0x5c/0x64
      Instruction dump:
      41de01c8 80a9002c 2f850000 40fe0008 80a90008 80fa0018 3c60c06d 811a001c
      3863f4a4 813a0020 815a0024 4830cd01 <0fe00000> 81340048 2f890000 40feff48
      Signed-off-by: default avatarHoria Geanta <horia.geanta@freescale.com>
      Acked-by: default avatarKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      76b99080
    • Horia Geanta's avatar
      crypto: caam - fix uninitialized S/G table size in ahash_digest · 45e9af78
      Horia Geanta authored
      Not initializing edesc->sec4_sg_bytes correctly causes ahash_done
      callback to free unallocated DMA memory:
      
      caam_jr ffe301000.jr: DMA-API: device driver tries to free DMA memory it has not allocated [device address=0x300900000000b44d] [size=46158 bytes]
      WARNING: at lib/dma-debug.c:1080
      Modules linked in: caamhash(+) [last unloaded: caamhash]
      CPU: 0 PID: 1358 Comm: cryptomgr_test Tainted: G        W     3.16.0-rc1 #23
      task: eed04250 ti: effd2000 task.ti: c6046000
      NIP: c02889fc LR: c02889fc CTR: c02d7020
      REGS: effd3d50 TRAP: 0700   Tainted: G        W      (3.16.0-rc1)
      MSR: 00029002 <CE,EE,ME>  CR: 44048082  XER: 00000000
      
      GPR00: c02889fc effd3e00 eed04250 00000091 c1de3478 c1de382c 00000000 00029002
      GPR08: 00000007 00000000 01660000 00000000 22048082 00000000 00000018 c07db080
      GPR16: 00000006 00000100 0000002c ee2497e0 c07e1e10 c0da1180 00029002 c0d912c8
      GPR24: 00000014 ee2497c0 effd3e58 00000000 c078ad4c ee130210 30090000 0000b44d
      NIP [c02889fc] check_unmap+0x8ac/0xab0
      LR [c02889fc] check_unmap+0x8ac/0xab0
      Call Trace:
      [effd3e00] [c02889fc] check_unmap+0x8ac/0xab0 (unreliable)
      [effd3e50] [c0288c78] debug_dma_unmap_page+0x78/0x90
      [effd3ed0] [f9404fec] ahash_done+0x11c/0x190 [caamhash]
      [effd3f00] [c0429640] caam_jr_dequeue+0x1c0/0x280
      [effd3f50] [c002c94c] tasklet_action+0xcc/0x1a0
      [effd3f80] [c002cb30] __do_softirq+0x110/0x220
      [effd3fe0] [c002cf34] irq_exit+0xa4/0xe0
      [effd3ff0] [c000d834] call_do_irq+0x24/0x3c
      [c6047ae0] [c000489c] do_IRQ+0x8c/0x110
      [c6047b00] [c000f86c] ret_from_except+0x0/0x18
      --- Exception: 501 at _raw_spin_unlock_irq+0x30/0x50
          LR = _raw_spin_unlock_irq+0x2c/0x50
      [c6047bd0] [c0590158] wait_for_common+0xb8/0x170
      [c6047c10] [c059024c] wait_for_completion_interruptible+0x1c/0x40
      [c6047c20] [c022fc78] do_one_async_hash_op.isra.2.part.3+0x18/0x40
      [c6047c30] [c022ff98] __test_hash+0x2f8/0x6c0
      [c6047de0] [c0230388] test_hash+0x28/0xb0
      [c6047e00] [c0230458] alg_test_hash+0x48/0xc0
      [c6047e20] [c022fa94] alg_test+0x114/0x2e0
      [c6047ea0] [c022cd1c] cryptomgr_test+0x4c/0x60
      [c6047eb0] [c00497a4] kthread+0xc4/0xe0
      [c6047f40] [c000f2fc] ret_from_kernel_thread+0x5c/0x64
      Instruction dump:
      41de01c8 80a9002c 2f850000 40fe0008 80a90008 80fa0018 3c60c06d 811a001c
      3863f4a4 813a0020 815a0024 4830cd01 <0fe00000> 81340048 2f890000 40feff48
      Signed-off-by: default avatarHoria Geanta <horia.geanta@freescale.com>
      Acked-by: default avatarKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      45e9af78
    • Horia Geanta's avatar
      crypto: caam - fix DMA direction mismatch in ahash_done_ctx_src · bc9e05f9
      Horia Geanta authored
      caam_jr ffe301000.jr: DMA-API: device driver frees DMA memory with different direction [device address=0x0000000006271dac] [size=28 bytes] [mapped with DMA_TO_DEVICE] [unmapped with DMA_FROM_DEVICE]
      ------------[ cut here ]------------
      WARNING: at lib/dma-debug.c:1131
      Modules linked in: caamhash(+) [last unloaded: caamhash]
      CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W     3.16.0-rc1 #23
      task: c0789380 ti: effd2000 task.ti: c07d6000
      NIP: c02885cc LR: c02885cc CTR: c02d7020
      REGS: effd3d50 TRAP: 0700   Tainted: G        W      (3.16.0-rc1)
      MSR: 00021002 <CE,ME>  CR: 44048082  XER: 00000000
      
      GPR00: c02885cc effd3e00 c0789380 000000c6 c1de3478 c1de382c 00000000 00021002
      GPR08: 00000007 00000000 01660000 0000012f 84048082 00000000 00000018 c07db080
      GPR16: 00000006 00000100 0000002c c62517a0 c07e1e10 c0da1180 00029002 c0d95f88
      GPR24: c07a0000 c07a4acc effd3e58 ee322bc0 0000001c ee130210 00000000 c0d95f80
      NIP [c02885cc] check_unmap+0x47c/0xab0
      LR [c02885cc] check_unmap+0x47c/0xab0
      Call Trace:
      [effd3e00] [c02885cc] check_unmap+0x47c/0xab0 (unreliable)
      [effd3e50] [c0288c78] debug_dma_unmap_page+0x78/0x90
      [effd3ed0] [f9624d84] ahash_done_ctx_src+0xa4/0x200 [caamhash]
      [effd3f00] [c0429640] caam_jr_dequeue+0x1c0/0x280
      [effd3f50] [c002c94c] tasklet_action+0xcc/0x1a0
      [effd3f80] [c002cb30] __do_softirq+0x110/0x220
      [effd3fe0] [c002cf34] irq_exit+0xa4/0xe0
      [effd3ff0] [c000d834] call_do_irq+0x24/0x3c
      [c07d7d50] [c000489c] do_IRQ+0x8c/0x110
      [c07d7d70] [c000f86c] ret_from_except+0x0/0x18
      --- Exception: 501 at _raw_spin_unlock_irq+0x30/0x50
          LR = _raw_spin_unlock_irq+0x2c/0x50
      [c07d7e40] [c0053084] finish_task_switch+0x74/0x130
      [c07d7e60] [c058f278] __schedule+0x238/0x620
      [c07d7f70] [c058fb50] schedule_preempt_disabled+0x10/0x20
      [c07d7f80] [c00686a0] cpu_startup_entry+0x100/0x1b0
      [c07d7fb0] [c074793c] start_kernel+0x338/0x34c
      [c07d7ff0] [c00003d8] set_ivor+0x140/0x17c
      Instruction dump:
      7d495214 7d294214 806a0010 80c90010 811a001c 813a0020 815a0024 90610008
      3c60c06d 90c1000c 3863f764 4830d131 <0fe00000> 3c60c06d 3863f0f4 4830d121
      ---[ end trace db1fae088c75c280 ]---
      Mapped at:
       [<f96251bc>] ahash_final_ctx+0x14c/0x7b0 [caamhash]
       [<c022ff4c>] __test_hash+0x2ac/0x6c0
       [<c0230388>] test_hash+0x28/0xb0
       [<c02304a4>] alg_test_hash+0x94/0xc0
       [<c022fa94>] alg_test+0x114/0x2e0
      Signed-off-by: default avatarHoria Geanta <horia.geanta@freescale.com>
      Acked-by: default avatarKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      bc9e05f9
    • Horia Geanta's avatar
      crypto: caam - fix DMA direction mismatch in ahash_done_ctx_dst · ef62b231
      Horia Geanta authored
      caam_jr ffe301000.jr: DMA-API: device driver frees DMA memory with different direction [device address=0x00000000062ad1ac] [size=28 bytes] [mapped with DMA_FROM_DEVICE] [unmapped with DMA_TO_DEVICE]
      ------------[ cut here ]------------
      WARNING: at lib/dma-debug.c:1131
      Modules linked in: caamhash(+) [last unloaded: caamhash]
      CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W     3.16.0-rc1 #23
      task: c0789380 ti: effd2000 task.ti: c07d6000
      NIP: c02885cc LR: c02885cc CTR: c02d7020
      REGS: effd3d50 TRAP: 0700   Tainted: G        W      (3.16.0-rc1)
      MSR: 00021002 <CE,ME>  CR: 44048082  XER: 00000000
      
      GPR00: c02885cc effd3e00 c0789380 000000c6 c1de3478 c1de382c 00000000 00021002
      GPR08: 00000007 00000000 01660000 0000012f 84048082 00000000 00000018 c07db080
      GPR16: 00000006 00000100 0000002c eee567e0 c07e1e10 c0da1180 00029002 c0d96708
      GPR24: c07a0000 c07a4acc effd3e58 ee29b140 0000001c ee130210 00000000 c0d96700
      NIP [c02885cc] check_unmap+0x47c/0xab0
      LR [c02885cc] check_unmap+0x47c/0xab0
      Call Trace:
      [effd3e00] [c02885cc] check_unmap+0x47c/0xab0 (unreliable)
      [effd3e50] [c0288c78] debug_dma_unmap_page+0x78/0x90
      [effd3ed0] [f9350974] ahash_done_ctx_dst+0xa4/0x200 [caamhash]
      [effd3f00] [c0429640] caam_jr_dequeue+0x1c0/0x280
      [effd3f50] [c002c94c] tasklet_action+0xcc/0x1a0
      [effd3f80] [c002cb30] __do_softirq+0x110/0x220
      [effd3fe0] [c002cf34] irq_exit+0xa4/0xe0
      [effd3ff0] [c000d834] call_do_irq+0x24/0x3c
      [c07d7d50] [c000489c] do_IRQ+0x8c/0x110
      [c07d7d70] [c000f86c] ret_from_except+0x0/0x18
      --- Exception: 501 at _raw_spin_unlock_irq+0x30/0x50
          LR = _raw_spin_unlock_irq+0x2c/0x50
      [c07d7e40] [c0053084] finish_task_switch+0x74/0x130
      [c07d7e60] [c058f278] __schedule+0x238/0x620
      [c07d7f70] [c058fb50] schedule_preempt_disabled+0x10/0x20
      [c07d7f80] [c00686a0] cpu_startup_entry+0x100/0x1b0
      [c07d7fb0] [c074793c] start_kernel+0x338/0x34c
      [c07d7ff0] [c00003d8] set_ivor+0x140/0x17c
      Instruction dump:
      7d495214 7d294214 806a0010 80c90010 811a001c 813a0020 815a0024 90610008
      3c60c06d 90c1000c 3863f764 4830d131 <0fe00000> 3c60c06d 3863f0f4 4830d121
      ---[ end trace db1fae088c75c270 ]---
      Mapped at:
       [<f9352454>] ahash_update_first+0x5b4/0xba0 [caamhash]
       [<c022ff28>] __test_hash+0x288/0x6c0
       [<c0230388>] test_hash+0x28/0xb0
       [<c02304a4>] alg_test_hash+0x94/0xc0
       [<c022fa94>] alg_test+0x114/0x2e0
      Signed-off-by: default avatarHoria Geanta <horia.geanta@freescale.com>
      Acked-by: default avatarKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      ef62b231
    • Horia Geanta's avatar
      crypto: caam - fix DMA unmapping error in hash_digest_key · e11aa9f1
      Horia Geanta authored
      Key being hashed is unmapped using the digest size instead of
      initial length:
      
      caam_jr ffe301000.jr: DMA-API: device driver frees DMA memory with different size [device address=0x000000002eeedac0] [map size=80 bytes] [unmap size=20 bytes]
      ------------[ cut here ]------------
      WARNING: at lib/dma-debug.c:1090
      Modules linked in: caamhash(+)
      CPU: 0 PID: 1327 Comm: cryptomgr_test Not tainted 3.16.0-rc1 #23
      task: eebda5d0 ti: ee26a000 task.ti: ee26a000
      NIP: c0288790 LR: c0288790 CTR: c02d7020
      REGS: ee26ba30 TRAP: 0700   Not tainted  (3.16.0-rc1)
      MSR: 00021002 <CE,ME>  CR: 44022082  XER: 00000000
      
      GPR00: c0288790 ee26bae0 eebda5d0 0000009f c1de3478 c1de382c 00000000 00021002
      GPR08: 00000007 00000000 01660000 0000012f 82022082 00000000 c07a1900 eeda29c0
      GPR16: 00000000 c61deea0 000c49a0 00000260 c07e1e10 c0da1180 00029002 c0d9ef08
      GPR24: c07a0000 c07a4acc ee26bb38 ee2765c0 00000014 ee130210 00000000 00000014
      NIP [c0288790] check_unmap+0x640/0xab0
      LR [c0288790] check_unmap+0x640/0xab0
      Call Trace:
      [ee26bae0] [c0288790] check_unmap+0x640/0xab0 (unreliable)
      [ee26bb30] [c0288c78] debug_dma_unmap_page+0x78/0x90
      [ee26bbb0] [f929c3d4] ahash_setkey+0x374/0x720 [caamhash]
      [ee26bc30] [c022fec8] __test_hash+0x228/0x6c0
      [ee26bde0] [c0230388] test_hash+0x28/0xb0
      [ee26be00] [c0230458] alg_test_hash+0x48/0xc0
      [ee26be20] [c022fa94] alg_test+0x114/0x2e0
      [ee26bea0] [c022cd1c] cryptomgr_test+0x4c/0x60
      [ee26beb0] [c00497a4] kthread+0xc4/0xe0
      [ee26bf40] [c000f2fc] ret_from_kernel_thread+0x5c/0x64
      Instruction dump:
      41de03e8 83da0020 3c60c06d 83fa0024 3863f520 813b0020 815b0024 80fa0018
      811a001c 93c10008 93e1000c 4830cf6d <0fe00000> 3c60c06d 3863f0f4 4830cf5d
      ---[ end trace db1fae088c75c26c ]---
      Mapped at:
       [<f929c15c>] ahash_setkey+0xfc/0x720 [caamhash]
       [<c022fec8>] __test_hash+0x228/0x6c0
       [<c0230388>] test_hash+0x28/0xb0
       [<c0230458>] alg_test_hash+0x48/0xc0
       [<c022fa94>] alg_test+0x114/0x2e0
      Signed-off-by: default avatarHoria Geanta <horia.geanta@freescale.com>
      Acked-by: default avatarKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      e11aa9f1
    • Horia Geanta's avatar
      crypto: caam - fix "failed to check map error" DMA warnings · ce572085
      Horia Geanta authored
      Use dma_mapping_error for every dma_map_single / dma_map_page.
      Signed-off-by: default avatarHoria Geanta <horia.geanta@freescale.com>
      Acked-by: default avatarKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      ce572085
    • Horia Geanta's avatar
      crypto: caam - fix typo in dma_mapping_error · 71c65f7c
      Horia Geanta authored
      dma_mapping_error checks for an incorrect DMA address:
      s/ctx->sh_desc_enc_dma/ctx->sh_desc_dec_dma
      Signed-off-by: default avatarHoria Geanta <horia.geanta@freescale.com>
      Acked-by: default avatarKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      71c65f7c
    • Horia Geanta's avatar
      crypto: caam - set coherent_dma_mask · a2ac287e
      Horia Geanta authored
      Replace dma_set_mask with dma_set_mask_and_coherent, since both
      streaming and coherent DMA mappings are being used.
      Signed-off-by: default avatarHoria Geanta <horia.geanta@freescale.com>
      Acked-by: default avatarKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      a2ac287e
    • Horia Geanta's avatar
      crypto: testmgr - avoid DMA mapping from text, rodata, stack · 29b77e5d
      Horia Geanta authored
      With DMA_API_DEBUG set, following warnings are emitted
      (tested on CAAM accelerator):
      DMA-API: device driver maps memory from kernel text or rodata
      DMA-API: device driver maps memory from stack
      and the culprits are:
      -key in __test_aead and __test_hash
      -result in __test_hash
      
      MAX_KEYLEN is changed to accommodate maximum key length from
      existing test vectors in crypto/testmgr.h (131 bytes) and rounded.
      Signed-off-by: default avatarHoria Geanta <horia.geanta@freescale.com>
      Acked-by: default avatarKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      29b77e5d
    • Tom Lendacky's avatar
      crypto: ccp - Base AXI DMA cache settings on device tree · 126ae9ad
      Tom Lendacky authored
      The default cache operations for ARM64 were changed during 3.15.
      To use coherent operations a "dma-coherent" device tree property
      is required.  If that property is not present in the device tree
      node then the non-coherent operations are assigned for the device.
      
      Add support to the ccp driver to assign the AXI DMA cache settings
      based on whether the "dma-coherent" property is present in the device
      node.  If present, use settings that work with the caches.  If not
      present, use settings that do not look at the caches.
      Signed-off-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      126ae9ad
  2. 10 Jul, 2014 3 commits
  3. 08 Jul, 2014 10 commits
  4. 04 Jul, 2014 3 commits
  5. 03 Jul, 2014 6 commits
    • Arnd Bergmann's avatar
      crypto: ux500 - make interrupt mode plausible · e1f8859e
      Arnd Bergmann authored
      The interrupt handler in the ux500 crypto driver has an obviously
      incorrect way to access the data buffer, which for a while has
      caused this build warning:
      
      ../ux500/cryp/cryp_core.c: In function 'cryp_interrupt_handler':
      ../ux500/cryp/cryp_core.c:234:5: warning: passing argument 1 of '__fswab32' makes integer from pointer without a cast [enabled by default]
           writel_relaxed(ctx->indata,
           ^
      In file included from ../include/linux/swab.h:4:0,
                       from ../include/uapi/linux/byteorder/big_endian.h:12,
                       from ../include/linux/byteorder/big_endian.h:4,
                       from ../arch/arm/include/uapi/asm/byteorder.h:19,
                       from ../include/asm-generic/bitops/le.h:5,
                       from ../arch/arm/include/asm/bitops.h:340,
                       from ../include/linux/bitops.h:33,
                       from ../include/linux/kernel.h:10,
                       from ../include/linux/clk.h:16,
                       from ../drivers/crypto/ux500/cryp/cryp_core.c:12:
      ../include/uapi/linux/swab.h:57:119: note: expected '__u32' but argument is of type 'const u8 *'
       static inline __attribute_const__ __u32 __fswab32(__u32 val)
      
      There are at least two, possibly three problems here:
      a) when writing into the FIFO, we copy the pointer rather than the
         actual data we want to give to the hardware
      b) the data pointer is an array of 8-bit values, while the FIFO
         is 32-bit wide, so both the read and write access fail to do
         a proper type conversion
      c) This seems incorrect for big-endian kernels, on which we need to
         byte-swap any register access, but not normally FIFO accesses,
         at least the DMA case doesn't do it either.
      
      This converts the bogus loop to use the same readsl/writesl pair
      that we use for the two other modes (DMA and polling). This is
      more efficient and consistent, and probably correct for endianess.
      
      The bug has existed since the driver was first merged, and was
      probably never detected because nobody tried to use interrupt mode.
      It might make sense to backport this fix to stable kernels, depending
      on how the crypto maintainers feel about that.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: linux-crypto@vger.kernel.org
      Cc: Fabio Baltieri <fabio.baltieri@linaro.org>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      e1f8859e
    • Luca Clementi's avatar
      crypto: tcrypt - print cra driver name in tcrypt tests output · 263a8df0
      Luca Clementi authored
      Print the driver name that is being tested. The driver name can be
      inferred parsing /proc/crypto but having it in the output is
      clearer
      Signed-off-by: default avatarLuca Clementi <luca.clementi@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      263a8df0
    • Stanimir Varbanov's avatar
      ARM: DT: qcom: Add Qualcomm crypto driver binding document · 14748d7c
      Stanimir Varbanov authored
      Here is Qualcomm crypto driver device tree binding documentation
      to used as a reference example.
      Signed-off-by: default avatarStanimir Varbanov <svarbanov@mm-sol.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      14748d7c
    • Stanimir Varbanov's avatar
      crypto: qce - Build Qualcomm crypto driver · c672752d
      Stanimir Varbanov authored
      Modify crypto Kconfig and Makefile in order to build the qce
      driver and adds qce Makefile as well.
      Signed-off-by: default avatarStanimir Varbanov <svarbanov@mm-sol.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      c672752d
    • Stanimir Varbanov's avatar
      crypto: qce - Qualcomm crypto engine driver · ec8f5d8f
      Stanimir Varbanov authored
      The driver is separated by functional parts. The core part
      implements a platform driver probe and remove callbaks.
      The probe enables clocks, checks crypto version, initialize
      and request dma channels, create done tasklet and init
      crypto queue and finally register the algorithms into crypto
      core subsystem.
      
      - DMA and SG helper functions
       implement dmaengine and sg-list helper functions used by
       other parts of the crypto driver.
      
      - ablkcipher algorithms
       implementation of AES, DES and 3DES crypto API callbacks,
       the crypto register alg function, the async request handler
       and its dma done callback function.
      
      - SHA and HMAC transforms
       implementation and registration of ahash crypto type.
       It includes sha1, sha256, hmac(sha1) and hmac(sha256).
      
      - infrastructure to setup the crypto hw
       contains functions used to setup/prepare hardware registers for
       all algorithms supported by the crypto block. It also exports
       few helper functions needed by algorithms:
      	- to check hardware status
      	- to start crypto hardware
      	- to translate data stream to big endian form
      
       Adds register addresses and bit/masks used by the driver
       as well.
      Signed-off-by: default avatarStanimir Varbanov <svarbanov@mm-sol.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      ec8f5d8f
    • Jarod Wilson's avatar
      crypto: fips - only panic on bad/missing crypto mod signatures · 002c77a4
      Jarod Wilson authored
      Per further discussion with NIST, the requirements for FIPS state that
      we only need to panic the system on failed kernel module signature checks
      for crypto subsystem modules. This moves the fips-mode-only module
      signature check out of the generic module loading code, into the crypto
      subsystem, at points where we can catch both algorithm module loads and
      mode module loads. At the same time, make CONFIG_CRYPTO_FIPS dependent on
      CONFIG_MODULE_SIG, as this is entirely necessary for FIPS mode.
      
      v2: remove extraneous blank line, perform checks in static inline
      function, drop no longer necessary fips.h include.
      
      CC: "David S. Miller" <davem@davemloft.net>
      CC: Rusty Russell <rusty@rustcorp.com.au>
      CC: Stephan Mueller <stephan.mueller@atsec.com>
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      002c77a4
  6. 26 Jun, 2014 5 commits