aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2015-10-18 13:31:15 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2015-10-20 10:13:57 -0400
commit0f3304dc18b1316bc6d32921f2a7837938f90c30 (patch)
tree3e08a093264b34eaebe3801cd201f58c2c7e4c40
parent35622eae188761f30df916a6cae4fa8c942a6366 (diff)
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: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/crypto/marvell/cipher.c11
-rw-r--r--drivers/crypto/marvell/hash.c16
2 files changed, 14 insertions, 13 deletions
diff --git a/drivers/crypto/marvell/cipher.c b/drivers/crypto/marvell/cipher.c
index 06dee02460f8..2864d1e6ce28 100644
--- a/drivers/crypto/marvell/cipher.c
+++ b/drivers/crypto/marvell/cipher.c
@@ -98,10 +98,10 @@ static void mv_cesa_ablkcipher_std_step(struct ablkcipher_request *req)
98 98
99 /* FIXME: only update enc_len field */ 99 /* FIXME: only update enc_len field */
100 if (!sreq->skip_ctx) { 100 if (!sreq->skip_ctx) {
101 memcpy(engine->sram, &sreq->op, sizeof(sreq->op)); 101 memcpy_toio(engine->sram, &sreq->op, sizeof(sreq->op));
102 sreq->skip_ctx = true; 102 sreq->skip_ctx = true;
103 } else { 103 } else {
104 memcpy(engine->sram, &sreq->op, sizeof(sreq->op.desc)); 104 memcpy_toio(engine->sram, &sreq->op, sizeof(sreq->op.desc));
105 } 105 }
106 106
107 mv_cesa_set_int_mask(engine, CESA_SA_INT_ACCEL0_DONE); 107 mv_cesa_set_int_mask(engine, CESA_SA_INT_ACCEL0_DONE);
@@ -145,8 +145,9 @@ static int mv_cesa_ablkcipher_process(struct crypto_async_request *req,
145 if (ret) 145 if (ret)
146 return ret; 146 return ret;
147 147
148 memcpy(ablkreq->info, engine->sram + CESA_SA_CRYPT_IV_SRAM_OFFSET, 148 memcpy_fromio(ablkreq->info,
149 crypto_ablkcipher_ivsize(crypto_ablkcipher_reqtfm(ablkreq))); 149 engine->sram + CESA_SA_CRYPT_IV_SRAM_OFFSET,
150 crypto_ablkcipher_ivsize(crypto_ablkcipher_reqtfm(ablkreq)));
150 151
151 return 0; 152 return 0;
152} 153}
@@ -181,7 +182,7 @@ mv_cesa_ablkcipher_std_prepare(struct ablkcipher_request *req)
181 sreq->size = 0; 182 sreq->size = 0;
182 sreq->offset = 0; 183 sreq->offset = 0;
183 mv_cesa_adjust_op(engine, &sreq->op); 184 mv_cesa_adjust_op(engine, &sreq->op);
184 memcpy(engine->sram, &sreq->op, sizeof(sreq->op)); 185 memcpy_toio(engine->sram, &sreq->op, sizeof(sreq->op));
185} 186}
186 187
187static inline void mv_cesa_ablkcipher_prepare(struct crypto_async_request *req, 188static inline void mv_cesa_ablkcipher_prepare(struct crypto_async_request *req,
diff --git a/drivers/crypto/marvell/hash.c b/drivers/crypto/marvell/hash.c
index a9bea0ba95fb..a70193ede02d 100644
--- a/drivers/crypto/marvell/hash.c
+++ b/drivers/crypto/marvell/hash.c
@@ -209,8 +209,8 @@ static void mv_cesa_ahash_std_step(struct ahash_request *req)
209 size_t len; 209 size_t len;
210 210
211 if (creq->cache_ptr) 211 if (creq->cache_ptr)
212 memcpy(engine->sram + CESA_SA_DATA_SRAM_OFFSET, creq->cache, 212 memcpy_toio(engine->sram + CESA_SA_DATA_SRAM_OFFSET,
213 creq->cache_ptr); 213 creq->cache, creq->cache_ptr);
214 214
215 len = min_t(size_t, req->nbytes + creq->cache_ptr - sreq->offset, 215 len = min_t(size_t, req->nbytes + creq->cache_ptr - sreq->offset,
216 CESA_SA_SRAM_PAYLOAD_SIZE); 216 CESA_SA_SRAM_PAYLOAD_SIZE);
@@ -251,10 +251,10 @@ static void mv_cesa_ahash_std_step(struct ahash_request *req)
251 if (len + trailerlen > CESA_SA_SRAM_PAYLOAD_SIZE) { 251 if (len + trailerlen > CESA_SA_SRAM_PAYLOAD_SIZE) {
252 len &= CESA_HASH_BLOCK_SIZE_MSK; 252 len &= CESA_HASH_BLOCK_SIZE_MSK;
253 new_cache_ptr = 64 - trailerlen; 253 new_cache_ptr = 64 - trailerlen;
254 memcpy(creq->cache, 254 memcpy_fromio(creq->cache,
255 engine->sram + 255 engine->sram +
256 CESA_SA_DATA_SRAM_OFFSET + len, 256 CESA_SA_DATA_SRAM_OFFSET + len,
257 new_cache_ptr); 257 new_cache_ptr);
258 } else { 258 } else {
259 len += mv_cesa_ahash_pad_req(creq, 259 len += mv_cesa_ahash_pad_req(creq,
260 engine->sram + len + 260 engine->sram + len +
@@ -272,7 +272,7 @@ static void mv_cesa_ahash_std_step(struct ahash_request *req)
272 mv_cesa_update_op_cfg(op, frag_mode, CESA_SA_DESC_CFG_FRAG_MSK); 272 mv_cesa_update_op_cfg(op, frag_mode, CESA_SA_DESC_CFG_FRAG_MSK);
273 273
274 /* FIXME: only update enc_len field */ 274 /* FIXME: only update enc_len field */
275 memcpy(engine->sram, op, sizeof(*op)); 275 memcpy_toio(engine->sram, op, sizeof(*op));
276 276
277 if (frag_mode == CESA_SA_DESC_CFG_FIRST_FRAG) 277 if (frag_mode == CESA_SA_DESC_CFG_FIRST_FRAG)
278 mv_cesa_update_op_cfg(op, CESA_SA_DESC_CFG_MID_FRAG, 278 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 312
313 sreq->offset = 0; 313 sreq->offset = 0;
314 mv_cesa_adjust_op(engine, &creq->op_tmpl); 314 mv_cesa_adjust_op(engine, &creq->op_tmpl);
315 memcpy(engine->sram, &creq->op_tmpl, sizeof(creq->op_tmpl)); 315 memcpy_toio(engine->sram, &creq->op_tmpl, sizeof(creq->op_tmpl));
316} 316}
317 317
318static void mv_cesa_ahash_step(struct crypto_async_request *req) 318static void mv_cesa_ahash_step(struct crypto_async_request *req)