From 5401472cd0599dda4fdf71f9ba318785cbca2025 Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Fri, 9 Dec 2022 13:51:23 -0500 Subject: [PATCH] Linux PPC: Fix build failures on kernels built without CONFIG_SPE We do a simple ifdef to avoid calling enable_kernel_spe()/ disable_kernel_spe() on PowerPC. Reported-by: Rich Ercolani Reviewed-by: Brian Behlendorf Reviewed-by: Tino Reichardt Tested-by: Georgy Yakovlev Signed-off-by: Richard Yao Closes #14233 Closes #14244 --- include/os/linux/kernel/linux/simd_powerpc.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/os/linux/kernel/linux/simd_powerpc.h b/include/os/linux/kernel/linux/simd_powerpc.h index 2a2f92bc4..f1de3ad01 100644 --- a/include/os/linux/kernel/linux/simd_powerpc.h +++ b/include/os/linux/kernel/linux/simd_powerpc.h @@ -69,6 +69,7 @@ #define kfpu_allowed() 1 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) +#ifdef CONFIG_SPE #define kfpu_begin() \ { \ preempt_disable(); \ @@ -83,6 +84,20 @@ disable_kernel_altivec(); \ preempt_enable(); \ } +#else /* CONFIG_SPE */ +#define kfpu_begin() \ + { \ + preempt_disable(); \ + enable_kernel_altivec(); \ + enable_kernel_vsx(); \ + } +#define kfpu_end() \ + { \ + disable_kernel_vsx(); \ + disable_kernel_altivec(); \ + preempt_enable(); \ + } +#endif #else /* seems that before 4.5 no-one bothered */ #define kfpu_begin()