* [PATCH] crypto: arm64/ghash - Reduce boilerplate
@ 2026-11-09 16:45 Uwe Kleine-König
2026-11-10 21:06 ` Eric Biggers
0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2026-11-09 16:45 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, Catalin Marinas, Will Deacon
Cc: Mark Rutland, linux-crypto, linux-arm-kernel
Make use of module_cpu_feature_match() which expands to nearly the code
that is typed out.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
arch/arm64/crypto/ghash-ce-glue.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-ce-glue.c
index eaf2932ceaf5..0884f812a315 100644
--- a/arch/arm64/crypto/ghash-ce-glue.c
+++ b/arch/arm64/crypto/ghash-ce-glue.c
@@ -384,7 +384,8 @@ static struct aead_alg gcm_aes_algs[] = {{
static int __init ghash_ce_mod_init(void)
{
- if (!cpu_have_named_feature(ASIMD) || !cpu_have_named_feature(PMULL))
+ /* ASIMD is implied by PMULL, but better be safe than sorry */
+ if (!cpu_have_named_feature(ASIMD))
return -ENODEV;
return crypto_register_aeads(gcm_aes_algs, ARRAY_SIZE(gcm_aes_algs));
@@ -395,10 +396,5 @@ static void __exit ghash_ce_mod_exit(void)
crypto_unregister_aeads(gcm_aes_algs, ARRAY_SIZE(gcm_aes_algs));
}
-static const struct cpu_feature __maybe_unused ghash_cpu_feature[] = {
- { cpu_feature(PMULL) }, { }
-};
-MODULE_DEVICE_TABLE(cpu, ghash_cpu_feature);
-
-module_init(ghash_ce_mod_init);
+module_cpu_feature_match(PMULL, ghash_ce_mod_init);
module_exit(ghash_ce_mod_exit);
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
--
2.56.0.rc1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: arm64/ghash - Reduce boilerplate
2026-11-09 16:45 [PATCH] crypto: arm64/ghash - Reduce boilerplate Uwe Kleine-König
@ 2026-11-10 21:06 ` Eric Biggers
0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2026-11-10 21:06 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Herbert Xu, David S. Miller, Catalin Marinas, Will Deacon,
Mark Rutland, linux-crypto, linux-arm-kernel
On Mon, Nov 09, 2026 at 05:45:02PM +0100, Uwe Kleine-König wrote:
> Make use of module_cpu_feature_match() which expands to nearly the code
> that is typed out.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> arch/arm64/crypto/ghash-ce-glue.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-ce-glue.c
> index eaf2932ceaf5..0884f812a315 100644
> --- a/arch/arm64/crypto/ghash-ce-glue.c
> +++ b/arch/arm64/crypto/ghash-ce-glue.c
> @@ -384,7 +384,8 @@ static struct aead_alg gcm_aes_algs[] = {{
>
> static int __init ghash_ce_mod_init(void)
> {
> - if (!cpu_have_named_feature(ASIMD) || !cpu_have_named_feature(PMULL))
> + /* ASIMD is implied by PMULL, but better be safe than sorry */
> + if (!cpu_have_named_feature(ASIMD))
> return -ENODEV;
The ASIMD check can be dropped too. There's already other code that
assumes PMULL implies ASIMD.
- Eric
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-10 21:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-09 16:45 [PATCH] crypto: arm64/ghash - Reduce boilerplate Uwe Kleine-König
2026-11-10 21:06 ` Eric Biggers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox