mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 02:44:41 +03:00
Linux 5.0 compat: SIMD compatibility
Restore the SIMD optimization for 4.19.38 LTS, 4.14.120 LTS, and 5.0 and newer kernels. This commit squashes the following commits from master in to a single commit which can be applied to 0.8.2.10fa2545- Linux 4.14, 4.19, 5.0+ compat: SIMD save/restoreb88ca2ac- Enable SIMD for encryption095b5412- Fix CONFIG_X86_DEBUG_FPU build failuree5db3134- Linux 5.0 compat: SIMD compatibility Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> TEST_ZIMPORT_SKIP="yes"
This commit is contained in:
committed by
Tony Hutter
parent
988b040476
commit
62c034f6d4
+69
-8
@@ -2,8 +2,9 @@ dnl #
|
||||
dnl # Handle differences in kernel FPU code.
|
||||
dnl #
|
||||
dnl # Kernel
|
||||
dnl # 5.0: All kernel fpu functions are GPL only, so we can't use them.
|
||||
dnl # (nothing defined)
|
||||
dnl # 5.0: Wrappers have been introduced to save/restore the FPU state.
|
||||
dnl # This change was made to the 4.19.38 and 4.14.120 LTS kernels.
|
||||
dnl # HAVE_KERNEL_FPU_INTERNAL
|
||||
dnl #
|
||||
dnl # 4.2: Use __kernel_fpu_{begin,end}()
|
||||
dnl # HAVE_UNDERSCORE_KERNEL_FPU & KERNEL_EXPORTS_X86_FPU
|
||||
@@ -12,7 +13,11 @@ dnl # Pre-4.2: Use kernel_fpu_{begin,end}()
|
||||
dnl # HAVE_KERNEL_FPU & KERNEL_EXPORTS_X86_FPU
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_FPU], [
|
||||
AC_MSG_CHECKING([which kernel_fpu header to use])
|
||||
dnl #
|
||||
dnl # N.B. The header check is performed before all other checks since
|
||||
dnl # it depends on HAVE_KERNEL_FPU_API_HEADER being set in confdefs.h.
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether fpu headers are available])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/module.h>
|
||||
#include <asm/fpu/api.h>
|
||||
@@ -25,9 +30,13 @@ AC_DEFUN([ZFS_AC_KERNEL_FPU], [
|
||||
AC_MSG_RESULT(i387.h & xcr.h)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([which kernel_fpu function to use])
|
||||
dnl #
|
||||
dnl # Legacy kernel
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether kernel fpu is available])
|
||||
ZFS_LINUX_TRY_COMPILE_SYMBOL([
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
#ifdef HAVE_KERNEL_FPU_API_HEADER
|
||||
#include <asm/fpu/api.h>
|
||||
#else
|
||||
@@ -45,8 +54,12 @@ AC_DEFUN([ZFS_AC_KERNEL_FPU], [
|
||||
AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1,
|
||||
[kernel exports FPU functions])
|
||||
],[
|
||||
dnl #
|
||||
dnl # Linux 4.2 kernel
|
||||
dnl #
|
||||
ZFS_LINUX_TRY_COMPILE_SYMBOL([
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
#ifdef HAVE_KERNEL_FPU_API_HEADER
|
||||
#include <asm/fpu/api.h>
|
||||
#else
|
||||
@@ -57,12 +70,60 @@ AC_DEFUN([ZFS_AC_KERNEL_FPU], [
|
||||
],[
|
||||
__kernel_fpu_begin();
|
||||
__kernel_fpu_end();
|
||||
], [__kernel_fpu_begin], [arch/x86/kernel/fpu/core.c arch/x86/kernel/i387.c], [
|
||||
], [__kernel_fpu_begin],
|
||||
[arch/x86/kernel/fpu/core.c arch/x86/kernel/i387.c], [
|
||||
AC_MSG_RESULT(__kernel_fpu_*)
|
||||
AC_DEFINE(HAVE_UNDERSCORE_KERNEL_FPU, 1, [kernel has __kernel_fpu_* functions])
|
||||
AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1, [kernel exports FPU functions])
|
||||
AC_DEFINE(HAVE_UNDERSCORE_KERNEL_FPU, 1,
|
||||
[kernel has __kernel_fpu_* functions])
|
||||
AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1,
|
||||
[kernel exports FPU functions])
|
||||
],[
|
||||
AC_MSG_RESULT(not exported)
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/module.h>
|
||||
|
||||
#if defined(__x86_64) || defined(__x86_64__) || \
|
||||
defined(__i386) || defined(__i386__)
|
||||
#if !defined(__x86)
|
||||
#define __x86
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(__x86)
|
||||
#error Unsupported architecture
|
||||
#endif
|
||||
|
||||
#include <linux/types.h>
|
||||
#ifdef HAVE_KERNEL_FPU_API_HEADER
|
||||
#include <asm/fpu/api.h>
|
||||
#include <asm/fpu/internal.h>
|
||||
#else
|
||||
#include <asm/i387.h>
|
||||
#include <asm/xcr.h>
|
||||
#endif
|
||||
|
||||
#if !defined(XSTATE_XSAVE)
|
||||
#error XSTATE_XSAVE not defined
|
||||
#endif
|
||||
|
||||
#if !defined(XSTATE_XRESTORE)
|
||||
#error XSTATE_XRESTORE not defined
|
||||
#endif
|
||||
],[
|
||||
struct fpu *fpu = ¤t->thread.fpu;
|
||||
union fpregs_state *st = &fpu->state;
|
||||
struct fregs_state *fr __attribute__ ((unused)) =
|
||||
&st->fsave;
|
||||
struct fxregs_state *fxr __attribute__ ((unused)) =
|
||||
&st->fxsave;
|
||||
struct xregs_state *xr __attribute__ ((unused)) =
|
||||
&st->xsave;
|
||||
], [
|
||||
AC_MSG_RESULT(internal)
|
||||
AC_DEFINE(HAVE_KERNEL_FPU_INTERNAL, 1,
|
||||
[kernel fpu internal])
|
||||
],[
|
||||
AC_MSG_RESULT(unavailable)
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user