From: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
To: Paul Louvel <paul.louvel@bootlin.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Herve Codina <herve.codina@bootlin.com>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 24/29] crypto: talitos - Introduce per-SEC-version pointer helper ops
Date: Thu, 4 Jun 2026 11:48:36 +0200 [thread overview]
Message-ID: <8c540731-8bd3-4b7d-ad83-428a11297e00@kernel.org> (raw)
In-Reply-To: <20260528-7-1-rc1_talitos_cleanup-v1-24-cb1ad6cdea49@bootlin.com>
Le 28/05/2026 à 11:08, Paul Louvel a écrit :
> Introduce struct talitos_ptr_ops to abstract SEC1/SEC2 differences
> in pointer handling behind per-SEC-version ops. Add ptr_ops to
> struct talitos_private and struct talitos_ctx, and register the
> appropriate SEC1 or SEC2 implementation at probe time.
Those helpers are so small they deserve being inlined not called
indirectly. You should reconsider them using the is_sec1() helper I
proposed on patch 20.
00000000 <sec1_to_talitos_ptr>:
0: 90 83 00 04 stw r4,4(r3)
4: b0 a3 00 02 sth r5,2(r3)
8: 4e 80 00 20 blr
0000000c <sec1_copy_talitos_ptr>:
c: 81 24 00 04 lwz r9,4(r4)
10: 91 23 00 04 stw r9,4(r3)
14: a1 24 00 02 lhz r9,2(r4)
18: b1 23 00 02 sth r9,2(r3)
1c: 4e 80 00 20 blr
00000020 <sec1_from_talitos_ptr_len>:
20: a0 63 00 02 lhz r3,2(r3)
24: 4e 80 00 20 blr
00000028 <sec1_to_talitos_ptr_ext_set>:
28: 4e 80 00 20 blr
0000002c <sec1_get_ptr_value>:
2c: 80 63 00 04 lwz r3,4(r3)
30: 4e 80 00 20 blr
00000034 <sec1_get_hdr>:
34: 80 63 00 00 lwz r3,0(r3)
38: 4e 80 00 20 blr
0000003c <sec1_get_hdr_lo>:
3c: 38 60 00 00 li r3,0
40: 4e 80 00 20 blr
00000044 <sec1_set_hdr>:
44: 90 83 00 00 stw r4,0(r3)
48: 4e 80 00 20 blr
0000004c <sec1_get_ptr>:
4c: 54 84 18 38 slwi r4,r4,3
50: 38 84 00 04 addi r4,r4,4
54: 7c 63 22 14 add r3,r3,r4
58: 4e 80 00 20 blr
00000be8 <sec1_to_talitos_ptr_ext_or>:
be8: 4e 80 00 20 blr
>
> Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
> ---
> drivers/crypto/talitos/talitos-sec1.c | 36 +++++++++++++++++++++++++++++++
> drivers/crypto/talitos/talitos-sec2.c | 40 +++++++++++++++++++++++++++++++++++
> drivers/crypto/talitos/talitos.c | 2 ++
> drivers/crypto/talitos/talitos.h | 12 +++++++++++
> 4 files changed, 90 insertions(+)
>
> diff --git a/drivers/crypto/talitos/talitos-sec1.c b/drivers/crypto/talitos/talitos-sec1.c
> index 695d531aa7f4..ef1bd19b6772 100644
> --- a/drivers/crypto/talitos/talitos-sec1.c
> +++ b/drivers/crypto/talitos/talitos-sec1.c
> @@ -73,6 +73,33 @@ static irqreturn_t talitos1_interrupt_##name(int irq, void *data) \
>
> DEF_TALITOS1_INTERRUPT(4ch, TALITOS1_ISR_4CHDONE, TALITOS1_ISR_4CHERR, 0)
>
> +static void sec1_to_talitos_ptr(struct talitos_ptr *ptr, dma_addr_t dma_addr,
> + unsigned int len)
> +{
> + ptr->ptr = cpu_to_be32(lower_32_bits(dma_addr));
> + ptr->len1 = cpu_to_be16(len);
> +}
> +
> +static void sec1_copy_talitos_ptr(struct talitos_ptr *dst_ptr,
> + struct talitos_ptr *src_ptr)
> +{
> + dst_ptr->ptr = src_ptr->ptr;
> + dst_ptr->len1 = src_ptr->len1;
> +}
> +
> +static unsigned short sec1_from_talitos_ptr_len(struct talitos_ptr *ptr)
> +{
> + return be16_to_cpu(ptr->len1);
> +}
> +
> +static void sec1_to_talitos_ptr_ext_set(struct talitos_ptr *ptr, u8 val)
> +{
> +}
> +
> +static void sec1_to_talitos_ptr_ext_or(struct talitos_ptr *ptr, u8 val)
> +{
> +}
> +
> static int sec1_reset_device(struct device *dev)
> {
> struct talitos_private *priv = dev_get_drvdata(dev);
> @@ -286,6 +313,14 @@ static void sec1_init_task(struct device *dev)
> (unsigned long)dev);
> }
>
> +static const struct talitos_ptr_ops sec1_ptr_ops = {
> + .to_talitos_ptr = sec1_to_talitos_ptr,
> + .copy_talitos_ptr = sec1_copy_talitos_ptr,
> + .from_talitos_ptr_len = sec1_from_talitos_ptr_len,
> + .to_talitos_ptr_ext_set = sec1_to_talitos_ptr_ext_set,
> + .to_talitos_ptr_ext_or = sec1_to_talitos_ptr_ext_or,
> +};
> +
> static const struct talitos_ops sec1_ops = {
> .probe_irq = sec1_talitos_probe_irq,
> .init_task = sec1_init_task,
> @@ -302,4 +337,5 @@ static const struct talitos_ops sec1_ops = {
> void talitos_register_sec1(struct talitos_private *priv)
> {
> priv->ops = &sec1_ops;
> + priv->ptr_ops = &sec1_ptr_ops;
> }
> diff --git a/drivers/crypto/talitos/talitos-sec2.c b/drivers/crypto/talitos/talitos-sec2.c
> index 962e7cd43631..14f0ca13e6e5 100644
> --- a/drivers/crypto/talitos/talitos-sec2.c
> +++ b/drivers/crypto/talitos/talitos-sec2.c
> @@ -79,6 +79,37 @@ DEF_TALITOS2_DONE(ch0, TALITOS2_ISR_CH_0_DONE)
> DEF_TALITOS2_DONE(ch0_2, TALITOS2_ISR_CH_0_2_DONE)
> DEF_TALITOS2_DONE(ch1_3, TALITOS2_ISR_CH_1_3_DONE)
>
> +static void sec2_to_talitos_ptr(struct talitos_ptr *ptr, dma_addr_t dma_addr,
> + unsigned int len)
> +{
> + ptr->ptr = cpu_to_be32(lower_32_bits(dma_addr));
> + ptr->len = cpu_to_be16(len);
> + ptr->eptr = upper_32_bits(dma_addr);
> +}
> +
> +static void sec2_copy_talitos_ptr(struct talitos_ptr *dst_ptr,
> + struct talitos_ptr *src_ptr)
> +{
> + dst_ptr->ptr = src_ptr->ptr;
> + dst_ptr->len = src_ptr->len;
> + dst_ptr->eptr = src_ptr->eptr;
> +}
> +
> +static unsigned short sec2_from_talitos_ptr_len(struct talitos_ptr *ptr)
> +{
> + return be16_to_cpu(ptr->len);
> +}
> +
> +static void sec2_to_talitos_ptr_ext_set(struct talitos_ptr *ptr, u8 val)
> +{
> + ptr->j_extent = val;
> +}
> +
> +static void sec2_to_talitos_ptr_ext_or(struct talitos_ptr *ptr, u8 val)
> +{
> + ptr->j_extent |= val;
> +}
> +
> static int sec2_reset_channel(struct device *dev, int ch)
> {
> struct talitos_private *priv = dev_get_drvdata(dev);
> @@ -311,6 +342,14 @@ static __be32 sec2_search_desc_hdr_in_request(struct talitos_request *request,
> return 0;
> }
>
> +static const struct talitos_ptr_ops sec2_ptr_ops = {
> + .to_talitos_ptr = sec2_to_talitos_ptr,
> + .copy_talitos_ptr = sec2_copy_talitos_ptr,
> + .from_talitos_ptr_len = sec2_from_talitos_ptr_len,
> + .to_talitos_ptr_ext_set = sec2_to_talitos_ptr_ext_set,
> + .to_talitos_ptr_ext_or = sec2_to_talitos_ptr_ext_or,
> +};
> +
> static const struct talitos_ops sec2_ops = {
> .probe_irq = sec2_talitos_probe_irq,
> .init_task = sec2_init_task,
> @@ -327,4 +366,5 @@ static const struct talitos_ops sec2_ops = {
> void talitos_register_sec2(struct talitos_private *priv)
> {
> priv->ops = &sec2_ops;
> + priv->ptr_ops = &sec2_ptr_ops;
> }
> diff --git a/drivers/crypto/talitos/talitos.c b/drivers/crypto/talitos/talitos.c
> index 152618998819..0e4bd130ac6d 100644
> --- a/drivers/crypto/talitos/talitos.c
> +++ b/drivers/crypto/talitos/talitos.c
> @@ -668,6 +668,8 @@ int talitos_init_common(struct talitos_ctx *ctx,
> /* select done notification */
> ctx->desc_hdr_template |= DESC_HDR_DONE_NOTIFY;
>
> + ctx->ptr_ops = priv->ptr_ops;
> +
> return 0;
> }
>
> diff --git a/drivers/crypto/talitos/talitos.h b/drivers/crypto/talitos/talitos.h
> index ae0bdb2ea78e..09d4e8fb0e62 100644
> --- a/drivers/crypto/talitos/talitos.h
> +++ b/drivers/crypto/talitos/talitos.h
> @@ -140,6 +140,16 @@ struct talitos_channel {
> int tail;
> };
>
> +struct talitos_ptr_ops {
> + void (*to_talitos_ptr)(struct talitos_ptr *ptr, dma_addr_t addr,
> + unsigned int len);
> + void (*copy_talitos_ptr)(struct talitos_ptr *dst_ptr,
> + struct talitos_ptr *src_ptr);
> + unsigned short (*from_talitos_ptr_len)(struct talitos_ptr *ptr);
> + void (*to_talitos_ptr_ext_set)(struct talitos_ptr *ptr, u8 val);
> + void (*to_talitos_ptr_ext_or)(struct talitos_ptr *ptr, u8 val);
> +};
> +
> struct talitos_ops {
> int (*probe_irq)(struct platform_device *ofdev);
> void (*init_task)(struct device *dev);
> @@ -183,6 +193,7 @@ struct talitos_private {
> unsigned int desc_types;
>
> const struct talitos_ops *ops;
> + const struct talitos_ptr_ops *ptr_ops;
>
> /* SEC Compatibility info */
> unsigned long features;
> @@ -213,6 +224,7 @@ struct talitos_private {
>
> struct talitos_ctx {
> struct device *dev;
> + const struct talitos_ptr_ops *ptr_ops;
> int ch;
> __be32 desc_hdr_template;
> u8 key[TALITOS_MAX_KEY_SIZE];
>
next prev parent reply other threads:[~2026-06-04 9:48 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-28 9:08 [PATCH 00/29] crypto: talitos - Driver cleanup Paul Louvel
2026-05-28 9:08 ` [PATCH 01/29] crypto: talitos/hash - Use CRYPTO_AHASH_BLOCK_ONLY API Paul Louvel
2026-05-29 11:25 ` Christophe Leroy (CS GROUP)
2026-06-01 5:40 ` Christophe Leroy (CS GROUP)
2026-06-01 8:06 ` Paul Louvel
2026-05-28 9:08 ` [PATCH 02/29] crypto: talitos - Move driver into dedicated directory Paul Louvel
2026-05-29 11:25 ` Christophe Leroy (CS GROUP)
2026-05-28 9:08 ` [PATCH 03/29] crypto: talitos - Add missing includes to driver header file Paul Louvel
2026-05-29 11:26 ` Christophe Leroy (CS GROUP)
2026-05-28 9:08 ` [PATCH 04/29] crypto: talitos/hwrng - Move into separate file Paul Louvel
2026-05-29 11:26 ` Christophe Leroy (CS GROUP)
2026-05-28 9:08 ` [PATCH 05/29] crypto: talitos - Prepare crypto implementation file splitting Paul Louvel
2026-05-29 13:21 ` Christophe Leroy (CS GROUP)
2026-05-29 16:24 ` David Laight
2026-06-01 8:49 ` Paul Louvel
2026-06-01 10:16 ` Christophe Leroy (CS GROUP)
2026-05-28 9:08 ` [PATCH 06/29] crypto: talitos - Introduce registration helper Paul Louvel
2026-06-01 5:45 ` Christophe Leroy (CS GROUP)
2026-05-28 9:08 ` [PATCH 07/29] crypto: talitos/hash - Move into separate file Paul Louvel
2026-06-01 11:47 ` Christophe Leroy (CS GROUP)
2026-06-04 12:31 ` Paul Louvel
2026-05-28 9:08 ` [PATCH 08/29] crypto: talitos/skcipher " Paul Louvel
2026-06-01 11:47 ` Christophe Leroy (CS GROUP)
2026-05-28 9:08 ` [PATCH 09/29] crypto: talitos/aead " Paul Louvel
2026-06-01 11:48 ` Christophe Leroy (CS GROUP)
2026-05-28 9:08 ` [PATCH 10/29] crypto: talitos - Remove alg settings in talitos_register_common() Paul Louvel
2026-06-01 11:53 ` Christophe Leroy (CS GROUP)
2026-06-04 12:38 ` Paul Louvel
2026-05-28 9:08 ` [PATCH 11/29] crypto: talitos - Remove unused priority field in struct talitos_alg_template Paul Louvel
2026-06-01 11:54 ` Christophe Leroy (CS GROUP)
2026-06-04 12:39 ` Paul Louvel
2026-05-28 9:08 ` [PATCH 12/29] crypto: talitos/hash - Convert to init_tfm/exit_tfm type-specific API Paul Louvel
2026-06-01 11:57 ` Christophe Leroy (CS GROUP)
2026-05-28 9:08 ` [PATCH 13/29] crypto: talitos/skcipher - Convert to init/exit " Paul Louvel
2026-06-01 11:58 ` Christophe Leroy (CS GROUP)
2026-05-28 9:08 ` [PATCH 14/29] crypto: talitos/aead " Paul Louvel
2026-06-01 11:59 ` Christophe Leroy (CS GROUP)
2026-06-04 12:44 ` Paul Louvel
2026-05-28 9:08 ` [PATCH 15/29] crypto: talitos/hash - Use macro for algorithm definitions Paul Louvel
2026-06-01 12:02 ` Christophe Leroy (CS GROUP)
2026-05-28 9:08 ` [PATCH 16/29] crypto: talitos/skcipher " Paul Louvel
2026-06-01 12:02 ` Christophe Leroy (CS GROUP)
2026-05-28 9:08 ` [PATCH 17/29] crypto: talitos/aead " Paul Louvel
2026-06-01 12:12 ` Christophe Leroy (CS GROUP)
2026-06-10 14:41 ` Paul Louvel
2026-05-28 9:08 ` [PATCH 18/29] crypto: talitos - Split SEC1/SEC2 code into separate function variants Paul Louvel
2026-06-01 5:51 ` Christophe Leroy (CS GROUP)
2026-06-01 12:32 ` Christophe Leroy (CS GROUP)
2026-06-04 12:46 ` Paul Louvel
2026-05-28 9:08 ` [PATCH 19/29] crypto: talitos - Introduce struct talitos_ops Paul Louvel
2026-05-28 9:08 ` [PATCH 20/29] crypto: talitos - Replace SEC1/SEC2 conditionals with ops dispatch Paul Louvel
2026-06-04 9:37 ` Christophe Leroy (CS GROUP)
2026-06-04 13:05 ` Paul Louvel
2026-06-04 15:26 ` Christophe Leroy (CS GROUP)
2026-05-28 9:08 ` [PATCH 21/29] crypto: talitos - Export common channel and error handling routines Paul Louvel
2026-05-28 9:08 ` [PATCH 22/29] crypto: talitos - Move SEC1 ops into talitos-sec1.c Paul Louvel
2026-05-28 9:08 ` [PATCH 23/29] crypto: talitos - Move SEC2 ops into talitos-sec2.c Paul Louvel
2026-05-28 9:08 ` [PATCH 24/29] crypto: talitos - Introduce per-SEC-version pointer helper ops Paul Louvel
2026-06-04 9:48 ` Christophe Leroy (CS GROUP) [this message]
2026-05-28 9:08 ` [PATCH 25/29] crypto: talitos - Dispatch pointer helpers through ptr_ops Paul Louvel
2026-05-28 9:08 ` [PATCH 26/29] crypto: talitos - Remove now-unused global pointer helpers Paul Louvel
2026-05-28 9:08 ` [PATCH 27/29] crypto: talitos - Introduce per-SEC-version descriptor structures and ops Paul Louvel
2026-06-04 9:57 ` Christophe Leroy (CS GROUP)
2026-06-04 13:01 ` Paul Louvel
2026-05-28 9:08 ` [PATCH 28/29] crypto: talitos - Clean up includes in core driver file Paul Louvel
2026-05-28 9:08 ` [PATCH 29/29] crypto: talitos - Remove TALITOS_DESC_SIZE macro Paul Louvel
2026-06-04 9:59 ` Christophe Leroy (CS GROUP)
2026-06-04 13:01 ` Paul Louvel
2026-06-01 6:15 ` [PATCH 00/29] crypto: talitos - Driver cleanup Christophe Leroy (CS GROUP)
2026-06-01 9:17 ` Paul Louvel
2026-06-01 10:27 ` Christophe Leroy (CS GROUP)
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=8c540731-8bd3-4b7d-ad83-428a11297e00@kernel.org \
--to=chleroy@kernel.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=herve.codina@bootlin.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paul.louvel@bootlin.com \
--cc=thomas.petazzoni@bootlin.com \
/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
Powered by JetHome