diff options
author | Low-power <[email protected]> | 2023-03-11 01:35:00 +0800 |
---|---|---|
committer | GitHub <[email protected]> | 2023-03-10 09:35:00 -0800 |
commit | 589f59b52af86455cf71421e63c34557c7ee6f91 (patch) | |
tree | 0350600175b27662916d2b69e18ef57011043985 /config/kernel-cpu_has_feature.m4 | |
parent | 7316fdd1c0c74074c4b48a499afe4e444aa42914 (diff) |
Workaround for Linux PowerPC GPL-only cpu_has_feature()
Linux since 4.7 makes interface 'cpu_has_feature' to use jump labels on
powerpc if CONFIG_JUMP_LABEL_FEATURE_CHECKS is enabled, in this case
however the inline function references GPL-only symbol
'cpu_feature_keys'.
ZFS currently uses 'cpu_has_feature' either directly or indirectly from
several places; while it is unknown how this issue didn't break ZFS on
64-bit little-endian powerpc, it is known to break ZFS with many Linux
versions on both 32-bit and 64-bit big-endian powerpc.
Until this issue is fixed in Linux, we have to workaround it by
overriding affected inline functions without depending on
'cpu_feature_keys'.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: WHR <[email protected]>
Closes #14590
Diffstat (limited to 'config/kernel-cpu_has_feature.m4')
-rw-r--r-- | config/kernel-cpu_has_feature.m4 | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/config/kernel-cpu_has_feature.m4 b/config/kernel-cpu_has_feature.m4 new file mode 100644 index 000000000..608faf0f8 --- /dev/null +++ b/config/kernel-cpu_has_feature.m4 @@ -0,0 +1,29 @@ +dnl # +dnl # cpu_has_feature() may referencing GPL-only cpu_feature_keys on powerpc +dnl # + +dnl # +dnl # Checking if cpu_has_feature is exported GPL-only +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_CPU_HAS_FEATURE], [ + ZFS_LINUX_TEST_SRC([cpu_has_feature], [ + #include <linux/version.h> + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) + #include <asm/cpu_has_feature.h> + #else + #include <asm/cputable.h> + #endif + ], [ + return cpu_has_feature(CPU_FTR_ALTIVEC) ? 0 : 1; + ], [], [ZFS_META_LICENSE]) +]) +AC_DEFUN([ZFS_AC_KERNEL_CPU_HAS_FEATURE], [ + AC_MSG_CHECKING([whether cpu_has_feature() is GPL-only]) + ZFS_LINUX_TEST_RESULT([cpu_has_feature_license], [ + AC_MSG_RESULT(no) + ], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_CPU_HAS_FEATURE_GPL_ONLY, 1, + [cpu_has_feature() is GPL-only]) + ]) +]) |