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
1 changed files with 21 additions and 29 deletions

View File

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