SIMD: Don't require definition of HAVE_XSAVE

Currently we fail the compilation via the #error directive if
`HAVE_XSAVE` isn't defined. This breaks i586 builds since we check
the toolchains SIMD support only on i686 and onward.

Remove the requirement to fix the build on i586.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes #13303
Closes #17590
This commit is contained in:
Attila Fülöp 2025-08-04 01:30:58 +02:00 committed by Brian Behlendorf
parent 0c7d6e20e6
commit 57b614e025

View File

@ -139,15 +139,6 @@
*/ */
#if defined(HAVE_KERNEL_FPU_INTERNAL) #if defined(HAVE_KERNEL_FPU_INTERNAL)
/*
* For kernels not exporting *kfpu_{begin,end} we have to use inline assembly
* with the XSAVE{,OPT,S} instructions, so we need the toolchain to support at
* least XSAVE.
*/
#if !defined(HAVE_XSAVE)
#error "Toolchain needs to support the XSAVE assembler instruction"
#endif
#ifndef XFEATURE_MASK_XTILE #ifndef XFEATURE_MASK_XTILE
/* /*
* For kernels where this doesn't exist yet, we still don't want to break * For kernels where this doesn't exist yet, we still don't want to break
@ -335,9 +326,13 @@ kfpu_begin(void)
return; return;
} }
#endif #endif
#if defined(HAVE_XSAVE)
if (static_cpu_has(X86_FEATURE_XSAVE)) { if (static_cpu_has(X86_FEATURE_XSAVE)) {
kfpu_do_xsave("xsave", state, ~XFEATURE_MASK_XTILE); kfpu_do_xsave("xsave", state, ~XFEATURE_MASK_XTILE);
} else if (static_cpu_has(X86_FEATURE_FXSR)) { return;
}
#endif
if (static_cpu_has(X86_FEATURE_FXSR)) {
kfpu_save_fxsr(state); kfpu_save_fxsr(state);
} else { } else {
kfpu_save_fsave(state); kfpu_save_fsave(state);
@ -390,9 +385,13 @@ kfpu_end(void)
goto out; goto out;
} }
#endif #endif
#if defined(HAVE_XSAVE)
if (static_cpu_has(X86_FEATURE_XSAVE)) { if (static_cpu_has(X86_FEATURE_XSAVE)) {
kfpu_do_xrstor("xrstor", state, ~XFEATURE_MASK_XTILE); kfpu_do_xrstor("xrstor", state, ~XFEATURE_MASK_XTILE);
} else if (static_cpu_has(X86_FEATURE_FXSR)) { goto out;
}
#endif
if (static_cpu_has(X86_FEATURE_FXSR)) {
kfpu_restore_fxsr(state); kfpu_restore_fxsr(state);
} else { } else {
kfpu_restore_fsave(state); kfpu_restore_fsave(state);