* [PATCH 1/3] crypto: stm32/hash: avoid error if maxburst not defined
2018-01-29 14:28 [PATCH 0/3] crypto: stm32/hash: Correction to improve robustness Lionel Debieve
@ 2018-01-29 14:28 ` Lionel Debieve
2018-01-29 14:28 ` [PATCH 2/3] crypto: stm32/hash: fix performance issues Lionel Debieve
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Lionel Debieve @ 2018-01-29 14:28 UTC (permalink / raw)
To: Herbert Xu, David S . Miller, Maxime Coquelin, Alexandre Torgue,
linux-crypto, linux-arm-kernel, linux-kernel
Cc: Benjamin Gaignard, Fabien Dessenne, Ludovic Barre, Lionel Debieve
From: Lionel Debieve <lionel.debieve@st.com>
dma-maxburst is an optional value and must not return
error in case of dma not used (or max-burst not defined).
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
---
drivers/crypto/stm32/stm32-hash.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c
index 4ca4a264a833..73cdc3b4dca8 100644
--- a/drivers/crypto/stm32/stm32-hash.c
+++ b/drivers/crypto/stm32/stm32-hash.c
@@ -1404,18 +1404,19 @@ MODULE_DEVICE_TABLE(of, stm32_hash_of_match);
static int stm32_hash_get_of_match(struct stm32_hash_dev *hdev,
struct device *dev)
{
- int err;
-
hdev->pdata = of_device_get_match_data(dev);
if (!hdev->pdata) {
dev_err(dev, "no compatible OF match\n");
return -EINVAL;
}
- err = of_property_read_u32(dev->of_node, "dma-maxburst",
- &hdev->dma_maxburst);
+ if (of_property_read_u32(dev->of_node, "dma-maxburst",
+ &hdev->dma_maxburst)) {
+ dev_info(dev, "dma-maxburst not specified, using 0\n");
+ hdev->dma_maxburst = 0;
+ }
- return err;
+ return 0;
}
static int stm32_hash_probe(struct platform_device *pdev)
--
2.15.1
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 2/3] crypto: stm32/hash: fix performance issues
2018-01-29 14:28 [PATCH 0/3] crypto: stm32/hash: Correction to improve robustness Lionel Debieve
2018-01-29 14:28 ` [PATCH 1/3] crypto: stm32/hash: avoid error if maxburst not defined Lionel Debieve
@ 2018-01-29 14:28 ` Lionel Debieve
2018-01-29 14:28 ` [PATCH 3/3] crypto: stm32/hash: rework padding length Lionel Debieve
2018-02-15 15:51 ` [PATCH 0/3] crypto: stm32/hash: Correction to improve robustness Herbert Xu
3 siblings, 0 replies; 5+ messages in thread
From: Lionel Debieve @ 2018-01-29 14:28 UTC (permalink / raw)
To: Herbert Xu, David S . Miller, Maxime Coquelin, Alexandre Torgue,
linux-crypto, linux-arm-kernel, linux-kernel
Cc: Benjamin Gaignard, Fabien Dessenne, Ludovic Barre, Lionel Debieve
From: Lionel Debieve <lionel.debieve@st.com>
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>
---
drivers/crypto/stm32/stm32-hash.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c
index 73cdc3b4dca8..d8444aeb6609 100644
--- a/drivers/crypto/stm32/stm32-hash.c
+++ b/drivers/crypto/stm32/stm32-hash.c
@@ -743,13 +743,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;
}
@@ -1096,6 +1098,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;
}
--
2.15.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/3] crypto: stm32/hash: rework padding length
2018-01-29 14:28 [PATCH 0/3] crypto: stm32/hash: Correction to improve robustness Lionel Debieve
2018-01-29 14:28 ` [PATCH 1/3] crypto: stm32/hash: avoid error if maxburst not defined Lionel Debieve
2018-01-29 14:28 ` [PATCH 2/3] crypto: stm32/hash: fix performance issues Lionel Debieve
@ 2018-01-29 14:28 ` Lionel Debieve
2018-02-15 15:51 ` [PATCH 0/3] crypto: stm32/hash: Correction to improve robustness Herbert Xu
3 siblings, 0 replies; 5+ messages in thread
From: Lionel Debieve @ 2018-01-29 14:28 UTC (permalink / raw)
To: Herbert Xu, David S . Miller, Maxime Coquelin, Alexandre Torgue,
linux-crypto, linux-arm-kernel, linux-kernel
Cc: Benjamin Gaignard, Fabien Dessenne, Ludovic Barre, Lionel Debieve
From: Lionel Debieve <lionel.debieve@st.com>
Due to another patch, the dma fails when padding is
needed as the given length is not correct.
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
---
drivers/crypto/stm32/stm32-hash.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c
index d8444aeb6609..80b9ec76bbb5 100644
--- a/drivers/crypto/stm32/stm32-hash.c
+++ b/drivers/crypto/stm32/stm32-hash.c
@@ -626,7 +626,7 @@ static int stm32_hash_dma_send(struct stm32_hash_dev *hdev)
writesl(hdev->io_base + HASH_DIN, buffer,
DIV_ROUND_UP(ncp, sizeof(u32)));
}
- stm32_hash_set_nblw(hdev, DIV_ROUND_UP(ncp, sizeof(u32)));
+ stm32_hash_set_nblw(hdev, ncp);
reg = stm32_hash_read(hdev, HASH_STR);
reg |= HASH_STR_DCAL;
stm32_hash_write(hdev, HASH_STR, reg);
--
2.15.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] crypto: stm32/hash: Correction to improve robustness
2018-01-29 14:28 [PATCH 0/3] crypto: stm32/hash: Correction to improve robustness Lionel Debieve
` (2 preceding siblings ...)
2018-01-29 14:28 ` [PATCH 3/3] crypto: stm32/hash: rework padding length Lionel Debieve
@ 2018-02-15 15:51 ` Herbert Xu
3 siblings, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2018-02-15 15:51 UTC (permalink / raw)
To: Lionel Debieve
Cc: David S . Miller, Maxime Coquelin, Alexandre Torgue,
linux-crypto, linux-arm-kernel, linux-kernel, Benjamin Gaignard,
Fabien Dessenne, Ludovic Barre
On Mon, Jan 29, 2018 at 03:28:08PM +0100, Lionel Debieve wrote:
> From: Lionel Debieve <lionel.debieve@st.com>
>
> Hi,
>
> This patch serie will improve global robustness for stm32-hash driver.
>
> Patch #1 is fixing dma-burst issue when configuration is not set.
> Patch #2 solves issue that occurs when irq append during final req processing.
> Patch #3 is fixing an issue that have been introduced while managing padding but
> breaking the padding length calculation by hardware to generate correct hash.
>
> Regards,
>
> Lionel Debieve (3):
> crypto: stm32/hash: avoid error if maxburst not defined
> crypto: stm32/hash: fix performance issues
> crypto: stm32/hash: rework padding length
All applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 5+ messages in thread