Linux x86 SIMD: factor out unneeded kernel dependencies

Cleanup the kernel SIMD code by removing kernel dependencies.

 - Replace XSTATE_XSAVE with our own XSAVE implementation for all
   kernels not exporting kernel_fpu{begin,end}(), see #13059

 - Replace union fpregs_state by a uint8_t * buffer and get the size
   of the buffer from the hardware via the CPUID instruction

 - Replace kernels xgetbv() by our own implementation which was
   already there for userspace.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes #13102
This commit is contained in:
Attila Fülöp
2022-03-09 01:19:15 +01:00
committed by GitHub
parent a86e089415
commit ce7a5dbf4b
3 changed files with 118 additions and 240 deletions
+3 -3
View File
@@ -1001,10 +1001,10 @@ zfs_prop_align_right(zfs_prop_t prop)
#include <sys/simd.h>
#if defined(HAVE_KERNEL_FPU_INTERNAL) || defined(HAVE_KERNEL_FPU_XSAVE_INTERNAL)
union fpregs_state **zfs_kfpu_fpregs;
#if defined(HAVE_KERNEL_FPU_INTERNAL)
uint8_t **zfs_kfpu_fpregs;
EXPORT_SYMBOL(zfs_kfpu_fpregs);
#endif /* HAVE_KERNEL_FPU_INTERNAL || HAVE_KERNEL_FPU_XSAVE_INTERNAL */
#endif /* defined(HAVE_KERNEL_FPU_INTERNAL) */
static int __init
zcommon_init(void)