Skip to content

Commit

Permalink
Fix build for Linux/powerpc without CONFIG_ALTIVEC or CONFIG_VSX
Browse files Browse the repository at this point in the history
This fixes building ZFS for Linux 4.7+ powerpc* architecture, where 
Linux was configured without CONFIG_ALTIVEC or CONFIG_VSX.

Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: WHR <msl0000023508@gmail.com>
Closes openzfs#14591
  • Loading branch information
Low-power authored and lundman committed Mar 16, 2023
1 parent 61286f8 commit 174fc34
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions include/os/linux/kernel/linux/simd_powerpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,32 +66,46 @@
#define kfpu_allowed() 1

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
#ifdef CONFIG_ALTIVEC
#define ENABLE_KERNEL_ALTIVEC enable_kernel_altivec()
#define DISABLE_KERNEL_ALTIVEC disable_kernel_altivec()
#else
#define ENABLE_KERNEL_ALTIVEC
#define DISABLE_KERNEL_ALTIVEC
#endif
#ifdef CONFIG_VSX
#define ENABLE_KERNEL_VSX enable_kernel_vsx()
#define DISABLE_KERNEL_VSX disable_kernel_vsx()
#else
#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_ALTIVEC \
ENABLE_KERNEL_VSX \
enable_kernel_spe(); \
}
#define kfpu_end() \
{ \
disable_kernel_spe(); \
disable_kernel_vsx(); \
disable_kernel_altivec(); \
DISABLE_KERNEL_VSX \
DISABLE_KERNEL_ALTIVEC \
preempt_enable(); \
}
#else /* CONFIG_SPE */
#define kfpu_begin() \
{ \
preempt_disable(); \
enable_kernel_altivec(); \
enable_kernel_vsx(); \
ENABLE_KERNEL_ALTIVEC \
ENABLE_KERNEL_VSX \
}
#define kfpu_end() \
{ \
disable_kernel_vsx(); \
disable_kernel_altivec(); \
DISABLE_KERNEL_VSX \
DISABLE_KERNEL_ALTIVEC \
preempt_enable(); \
}
#endif
Expand Down

0 comments on commit 174fc34

Please sign in to comment.