[PATCH] crypto: sahara - Fix dma unmap direction
The direction used in dma_unmap_sg in aes calc is wrong. This result in the cache not being invalidated correct when aes calculation is done and result has been dma'ed to memory. This is seen as sporadic wrong result from aes calc. Signed-off-by: Mogens Lauridsen <mlauridsen...@gmail.com> --- drivers/crypto/sahara.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index c2174ec88e2a..474da36bdd2c 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -543,10 +543,10 @@ static int sahara_hw_descriptor_create(struct sahara_dev *dev) unmap_out: dma_unmap_sg(dev->device, dev->out_sg, dev->nb_out_sg, - DMA_TO_DEVICE); + DMA_FROM_DEVICE); unmap_in: dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg, - DMA_FROM_DEVICE); + DMA_TO_DEVICE); return -EINVAL; } @@ -594,9 +594,9 @@ static int sahara_aes_process(struct ablkcipher_request *req) } dma_unmap_sg(dev->device, dev->out_sg, dev->nb_out_sg, - DMA_TO_DEVICE); - dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg, DMA_FROM_DEVICE); + dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg, + DMA_TO_DEVICE); return 0; } -- 2.13.4
[PATCH] crypto: sahara - Remove leftover from previous used spinlock
This driver previously used a spinlock. The spinlock is not used any more, but the spinlock variable was still there and also being initialized. Signed-off-by: Mogens Lauridsen <mlauridsen...@gmail.com> --- drivers/crypto/sahara.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index 474da36bdd2c..03a8abad7e76 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -202,7 +202,6 @@ struct sahara_dev { struct completion dma_completion; struct sahara_ctx *ctx; - spinlock_t lock; struct crypto_queue queue; unsigned long flags; @@ -1487,7 +1486,6 @@ static int sahara_probe(struct platform_device *pdev) crypto_init_queue(>queue, SAHARA_QUEUE_LENGTH); - spin_lock_init(>lock); mutex_init(>queue_mutex); dev_ptr = dev; -- 2.13.4
Patch: Remove leftover from spinlock previous used in sahara driver
Hi, The Freescale sahara driver has previously used a spinlock. This spinlock has been removed, but the spinlock variable is still there and is also being initialized. This patch removes the leftover. Thanks, Mogens Lauridsen Signed-off-by: Mogens Lauridsen <mlauridsen...@gmail.com> diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index 9538c52..b35cbda 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -202,7 +202,6 @@ struct sahara_dev { struct completiondma_completion; struct sahara_ctx*ctx; -spinlock_tlock; struct crypto_queuequeue; unsigned longflags; @@ -1487,7 +1486,6 @@ static int sahara_probe(struct platform_device *pdev) crypto_init_queue(>queue, SAHARA_QUEUE_LENGTH); -spin_lock_init(>lock); mutex_init(>queue_mutex); dev_ptr = dev;
Fix dma unmap direction in iMX sahara aes calculation
Hi, The direction used in dma_unmap_sg in aes calc in sahara.c is wrong. This result in the cache not being invalidated correct when aes calculation is done and result is dma'ed to memory. This is seen as sporadic wrong result from aes calc. Thanks, Mogens Signed-off-by: Mogens Lauridsen <mlauridsen...@gmail.com> diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index 1d9ecd3..9538c52 100644ae --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -543,10 +543,10 @@ static int sahara_hw_descriptor_create(struct sahara_dev * unmap_out: dma_unmap_sg(dev->device, dev->out_sg, dev->nb_out_sg, - DMA_TO_DEVICE); + DMA_FROM_DEVICE); unmap_in: dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg, - DMA_FROM_DEVICE); + DMA_TO_DEVICE); return -EINVAL; } @@ -594,9 +594,9 @@ static int sahara_aes_process(struct ablkcipher_request *req } dma_unmap_sg(dev->device, dev->out_sg, dev->nb_out_sg, - DMA_TO_DEVICE); - dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg, DMA_FROM_DEVICE); + dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg, + DMA_TO_DEVICE); return 0; }