summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/axis
diff options
context:
space:
mode:
authorLars Persson <lars.persson@axis.com>2019-01-23 12:59:43 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2019-02-01 14:42:04 +0800
commit0d1d482416002791a705e7acef55edcd989facd2 (patch)
treea8248c6dce8ce618babf5bac699c965aec363941 /drivers/crypto/axis
parentc34a83820f59bb275e5f2d55cd5ea99c64f6ef23 (diff)
downloadlinux-0d1d482416002791a705e7acef55edcd989facd2.tar.gz
linux-0d1d482416002791a705e7acef55edcd989facd2.tar.bz2
linux-0d1d482416002791a705e7acef55edcd989facd2.zip
crypto: axis - give DMA the start of the status buffer
The driver was optimized to only do cache maintenance for the last word of the dma descriptor status array. Unfortunately an omission also passed the last word as the address of the array start to the DMA engine. In most cases this goes unnoticed since the hardware aligns the address to a 64 byte boundary. Signed-off-by: Lars Persson <larper@axis.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/axis')
-rw-r--r--drivers/crypto/axis/artpec6_crypto.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/crypto/axis/artpec6_crypto.c b/drivers/crypto/axis/artpec6_crypto.c
index da5a73944a78..e8a57b9e1c7a 100644
--- a/drivers/crypto/axis/artpec6_crypto.c
+++ b/drivers/crypto/axis/artpec6_crypto.c
@@ -665,8 +665,8 @@ artpec6_crypto_dma_map_descs(struct artpec6_crypto_req_common *common)
* to be written.
*/
return artpec6_crypto_dma_map_single(common,
- dma->stat + dma->in_cnt - 1,
- sizeof(dma->stat[0]),
+ dma->stat,
+ sizeof(dma->stat[0]) * dma->in_cnt,
DMA_BIDIRECTIONAL,
&dma->stat_dma_addr);
}
@@ -2087,9 +2087,12 @@ static void artpec6_crypto_task(unsigned long data)
list_for_each_entry_safe(req, n, &ac->pending, list) {
struct artpec6_crypto_dma_descriptors *dma = req->dma;
u32 stat;
+ dma_addr_t stataddr;
- dma_sync_single_for_cpu(artpec6_crypto_dev, dma->stat_dma_addr,
- sizeof(dma->stat[0]),
+ stataddr = dma->stat_dma_addr + 4 * (req->dma->in_cnt - 1);
+ dma_sync_single_for_cpu(artpec6_crypto_dev,
+ stataddr,
+ 4,
DMA_BIDIRECTIONAL);
stat = req->dma->stat[req->dma->in_cnt-1];