Commit ff1cae4e authored by Lionel Debieve's avatar Lionel Debieve Committed by Herbert Xu

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: default avatarLionel Debieve <lionel.debieve@st.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent a3d98b90
...@@ -744,13 +744,15 @@ static int stm32_hash_final_req(struct stm32_hash_dev *hdev) ...@@ -744,13 +744,15 @@ static int stm32_hash_final_req(struct stm32_hash_dev *hdev)
struct ahash_request *req = hdev->req; struct ahash_request *req = hdev->req;
struct stm32_hash_request_ctx *rctx = ahash_request_ctx(req); struct stm32_hash_request_ctx *rctx = ahash_request_ctx(req);
int err; int err;
int buflen = rctx->bufcnt;
rctx->bufcnt = 0;
if (!(rctx->flags & HASH_FLAGS_CPU)) if (!(rctx->flags & HASH_FLAGS_CPU))
err = stm32_hash_dma_send(hdev); err = stm32_hash_dma_send(hdev);
else 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; return err;
} }
...@@ -1105,6 +1107,8 @@ static irqreturn_t stm32_hash_irq_handler(int irq, void *dev_id) ...@@ -1105,6 +1107,8 @@ static irqreturn_t stm32_hash_irq_handler(int irq, void *dev_id)
reg &= ~HASH_SR_OUTPUT_READY; reg &= ~HASH_SR_OUTPUT_READY;
stm32_hash_write(hdev, HASH_SR, reg); stm32_hash_write(hdev, HASH_SR, reg);
hdev->flags |= HASH_FLAGS_OUTPUT_READY; hdev->flags |= HASH_FLAGS_OUTPUT_READY;
/* Disable IT*/
stm32_hash_write(hdev, HASH_IMR, 0);
return IRQ_WAKE_THREAD; return IRQ_WAKE_THREAD;
} }
......
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