Refactor CONFIG_SPE check on Linux/powerpc

Commit 5401472 adds a check to call enable_kernel_spe and
disable_kernel_spe only if CONFIG_SPE is defined. Refactor this check
in a way similar to what CONFIG_ALTIVEC and CONFIG_VSX are checked, in
order to remove redundant kfpu_begin() and kfpu_end() implementations.

Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: WHR <msl0000023508@gmail.com>
Closes #14623
This commit is contained in:
WHR 2023-03-14 21:25:25 +08:00 committed by Brian Behlendorf
parent f31b0d4e88
commit d74f123045

View File

@ -81,39 +81,31 @@
#define DISABLE_KERNEL_VSX
#endif
#ifdef CONFIG_SPE
#define kfpu_begin() \
{ \
preempt_disable(); \
ENABLE_KERNEL_ALTIVEC \
ENABLE_KERNEL_VSX \
enable_kernel_spe(); \
}
#define kfpu_end() \
{ \
disable_kernel_spe(); \
DISABLE_KERNEL_VSX \
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(); \
}
#define ENABLE_KERNEL_SPE enable_kernel_spe();
#define DISABLE_KERNEL_SPE disable_kernel_spe();
#else
#define ENABLE_KERNEL_SPE
#define DISABLE_KERNEL_SPE
#endif
#define kfpu_begin() \
{ \
preempt_disable(); \
ENABLE_KERNEL_ALTIVEC \
ENABLE_KERNEL_VSX \
ENABLE_KERNEL_SPE \
}
#define kfpu_end() \
{ \
DISABLE_KERNEL_SPE \
DISABLE_KERNEL_VSX \
DISABLE_KERNEL_ALTIVEC \
preempt_enable(); \
}
#else
/* seems that before 4.5 no-one bothered */
#define kfpu_begin()
#define kfpu_end() preempt_enable()
#endif
#endif /* Linux version >= 4.5 */
#define kfpu_init() 0
#define kfpu_fini() ((void) 0)