mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 00/29] crypto: talitos - Driver cleanup
Date: Mon, 1 Jun 2026 08:15:54 +0200	[thread overview]
Message-ID: <1488f7b3-cda0-4267-827c-fae23b17c1e8@kernel.org> (raw)
In-Reply-To: <20260528-7-1-rc1_talitos_cleanup-v1-0-cb1ad6cdea49@bootlin.com>



Le 28/05/2026 à 11:08, Paul Louvel a écrit :
> The Freescale Integrated Security Engine (SEC) aka "Talitos" driver
> implementation is a monolithic ~3800-line file that mixes SEC1 and SEC2
> hardware variants with hash, skcipher, aead and hwrng algorithm.
> 
> This series reorganises the driver to improve readability and
> maintainability.

Did you analyse the cost of this series ? bloat-o-meter gives the 
following result, allthough I'm a bit surprised there are only added 
items, no removed items:

add/remove: 36/0 grow/shrink: 44/0 up/down: 34309/0 (34309)
Function                                     old     new   delta
aead_driver_algs                               -    9280   +9280
hash_driver_algs                               -    5568   +5568
skcipher_driver_algs                           -    3712   +3712
ipsec_esp                                   1552    3088   +1536
ahash_process_req                           1912    3368   +1456
common_nonsnoop.constprop                    884    1704    +820
aead_des3_setkey                             628    1256    +628
ahash_setkey                                 608    1220    +612
ipsec_esp_unmap                              468    1028    +560
sec1_talitos_handle_error                      -     548    +548
aead_setkey                                  460     920    +460
talitos1_interrupt_4ch                      2204    2648    +444
aead_decrypt                                 432     868    +436
free_edesc_list_from                         348     772    +424
sec1_dma_map_request                           -     356    +356
ahash_import                                 352     708    +356
talitos_register_hash                          -     344    +344
skcipher_setkey.isra                           -     336    +336
ahash_export                                 312     628    +316
ahash_init                                   300     604    +304
talitos1_done_4ch                            280     560    +280
common_nonsnoop_unmap                        192     460    +268
talitos_rng_init                             252     504    +252
ipsec_esp_decrypt_swauth_done                236     472    +236
sec1_reset_device                              -     220    +220
talitos_register_aead                          -     208    +208
sec1_reset_channel                             -     208    +208
sec1_talitos_probe_irq                         -     204    +204
talitos1_done_ch0                            196     392    +196
skcipher_encrypt                             164     360    +196
skcipher_decrypt                             164     360    +196
skcipher_des3_setkey                         192     380    +188
ipsec_esp_decrypt_hwauth_done                144     320    +176
ipsec_esp_encrypt_done                       172     344    +172
ahash_digest_sha224_swinit                   172     344    +172
talitos_rng_data_present                     164     328    +164
ahash_init_sha224_swinit                     164     328    +164
aead_encrypt                                 132     296    +164
skcipher_done                                144     292    +148
talitos_register_skcipher                      -     144    +144
skcipher_des_setkey                          140     280    +140
sec1_get_request_hdr                           -     132    +132
sec1_dma_unmap_request                         -     132    +132
crypto_des_verify_key                        132     264    +132
talitos_register_rng                           -     124    +124
sec1_configure_device                          -     108    +108
aead_edesc_alloc                             104     208    +104
skcipher_edesc_alloc                          92     184     +92
ahash_done                                    92     184     +92
skcipher_aes_setkey                           44     120     +76
sec1_search_desc_hdr_in_request                -      76     +76
talitos_unregister_rng                         -      68     +68
talitos_rng_data_read                         64     128     +64
padded_hash                                   64     128     +64
ahash_digest                                  60     120     +60
sec1_init_task                                 -      52     +52
sec1_ops                                       -      40     +40
talitos_register_sec1                          -      32     +32
talitos_cra_init_ahash                        84     108     +24
sec1_ptr_ops                                   -      24     +24
sec1_copy_talitos_ptr                          -      20     +20
talitos_cra_init_skcipher                     76      92     +16
talitos_cra_init_aead                         76      92     +16
sec1_get_ptr                                   -      16     +16
sec1_desc_ops                                  -      16     +16
ahash_update                                  16      32     +16
ahash_finup                                   16      32     +16
ahash_final                                   16      32     +16
sec1_to_talitos_ptr                            -      12     +12
talitos_cra_exit_skcipher                      -       8      +8
talitos_cra_exit_ahash                         -       8      +8
talitos_cra_exit_aead                          -       8      +8
sec1_set_hdr                                   -       8      +8
sec1_get_ptr_value                             -       8      +8
sec1_get_hdr_lo                                -       8      +8
sec1_get_hdr                                   -       8      +8
sec1_from_talitos_ptr_len                      -       8      +8
__already_done                                 2       7      +5
sec1_to_talitos_ptr_ext_set                    -       4      +4
sec1_to_talitos_ptr_ext_or                     -       4      +4
Total: Before=41269, After=75578, chg +83.14%



