crypto: caam - Add cache coherency support
authorVictoria Milhoan <vicki.milhoan@freescale.com>
Wed, 5 Aug 2015 18:28:35 +0000 (11:28 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 10 Aug 2015 15:18:55 +0000 (23:18 +0800)
Freescale i.MX6 ARM platforms do not support hardware cache coherency.
This patch adds cache coherency support to the CAAM driver.

Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
Tested-by: Horia Geantă <horia.geanta@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/caam/caamhash.c
drivers/crypto/caam/caamrng.c
drivers/crypto/caam/jr.c

index dae1e80..9622a81 100644 (file)
@@ -127,7 +127,7 @@ struct caam_hash_state {
        int buflen_0;
        u8 buf_1[CAAM_MAX_HASH_BLOCK_SIZE] ____cacheline_aligned;
        int buflen_1;
-       u8 caam_ctx[MAX_CTX_LEN];
+       u8 caam_ctx[MAX_CTX_LEN] ____cacheline_aligned;
        int (*update)(struct ahash_request *req);
        int (*final)(struct ahash_request *req);
        int (*finup)(struct ahash_request *req);
index 5095337..a1d21d5 100644 (file)
@@ -108,6 +108,10 @@ static void rng_done(struct device *jrdev, u32 *desc, u32 err, void *context)
 
        atomic_set(&bd->empty, BUF_NOT_EMPTY);
        complete(&bd->filled);
+
+       /* Buffer refilled, invalidate cache */
+       dma_sync_single_for_cpu(jrdev, bd->addr, RN_BUF_SIZE, DMA_FROM_DEVICE);
+
 #ifdef DEBUG
        print_hex_dump(KERN_ERR, "rng refreshed buf@: ",
                       DUMP_PREFIX_ADDRESS, 16, 4, bd->buf, RN_BUF_SIZE, 1);
Simple merge