> -----Original Message----- > From: Roxana Nicolescu <roxana.nicolescu@xxxxxxxxxxxxx> > Sent: Tuesday, October 31, 2023 8:19 AM > To: Eric Biggers <ebiggers@xxxxxxxxxx>; linux-crypto@xxxxxxxxxxxxxxx > Subject: Re: [PATCH] crypto: x86/sha256 - autoload if SHA-NI detected > > On 29/10/2023 06:15, Eric Biggers wrote: > > From: Eric Biggers <ebiggers@xxxxxxxxxx> > > > > The x86 SHA-256 module contains four implementations: SSSE3, AVX, AVX2, > > and SHA-NI. Commit 1c43c0f1f84a ("crypto: x86/sha - load modules based > > on CPU features") made the module be autoloaded when SSSE3, AVX, or AVX2 > > is detected. The omission of SHA-NI appears to be an oversight, perhaps > > because of the outdated file-level comment. This patch fixes this, > > though in practice this makes no difference because SSSE3 is a subset of > > the other three features anyway. Indeed, sha256_ni_transform() executes > > SSSE3 instructions such as pshufb. > > > > Cc: Roxana Nicolescu <roxana.nicolescu@xxxxxxxxxxxxx> > > Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx> > > Indeed, it was an oversight. > > Reviewed-by: Roxana Nicolescu <roxana.nicolescu@xxxxxxxxxxxxx> > > --- > > arch/x86/crypto/sha256_ssse3_glue.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/arch/x86/crypto/sha256_ssse3_glue.c > b/arch/x86/crypto/sha256_ssse3_glue.c > > index 4c0383a90e11..a135cf9baca3 100644 > > --- a/arch/x86/crypto/sha256_ssse3_glue.c ... > > > > static const struct x86_cpu_id module_cpu_ids[] = { > > + X86_MATCH_FEATURE(X86_FEATURE_SHA_NI, NULL), Unless something else has changed, this needs to be inside ifdefs, as discovered in the proposed patch series last year: for sha1_sse3_glue.c: #ifdef CONFIG_AS_SHA1_NI X86_MATCH_FEATURE(X86_FEATURE_SHA_NI, NULL), #endif for sha256_sse3_glue.c: +#ifdef CONFIG_AS_SHA256_NI + X86_MATCH_FEATURE(X86_FEATURE_SHA_NI, NULL), +#endif > > X86_MATCH_FEATURE(X86_FEATURE_AVX2, NULL), > > X86_MATCH_FEATURE(X86_FEATURE_AVX, NULL), > > X86_MATCH_FEATURE(X86_FEATURE_SSSE3, NULL), > > {} > > }; > > MODULE_DEVICE_TABLE(x86cpu, module_cpu_ids);