Description: Linux: use cpu_feature_enabled() instead of static_cpu_has()
 static_cpu_has() was hidden and renamed to _static_cpu_has() in Linux 7.3
 (kernel commit 3eaa50e1e255 "x86/cpu: Hide and rename static_cpu_has()").
 Since 3.18 cpu_feature_enabled() has been the right way to do the same
 thing unconditionally, so switch everything over.
 .
 Rebased onto 2.4.4, where simd_stat.c still tests the HAVE_* macros
 directly rather than through the HAVE_SIMD() helper introduced upstream.
Author: Rob Norris <robn@despairlabs.com>
Origin: upstream, https://github.com/robn/zfs/commit/cc99b331dae08e59fa16909ceea8526aa82f4a5e
Forwarded: not-needed
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Index: zfs-linux-2.4.4/include/os/linux/kernel/linux/simd_x86.h
===================================================================
--- zfs-linux-2.4.4.orig/include/os/linux/kernel/linux/simd_x86.h
+++ zfs-linux-2.4.4/include/os/linux/kernel/linux/simd_x86.h
@@ -315,24 +315,24 @@ kfpu_begin(void)
 	 */
 	uint8_t *state = zfs_kfpu_fpregs[smp_processor_id()];
 #if defined(HAVE_XSAVES)
-	if (static_cpu_has(X86_FEATURE_XSAVES)) {
+	if (cpu_feature_enabled(X86_FEATURE_XSAVES)) {
 		kfpu_do_xsave("xsaves", state, ~XFEATURE_MASK_XTILE);
 		return;
 	}
 #endif
 #if defined(HAVE_XSAVEOPT)
-	if (static_cpu_has(X86_FEATURE_XSAVEOPT)) {
+	if (cpu_feature_enabled(X86_FEATURE_XSAVEOPT)) {
 		kfpu_do_xsave("xsaveopt", state, ~XFEATURE_MASK_XTILE);
 		return;
 	}
 #endif
 #if defined(HAVE_XSAVE)
-	if (static_cpu_has(X86_FEATURE_XSAVE)) {
+	if (cpu_feature_enabled(X86_FEATURE_XSAVE)) {
 		kfpu_do_xsave("xsave", state, ~XFEATURE_MASK_XTILE);
 		return;
 	}
 #endif
-	if (static_cpu_has(X86_FEATURE_FXSR)) {
+	if (cpu_feature_enabled(X86_FEATURE_FXSR)) {
 		kfpu_save_fxsr(state);
 	} else {
 		kfpu_save_fsave(state);
@@ -380,18 +380,18 @@ kfpu_end(void)
 {
 	uint8_t  *state = zfs_kfpu_fpregs[smp_processor_id()];
 #if defined(HAVE_XSAVES)
-	if (static_cpu_has(X86_FEATURE_XSAVES)) {
+	if (cpu_feature_enabled(X86_FEATURE_XSAVES)) {
 		kfpu_do_xrstor("xrstors", state, ~XFEATURE_MASK_XTILE);
 		goto out;
 	}
 #endif
 #if defined(HAVE_XSAVE)
-	if (static_cpu_has(X86_FEATURE_XSAVE)) {
+	if (cpu_feature_enabled(X86_FEATURE_XSAVE)) {
 		kfpu_do_xrstor("xrstor", state, ~XFEATURE_MASK_XTILE);
 		goto out;
 	}
 #endif
-	if (static_cpu_has(X86_FEATURE_FXSR)) {
+	if (cpu_feature_enabled(X86_FEATURE_FXSR)) {
 		kfpu_restore_fxsr(state);
 	} else {
 		kfpu_restore_fsave(state);
Index: zfs-linux-2.4.4/module/zcommon/simd_stat.c
===================================================================
--- zfs-linux-2.4.4.orig/module/zcommon/simd_stat.c
+++ zfs-linux-2.4.4/module/zcommon/simd_stat.c
@@ -126,13 +126,13 @@ simd_stat_kstat_data(char *buf, size_t s
 		off += SIMD_STAT_PRINT(simd_stat_kstat_payload,
 		    "osxsave", boot_cpu_has(X86_FEATURE_OSXSAVE));
 		off += SIMD_STAT_PRINT(simd_stat_kstat_payload,
-		    "xsaves", static_cpu_has(X86_FEATURE_XSAVES));
+		    "xsaves", cpu_feature_enabled(X86_FEATURE_XSAVES));
 		off += SIMD_STAT_PRINT(simd_stat_kstat_payload,
-		    "xsaveopt", static_cpu_has(X86_FEATURE_XSAVEOPT));
+		    "xsaveopt", cpu_feature_enabled(X86_FEATURE_XSAVEOPT));
 		off += SIMD_STAT_PRINT(simd_stat_kstat_payload,
-		    "xsave", static_cpu_has(X86_FEATURE_XSAVE));
+		    "xsave", cpu_feature_enabled(X86_FEATURE_XSAVE));
 		off += SIMD_STAT_PRINT(simd_stat_kstat_payload,
-		    "fxsr", static_cpu_has(X86_FEATURE_FXSR));
+		    "fxsr", cpu_feature_enabled(X86_FEATURE_FXSR));
 #endif /* __x86__ */
 #if defined(__arm__) || defined(__aarch64__)
 		off += SIMD_STAT_PRINT(simd_stat_kstat_payload,
