1dnl # 2dnl # Handle differences in kernel FPU code. 3dnl # 4dnl # Kernel 5dnl # 5.11: kernel_fpu_begin() is an inlined function now, so don't check 6dnl # for it inside the kernel symbols. 7dnl # 8dnl # 5.0: Wrappers have been introduced to save/restore the FPU state. 9dnl # This change was made to the 4.19.38 and 4.14.120 LTS kernels. 10dnl # HAVE_KERNEL_FPU_INTERNAL 11dnl # 12dnl # 4.2: Use __kernel_fpu_{begin,end}() 13dnl # HAVE_UNDERSCORE_KERNEL_FPU & KERNEL_EXPORTS_X86_FPU 14dnl # 15dnl # Pre-4.2: Use kernel_fpu_{begin,end}() 16dnl # HAVE_KERNEL_FPU & KERNEL_EXPORTS_X86_FPU 17dnl # 18dnl # N.B. The header check is performed before all other checks since it 19dnl # depends on HAVE_KERNEL_FPU_API_HEADER being set in confdefs.h. 20dnl # 21AC_DEFUN([ZFS_AC_KERNEL_FPU_HEADER], [ 22 AC_MSG_CHECKING([whether fpu headers are available]) 23 ZFS_LINUX_TRY_COMPILE([ 24 #include <linux/module.h> 25 #include <asm/fpu/api.h> 26 ],[ 27 ],[ 28 AC_DEFINE(HAVE_KERNEL_FPU_API_HEADER, 1, 29 [kernel has asm/fpu/api.h]) 30 AC_MSG_RESULT(asm/fpu/api.h) 31 ],[ 32 AC_MSG_RESULT(i387.h) 33 ]) 34]) 35 36AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [ 37 ZFS_LINUX_TEST_SRC([kernel_fpu], [ 38 #include <linux/types.h> 39 #ifdef HAVE_KERNEL_FPU_API_HEADER 40 #include <asm/fpu/api.h> 41 #include <asm/fpu/internal.h> 42 #else 43 #include <asm/i387.h> 44 #endif 45 ], [ 46 kernel_fpu_begin(); 47 kernel_fpu_end(); 48 ], [], [ZFS_META_LICENSE]) 49 50 ZFS_LINUX_TEST_SRC([__kernel_fpu], [ 51 #include <linux/types.h> 52 #ifdef HAVE_KERNEL_FPU_API_HEADER 53 #include <asm/fpu/api.h> 54 #include <asm/fpu/internal.h> 55 #else 56 #include <asm/i387.h> 57 #endif 58 ], [ 59 __kernel_fpu_begin(); 60 __kernel_fpu_end(); 61 ], [], [ZFS_META_LICENSE]) 62 63]) 64 65AC_DEFUN([ZFS_AC_KERNEL_FPU], [ 66 dnl # 67 dnl # Legacy kernel 68 dnl # 69 AC_MSG_CHECKING([whether kernel fpu is available]) 70 ZFS_LINUX_TEST_RESULT([kernel_fpu_license], [ 71 AC_MSG_RESULT(kernel_fpu_*) 72 AC_DEFINE(HAVE_KERNEL_FPU, 1, 73 [kernel has kernel_fpu_* functions]) 74 AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1, 75 [kernel exports FPU functions]) 76 ],[ 77 dnl # 78 dnl # Linux 4.2 kernel 79 dnl # 80 ZFS_LINUX_TEST_RESULT_SYMBOL([__kernel_fpu_license], 81 [__kernel_fpu_begin], 82 [arch/x86/kernel/fpu/core.c arch/x86/kernel/i387.c], [ 83 AC_MSG_RESULT(__kernel_fpu_*) 84 AC_DEFINE(HAVE_UNDERSCORE_KERNEL_FPU, 1, 85 [kernel has __kernel_fpu_* functions]) 86 AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1, 87 [kernel exports FPU functions]) 88 ],[ 89 AC_MSG_RESULT(internal) 90 AC_DEFINE(HAVE_KERNEL_FPU_INTERNAL, 1, 91 [kernel fpu internal]) 92 ]) 93 ]) 94]) 95