Fix build for Linux/powerpc without CONFIG_ALTIVEC or CONFIG_VSX

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 #14591
This commit is contained in:
Low-power 2023-03-08 06:06:52 +08:00 committed by GitHub
parent b988f32c70
commit 1f196e3107
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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