summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/stm32/stm32-hash.c
diff options
context:
space:
mode:
authorLionel Debieve <lionel.debieve@st.com>2018-01-29 15:28:10 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2018-02-15 16:26:55 +0100
commitff1cae4e7f50e7d2da4343be4c0b411b5d564bc1 (patch)
tree475c8261310fbd18b192f7bfb2708e51ffeaf2d1 /drivers/crypto/stm32/stm32-hash.c
parentcrypto: stm32/hash - avoid error if maxburst not defined (diff)
downloadlinux-ff1cae4e7f50e7d2da4343be4c0b411b5d564bc1.tar.xz
linux-ff1cae4e7f50e7d2da4343be4c0b411b5d564bc1.zip
crypto: stm32/hash - fix performance issues
Fixing bugs link to stress tests. Bad results are detected during testmgr selftests executing in a faster environment. bufcnt value may be resetted and false IT are sometimes detected. Signed-off-by: Lionel Debieve <lionel.debieve@st.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/stm32/stm32-hash.c')
-rw-r--r--drivers/crypto/stm32/stm32-hash.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c
index 37815aa7f5de..d540cdfaf993 100644
--- a/drivers/crypto/stm32/stm32-hash.c
+++ b/drivers/crypto/stm32/stm32-hash.c
@@ -744,13 +744,15 @@ static int stm32_hash_final_req(struct stm32_hash_dev *hdev)
struct ahash_request *req = hdev->req;
struct stm32_hash_request_ctx *rctx = ahash_request_ctx(req);
int err;
+ int buflen = rctx->bufcnt;
+
+ rctx->bufcnt = 0;
if (!(rctx->flags & HASH_FLAGS_CPU))
err = stm32_hash_dma_send(hdev);
else
- err = stm32_hash_xmit_cpu(hdev, rctx->buffer, rctx->bufcnt, 1);
+ err = stm32_hash_xmit_cpu(hdev, rctx->buffer, buflen, 1);
- rctx->bufcnt = 0;
return err;
}
@@ -1105,6 +1107,8 @@ static irqreturn_t stm32_hash_irq_handler(int irq, void *dev_id)
reg &= ~HASH_SR_OUTPUT_READY;
stm32_hash_write(hdev, HASH_SR, reg);
hdev->flags |= HASH_FLAGS_OUTPUT_READY;
+ /* Disable IT*/
+ stm32_hash_write(hdev, HASH_IMR, 0);
return IRQ_WAKE_THREAD;
}