[PATCH v2 03/10] crypto: sun8i-ce - move bounce_iv and backup_iv to request context
Ovidiu Panait
ovidiu.panait.oss at gmail.com
Tue Jul 8 13:08:58 PDT 2025
On 7/8/25 9:36 PM, Corentin Labbe wrote:
> Le Thu, Jun 26, 2025 at 12:58:06PM +0300, Ovidiu Panait a écrit :
>> Currently, the iv buffers are allocated once per flow during driver probe.
>> Having a single iv buffer for all requests works with the current setup
>> where requests are processed one by one, but it wouldn't work if multiple
>> requests are chained together and processed in one go.
>>
>> In preparation for introducing request batching, allocate iv buffers per
>> request, rather than per flow.
>>
>> Signed-off-by: Ovidiu Panait <ovidiu.panait.oss at gmail.com>
>> ---
>> .../allwinner/sun8i-ce/sun8i-ce-cipher.c | 18 +++++++++---------
>> .../crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 12 ------------
>> drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h | 8 ++++----
>> 3 files changed, 13 insertions(+), 25 deletions(-)
>>
[...]
>> @@ -273,6 +271,8 @@ struct sun8i_cipher_req_ctx {
>> int nr_sgd;
>> dma_addr_t addr_iv;
>> dma_addr_t addr_key;
>> + u8 bounce_iv[AES_BLOCK_SIZE] ____cacheline_aligned;
>> + u8 backup_iv[AES_BLOCK_SIZE] ____cacheline_aligned;
>> struct skcipher_request fallback_req; // keep at the end
>
> Hello
>
> Are you sure you could do DMA on sun8i_cipher_req_ctx ?
>
Yes, that is my understanding. Request ctx memory is allocated in
skcipher_request_alloc() by calling kmalloc(), which returns memory that
should be suitable for DMA.
Also, there are multiple drivers doing this already. You can grep for
____cacheline_aligned inside drivers/crypto to see other examples.
Ovidiu
> Regards
More information about the linux-arm-kernel
mailing list