> One of the main motivation for this series is to eleminate all the
> conditionals around the has_ftr_sec1(). Some checks still remains in
> crypto algorithm implementation at the end of the series.
> 
> Patch 1 adds the CRYPTO_AHASH_ALG_BLOCK_ONLY flag for the ahash
> implementation to eliminate manual partial-block buffering.
> 
> Driver reorganisation (patches 2-9):
> 
>    Move the driver into a dedicated directory, split the different crypto
>    implementation into dedicated translation units.
> 
> Algorithm definition cleanup (patches 10-17):
> 
>    Remove algorithm property mutations from the registration loop, delete
>    the now-unused priority field in struct talitos_alg_template, and
>    convert hash, skcipher and aead to the type-specific init_tfm/exit_tfm
>    API, replacing the deprecated cra_init/cra_exit fields.
> 
>    Use preprocessor macros to deduplicate the hash, skcipher and aead
>    algorithm definitions.
> 
> SEC1/SEC2 ops abstraction (patches 18-27):
> 
>    Introduce struct talitos_ops, split SEC1/SEC2-specific
>    code into separate function variants, and replace runtime is_sec1
>    conditionals with indirect calls through the ops table.
> 
>    Export common channel and error handling routines, and move SEC1 and
>    SEC2 ops into dedicated translation units.
> 
>    Introduce struct talitos_ptr_ops to abstract SEC1/SEC2 pointer
>    helpers behind per-SEC-version ops, then remove the now-unused
>    global pointer helper functions.
> 
>    Introduce per-SEC-version descriptor structures and ops.
> 
> Patch 28 cleans up the includes in the core driver file now that all
> crypto implementation code has been moved out.
> 
> Patch 29 removes a now-useless macro.
> 
> No functional changes are intended for patches 2-29.
> 
> This series depends on the "crypto: talitos - bug fixes" series :
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch.msgid.link%2F20260507-bootlin_test-7-1-rc1_sec_bugfix-v3-0-c98d7589b942%40bootlin.com&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C55c202dc74294a47211f08debc98cf05%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639155561647821924%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=jor10ujpsx58tqxZUNGvDx63lqwVJW5asMdUS8CF1zg%3D&reserved=0
> 
> Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
> ---
> Paul Louvel (29):
>        crypto: talitos/hash - Use CRYPTO_AHASH_BLOCK_ONLY API
>        crypto: talitos - Move driver into dedicated directory
>        crypto: talitos - Add missing includes to driver header file
>        crypto: talitos/hwrng - Move into separate file
>        crypto: talitos - Prepare crypto implementation file splitting
>        crypto: talitos - Introduce registration helper
>        crypto: talitos/hash - Move into separate file
>        crypto: talitos/skcipher - Move into separate file
>        crypto: talitos/aead - Move into separate file
>        crypto: talitos - Remove alg settings in talitos_register_common()
>        crypto: talitos - Remove unused priority field in struct talitos_alg_template
>        crypto: talitos/hash - Convert to init_tfm/exit_tfm type-specific API
>        crypto: talitos/skcipher - Convert to init/exit type-specific API
>        crypto: talitos/aead - Convert to init/exit type-specific API
>        crypto: talitos/hash - Use macro for algorithm definitions
>        crypto: talitos/skcipher - Use macro for algorithm definitions
>        crypto: talitos/aead - Use macro for algorithm definitions
>        crypto: talitos - Split SEC1/SEC2 code into separate function variants
>        crypto: talitos - Introduce struct talitos_ops
>        crypto: talitos - Replace SEC1/SEC2 conditionals with ops dispatch
>        crypto: talitos - Export common channel and error handling routines
>        crypto: talitos - Move SEC1 ops into talitos-sec1.c
>        crypto: talitos - Move SEC2 ops into talitos-sec2.c
>        crypto: talitos - Introduce per-SEC-version pointer helper ops
>        crypto: talitos - Dispatch pointer helpers through ptr_ops
>        crypto: talitos - Remove now-unused global pointer helpers
>        crypto: talitos - Introduce per-SEC-version descriptor structures and ops
>        crypto: talitos - Clean up includes in core driver file
>        crypto: talitos - Remove TALITOS_DESC_SIZE macro
> 
>   drivers/crypto/Kconfig                    |   38 +-
>   drivers/crypto/Makefile                   |    2 +-
>   drivers/crypto/talitos.c                  | 3640 -----------------------------
>   drivers/crypto/talitos/Kconfig            |   36 +
>   drivers/crypto/talitos/Makefile           |    6 +
>   drivers/crypto/talitos/talitos-aead.c     |  677 ++++++
>   drivers/crypto/talitos/talitos-hash.c     |  711 ++++++
>   drivers/crypto/talitos/talitos-rng.c      |   93 +
>   drivers/crypto/talitos/talitos-sec1.c     |  374 +++
>   drivers/crypto/talitos/talitos-sec2.c     |  404 ++++
>   drivers/crypto/talitos/talitos-skcipher.c |  364 +++
>   drivers/crypto/talitos/talitos.c          |  917 ++++++++
>   drivers/crypto/{ => talitos}/talitos.h    |  255 +-
>   13 files changed, 3810 insertions(+), 3707 deletions(-)
> ---
> base-commit: db8b9f227833e729faf44a512aa1e88a625b5ad8
> change-id: 20260518-7-1-rc1_talitos_cleanup-9231a64e29fa
> prerequisite-change-id: 20260504-bootlin_test-7-1-rc1_sec_bugfix-13169ed07ddc:v3
> prerequisite-patch-id: 7b364911e4b8d1c1033eb14e67ed24dac6a4bc13
> prerequisite-patch-id: 2c1cd7fdd003d9a116a697efa25d1716d548389f
> prerequisite-patch-id: b12bdbf565747609e0cfe0609a42cf69b5d816a1
> prerequisite-patch-id: 72cb2bc0fc2a48a5a029b049c199f4c86085cf04
> prerequisite-patch-id: 5f1f5ad6add760161bd48875df48c0893aa12613
> prerequisite-patch-id: 934931086968229434d15a2f2358aeb7e6975a1d
> prerequisite-patch-id: 8a0b4828fc0690e0c841bc9adcc6568bb522e0e8
> prerequisite-patch-id: 1d870f32e7dbf9a8bd3b8979558544107693e0f4
> prerequisite-patch-id: 758c18d7c9fabb14bd90df62e5e8a62a6f880db4
> prerequisite-patch-id: ce6e9e585f8edc1861ae6bb8fbdd836c20cbd290
> prerequisite-patch-id: 9446dc03e442ea81c5f5b39e802e01b37da29971
> 
> Best regards,
> --
> Paul Louvel, Bootlin
> Embedded Linux and Kernel engineering
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbootlin.com%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C55c202dc74294a47211f08debc98cf05%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639155561647851452%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=orDISoOYFS%2F%2F0ThHpS71R6nscnJxyMar0jASTbsYdG8%3D&reserved=0
> 


  parent reply	other threads:[~2026-06-01  6:15 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28  9:08 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)
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 ` Christophe Leroy (CS GROUP) [this message]
2026-06-01  9:17   ` [PATCH 00/29] crypto: talitos - Driver cleanup 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=1488f7b3-cda0-4267-827c-fae23b17c1e8@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

all inboxes | Powered by JetHome®