On Mon, 27 Jul 2026 19:15:58 -0700
Eric Biggers <[email protected]> wrote:

> Checking both boot_cpu_has(X86_FEATURE_AVX*) and cpu_has_xfeatures() has
> never really been needed in practice, and it's never been universally
> done (e.g., lib/raid/ omits cpu_has_xfeatures()).  Nevertheless, both
> x86 and UML now explicitly clear the AVX and AVX-512 flags if their
> xfeatures are missing, which should remove any remaining doubts.
> 
> Thus, remove all the calls to cpu_has_xfeatures(), as well as the
> related checks of boot_cpu_has(X86_FEATURE_OSXSAVE).
> 
> In a few cases there was no corresponding boot_cpu_has(X86_FEATURE_AVX*)
> check, so add the missing ones.
> 
> Signed-off-by: Eric Biggers <[email protected]>
> ---
...
> --- a/arch/x86/crypto/aria_gfni_avx512_glue.c
> +++ b/arch/x86/crypto/aria_gfni_avx512_glue.c
> @@ -196,24 +196,15 @@ static struct skcipher_alg aria_algs[] = {
>  
>  static int __init aria_avx512_init(void)
>  {
> -     const char *feature_name;
> -
>       if (!boot_cpu_has(X86_FEATURE_AVX) ||
>           !boot_cpu_has(X86_FEATURE_AVX2) ||

Doesn't AVX2 require AVX support?

>           !boot_cpu_has(X86_FEATURE_AVX512F) ||
>           !boot_cpu_has(X86_FEATURE_AVX512VL) ||

And (less sure) AVX512xxx require AVX2?

So the extra checks could be reduced.

        David

> -         !boot_cpu_has(X86_FEATURE_GFNI) ||
> -         !boot_cpu_has(X86_FEATURE_OSXSAVE)) {
> +         !boot_cpu_has(X86_FEATURE_GFNI)) {

Reply via email to