Skip to content

Commit

Permalink
Refactor CONFIG_SPE check on Linux/powerpc
Browse files Browse the repository at this point in the history
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 openzfs#14623
  • Loading branch information
Low-power authored and lundman committed Mar 17, 2023
1 parent e11d028 commit 167368d
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions include/os/linux/kernel/linux/simd_powerpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,40 +80,32 @@
#define ENABLE_KERNEL_VSX
#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 */
#ifdef CONFIG_SPE
#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(); \
}
#endif
#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)
Expand Down

0 comments on commit 167368d

Please sign in to comment.