ARM Sunxi Platform Development
 help / color / mirror / Atom feed
From: Ovidiu Panait <ovidiu.panait.oss@gmail.com>
To: Corentin Labbe <clabbe.montjoie@gmail.com>
Cc: herbert@gondor.apana.org.au, davem@davemloft.net,
	linux-crypto@vger.kernel.org, wens@csie.org,
	jernej.skrabec@gmail.com, samuel@sholland.org,
	linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 03/10] crypto: sun8i-ce - move bounce_iv and backup_iv to request context
Date: Tue, 8 Jul 2025 23:08:58 +0300	[thread overview]
Message-ID: <95f4ded3-f649-4bdc-a3ca-cade77aa2e92@gmail.com> (raw)
In-Reply-To: <aG1lN94feb4OJVsI@Red>



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@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


  reply	other threads:[~2025-07-08 20:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-26  9:58 [PATCH v2 00/10] crypto: sun8i-ce - implement request batching Ovidiu Panait
2025-06-26  9:58 ` [PATCH v2 01/10] crypto: sun8i-ce - remove channel timeout field Ovidiu Panait
2025-07-08 12:58   ` Corentin Labbe
2025-06-26  9:58 ` [PATCH v2 02/10] crypto: sun8i-ce - remove boilerplate in sun8i_ce_hash_digest() Ovidiu Panait
2025-07-08 14:04   ` Corentin Labbe
2025-06-26  9:58 ` [PATCH v2 03/10] crypto: sun8i-ce - move bounce_iv and backup_iv to request context Ovidiu Panait
2025-07-08 18:36   ` Corentin Labbe
2025-07-08 20:08     ` Ovidiu Panait [this message]
2025-06-26  9:58 ` [PATCH v2 04/10] crypto: sun8i-ce - save hash buffers and dma info " Ovidiu Panait
2025-06-26  9:58 ` [PATCH v2 05/10] crytpo: sun8i-ce - factor out prepare/unprepare code from ahash do_one_request Ovidiu Panait
2025-06-26  9:58 ` [PATCH v2 06/10] crypto: sun8i-ce - fold sun8i_ce_cipher_run() into sun8i_ce_cipher_do_one() Ovidiu Panait
2025-06-26  9:58 ` [PATCH v2 07/10] crypto: sun8i-ce - pass task descriptor to cipher prepare/unprepare Ovidiu Panait
2025-06-26  9:58 ` [PATCH v2 08/10] crypto: sun8i-ce - factor out public versions of finalize request Ovidiu Panait
2025-06-26  9:58 ` [PATCH v2 09/10] crypto: sun8i-ce - add a new function for dumping task descriptors Ovidiu Panait
2025-06-26  9:58 ` [PATCH v2 10/10] crypto: sun8i-ce - implement request batching Ovidiu Panait
2025-06-29 18:37 ` [PATCH v2 00/10] " Corentin Labbe
2025-07-10  8:12 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=95f4ded3-f649-4bdc-a3ca-cade77aa2e92@gmail.com \
    --to=ovidiu.panait.oss@gmail.com \
    --cc=clabbe.montjoie@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=samuel@sholland.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox