Commit 0f3304dc authored by Russell King's avatar Russell King Committed by Herbert Xu

crypto: marvell/cesa - use memcpy_fromio()/memcpy_toio()

Use the IO memcpy() functions when copying from/to MMIO memory.
These locations were found via sparse.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 35622eae
...@@ -98,10 +98,10 @@ static void mv_cesa_ablkcipher_std_step(struct ablkcipher_request *req) ...@@ -98,10 +98,10 @@ static void mv_cesa_ablkcipher_std_step(struct ablkcipher_request *req)
/* FIXME: only update enc_len field */ /* FIXME: only update enc_len field */
if (!sreq->skip_ctx) { if (!sreq->skip_ctx) {
memcpy(engine->sram, &sreq->op, sizeof(sreq->op)); memcpy_toio(engine->sram, &sreq->op, sizeof(sreq->op));
sreq->skip_ctx = true; sreq->skip_ctx = true;
} else { } else {
memcpy(engine->sram, &sreq->op, sizeof(sreq->op.desc)); memcpy_toio(engine->sram, &sreq->op, sizeof(sreq->op.desc));
} }
mv_cesa_set_int_mask(engine, CESA_SA_INT_ACCEL0_DONE); mv_cesa_set_int_mask(engine, CESA_SA_INT_ACCEL0_DONE);
...@@ -145,7 +145,8 @@ static int mv_cesa_ablkcipher_process(struct crypto_async_request *req, ...@@ -145,7 +145,8 @@ static int mv_cesa_ablkcipher_process(struct crypto_async_request *req,
if (ret) if (ret)
return ret; return ret;
memcpy(ablkreq->info, engine->sram + CESA_SA_CRYPT_IV_SRAM_OFFSET, memcpy_fromio(ablkreq->info,
engine->sram + CESA_SA_CRYPT_IV_SRAM_OFFSET,
crypto_ablkcipher_ivsize(crypto_ablkcipher_reqtfm(ablkreq))); crypto_ablkcipher_ivsize(crypto_ablkcipher_reqtfm(ablkreq)));
return 0; return 0;
...@@ -181,7 +182,7 @@ mv_cesa_ablkcipher_std_prepare(struct ablkcipher_request *req) ...@@ -181,7 +182,7 @@ mv_cesa_ablkcipher_std_prepare(struct ablkcipher_request *req)
sreq->size = 0; sreq->size = 0;
sreq->offset = 0; sreq->offset = 0;
mv_cesa_adjust_op(engine, &sreq->op); mv_cesa_adjust_op(engine, &sreq->op);
memcpy(engine->sram, &sreq->op, sizeof(sreq->op)); memcpy_toio(engine->sram, &sreq->op, sizeof(sreq->op));
} }
static inline void mv_cesa_ablkcipher_prepare(struct crypto_async_request *req, static inline void mv_cesa_ablkcipher_prepare(struct crypto_async_request *req,
......
...@@ -209,8 +209,8 @@ static void mv_cesa_ahash_std_step(struct ahash_request *req) ...@@ -209,8 +209,8 @@ static void mv_cesa_ahash_std_step(struct ahash_request *req)
size_t len; size_t len;
if (creq->cache_ptr) if (creq->cache_ptr)
memcpy(engine->sram + CESA_SA_DATA_SRAM_OFFSET, creq->cache, memcpy_toio(engine->sram + CESA_SA_DATA_SRAM_OFFSET,
creq->cache_ptr); creq->cache, creq->cache_ptr);
len = min_t(size_t, req->nbytes + creq->cache_ptr - sreq->offset, len = min_t(size_t, req->nbytes + creq->cache_ptr - sreq->offset,
CESA_SA_SRAM_PAYLOAD_SIZE); CESA_SA_SRAM_PAYLOAD_SIZE);
...@@ -251,7 +251,7 @@ static void mv_cesa_ahash_std_step(struct ahash_request *req) ...@@ -251,7 +251,7 @@ static void mv_cesa_ahash_std_step(struct ahash_request *req)
if (len + trailerlen > CESA_SA_SRAM_PAYLOAD_SIZE) { if (len + trailerlen > CESA_SA_SRAM_PAYLOAD_SIZE) {
len &= CESA_HASH_BLOCK_SIZE_MSK; len &= CESA_HASH_BLOCK_SIZE_MSK;
new_cache_ptr = 64 - trailerlen; new_cache_ptr = 64 - trailerlen;
memcpy(creq->cache, memcpy_fromio(creq->cache,
engine->sram + engine->sram +
CESA_SA_DATA_SRAM_OFFSET + len, CESA_SA_DATA_SRAM_OFFSET + len,
new_cache_ptr); new_cache_ptr);
...@@ -272,7 +272,7 @@ static void mv_cesa_ahash_std_step(struct ahash_request *req) ...@@ -272,7 +272,7 @@ static void mv_cesa_ahash_std_step(struct ahash_request *req)
mv_cesa_update_op_cfg(op, frag_mode, CESA_SA_DESC_CFG_FRAG_MSK); mv_cesa_update_op_cfg(op, frag_mode, CESA_SA_DESC_CFG_FRAG_MSK);
/* FIXME: only update enc_len field */ /* FIXME: only update enc_len field */
memcpy(engine->sram, op, sizeof(*op)); memcpy_toio(engine->sram, op, sizeof(*op));
if (frag_mode == CESA_SA_DESC_CFG_FIRST_FRAG) if (frag_mode == CESA_SA_DESC_CFG_FIRST_FRAG)
mv_cesa_update_op_cfg(op, CESA_SA_DESC_CFG_MID_FRAG, mv_cesa_update_op_cfg(op, CESA_SA_DESC_CFG_MID_FRAG,
...@@ -312,7 +312,7 @@ static void mv_cesa_ahash_std_prepare(struct ahash_request *req) ...@@ -312,7 +312,7 @@ static void mv_cesa_ahash_std_prepare(struct ahash_request *req)
sreq->offset = 0; sreq->offset = 0;
mv_cesa_adjust_op(engine, &creq->op_tmpl); mv_cesa_adjust_op(engine, &creq->op_tmpl);
memcpy(engine->sram, &creq->op_tmpl, sizeof(creq->op_tmpl)); memcpy_toio(engine->sram, &creq->op_tmpl, sizeof(creq->op_tmpl));
} }
static void mv_cesa_ahash_step(struct crypto_async_request *req) static void mv_cesa_ahash_step(struct crypto_async_request *req)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment