On Mon, Mar 19, 2018 at 11:04:24AM +0000, Horia Geantă wrote: > > The only solution to avoid leaks in this case is to repeatedly DMA map & unmap > the buffer. > IOW, if one wants to load/save HW state in a buffer after an .update() and to > instruct the crypto engine to do this operation, the following steps are involved: > -gpp: DMA map the buffer, get its IOVA > -gpp: program the crypto engine with IOVA, wait for crypto engine's signal > -crypto engine: load HW state from buffer, perform the partial hash, save HW > state in buffer, signal gpp > -gpp: DMA unmap the buffer What buffer are you talking about here? Is it the hash state? If it's the hash state and assuming DMA mapping was slow enough on your platform, you could solve it by maintaining a fixed set of hash states that are rotated through the actual hash requests. Let's say you allocate n such hash states which are always mapped, then if there are less than n hash requests outstanding, you could directly use the mapped hash states in the requests. If there are more than n, then you simply copy in/copy out for each hash operation. The number n limits how many operations can be pending to be processed by the hardware. Cheers, -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt