Thread (36 messages) 36 messages, 3 authors, 2018-03-02

Re: [PATCH 16/18] crypto: talitos - do hw_context DMA mapping outside the requests

From: Christophe LEROY <hidden>
Date: 2018-02-17 16:32:48
Also in: linux-crypto, lkml


Le 07/02/2018 à 15:39, Horia Geantă a écrit :
On 10/6/2017 4:06 PM, Christophe Leroy wrote:
quoted
At every request, we map and unmap the same hash hw_context.

This patch moves the dma mapping/unmapping in functions ahash_init()
and ahash_import().

Signed-off-by: Christophe Leroy <redacted>
---
  drivers/crypto/talitos.c | 80 ++++++++++++++++++++++++++++++++++--------------
  1 file changed, 57 insertions(+), 23 deletions(-)
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index ebfd6d982ed6..d495649d5267 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -819,6 +819,7 @@ struct talitos_ctx {
  	unsigned int keylen;
  	unsigned int enckeylen;
  	unsigned int authkeylen;
+	dma_addr_t dma_hw_context;
This doesn't look correct.

talitos_ctx structure is the tfm context.
dma_hw_context is the IOVA of hw_context, located in talitos_ahash_req_ctx
structure (request context).
Yes but I have now found how I can know that the request context is 
being released in order to unmap() dma at that time.
It is tricky to use the tmf context I agree, but at least I know when 
tmf context get destroyed, ie in talitos_cra_exit_ahash()
The request context is created by ahash_request_alloc() and released by
ahash_request_free(). I have not found the way to call dma_unmap() 
before ahash_request_free() gets called.
If there are multiple requests in flight for the same tfm, dma_hw_context will
be overwritten.
Before overwritting dma_hw_context, it is always released, see 
talitos_cra_exit_ahash(), ahash_init(), ahash_import()
dma_hw_context needs to be moved in request context (talitos_ahash_req_ctx struct).
Any suggestion then on how to handle the issue explained above ?

Thanks
Christophe
Thanks,
Horia
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help