[2.1] compat: add check for kernel_neon_* availability
This patch backports the change from #15711 (to ZFS 2.2.x) because some OS vendors have back-ported this change from Linux 6.2+ to their older kernels. The original patch addressed these issues: 1. Linux 6.2+ on arm64 has exported them with `EXPORT_SYMBOL_GPL`, so license compatibility must be checked before use. 2. On both arm and arm64, the definitions of these symbols are guarded by `CONFIG_KERNEL_MODE_NEON`, but their declarations are still present. Checking in configuration phase only leads to MODPOST errors (undefined references). Signed-off-by: Keith Gable <keith@ziggythehamster.sh> Co-authored-by: Shengqi Chen <harry-chen@outlook.com>
This commit is contained in:
parent
12a031a3f5
commit
f8f3cac084
|
@ -91,6 +91,13 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [
|
||||||
__kernel_fpu_end();
|
__kernel_fpu_end();
|
||||||
], [], [ZFS_META_LICENSE])
|
], [], [ZFS_META_LICENSE])
|
||||||
|
|
||||||
|
ZFS_LINUX_TEST_SRC([kernel_neon], [
|
||||||
|
#include <asm/neon.h>
|
||||||
|
], [
|
||||||
|
kernel_neon_begin();
|
||||||
|
kernel_neon_end();
|
||||||
|
], [], [ZFS_META_LICENSE])
|
||||||
|
|
||||||
ZFS_LINUX_TEST_SRC([fpu_internal], [
|
ZFS_LINUX_TEST_SRC([fpu_internal], [
|
||||||
#if defined(__x86_64) || defined(__x86_64__) || \
|
#if defined(__x86_64) || defined(__x86_64__) || \
|
||||||
defined(__i386) || defined(__i386__)
|
defined(__i386) || defined(__i386__)
|
||||||
|
@ -186,18 +193,28 @@ AC_DEFUN([ZFS_AC_KERNEL_FPU], [
|
||||||
AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1,
|
AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1,
|
||||||
[kernel exports FPU functions])
|
[kernel exports FPU functions])
|
||||||
],[
|
],[
|
||||||
ZFS_LINUX_TEST_RESULT([fpu_internal], [
|
dnl #
|
||||||
AC_MSG_RESULT(internal)
|
dnl # ARM neon symbols (only on arm and arm64)
|
||||||
AC_DEFINE(HAVE_KERNEL_FPU_INTERNAL, 1,
|
dnl # could be GPL-only on arm64 after Linux 6.2
|
||||||
[kernel fpu internal])
|
dnl #
|
||||||
|
ZFS_LINUX_TEST_RESULT([kernel_neon_license],[
|
||||||
|
AC_MSG_RESULT(kernel_neon_*)
|
||||||
|
AC_DEFINE(HAVE_KERNEL_NEON, 1,
|
||||||
|
[kernel has kernel_neon_* functions])
|
||||||
],[
|
],[
|
||||||
ZFS_LINUX_TEST_RESULT([fpu_xsave_internal], [
|
ZFS_LINUX_TEST_RESULT([fpu_internal], [
|
||||||
AC_MSG_RESULT(internal with internal XSAVE)
|
AC_MSG_RESULT(internal)
|
||||||
AC_DEFINE(HAVE_KERNEL_FPU_XSAVE_INTERNAL, 1,
|
AC_DEFINE(HAVE_KERNEL_FPU_INTERNAL, 1,
|
||||||
[kernel fpu and XSAVE internal])
|
[kernel fpu internal])
|
||||||
],[
|
],[
|
||||||
AC_MSG_RESULT(unavailable)
|
ZFS_LINUX_TEST_RESULT([fpu_xsave_internal], [
|
||||||
])
|
AC_MSG_RESULT(internal with internal XSAVE)
|
||||||
|
AC_DEFINE(HAVE_KERNEL_FPU_XSAVE_INTERNAL, 1,
|
||||||
|
[kernel fpu and XSAVE internal])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(unavailable)
|
||||||
|
])
|
||||||
|
])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
|
@ -43,9 +43,15 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <asm/neon.h>
|
#include <asm/neon.h>
|
||||||
|
|
||||||
|
#if (defined(HAVE_KERNEL_NEON) && defined(CONFIG_KERNEL_MODE_NEON))
|
||||||
#define kfpu_allowed() 1
|
#define kfpu_allowed() 1
|
||||||
#define kfpu_begin() kernel_neon_begin()
|
#define kfpu_begin() kernel_neon_begin()
|
||||||
#define kfpu_end() kernel_neon_end()
|
#define kfpu_end() kernel_neon_end()
|
||||||
|
#else
|
||||||
|
#define kfpu_allowed() 0
|
||||||
|
#define kfpu_begin() do {} while (0)
|
||||||
|
#define kfpu_end() do {} while (0)
|
||||||
|
#endif
|
||||||
#define kfpu_init() 0
|
#define kfpu_init() 0
|
||||||
#define kfpu_fini() ((void) 0)
|
#define kfpu_fini() ((void) 0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue