1. 23 Jul, 2014 8 commits
    • 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
  7. 25 Jun, 2014 5 commits