diff options
-rw-r--r-- | src/compat/Kbuild.include | 4 | ||||
-rw-r--r-- | src/compat/compat.h | 18 | ||||
-rw-r--r-- | src/compat/simd-asm/include/asm/simd.h | 21 | ||||
-rw-r--r-- | src/compat/simd-x86/include/asm/simd.h | 1 | ||||
-rw-r--r-- | src/compat/simd/include/linux/simd.h | 3 |
5 files changed, 24 insertions, 23 deletions
diff --git a/src/compat/Kbuild.include b/src/compat/Kbuild.include index 879aa84..0e70006 100644 --- a/src/compat/Kbuild.include +++ b/src/compat/Kbuild.include @@ -33,8 +33,8 @@ ifeq ($(wildcard $(srctree)/arch/x86/include/asm/fpu/api.h)$(CONFIG_X86),y) ccflags-y += -I$(src)/compat/fpu-x86/include endif -ifeq ($(wildcard $(srctree)/arch/x86/include/asm/simd.h)$(CONFIG_X86),y) -ccflags-y += -I$(src)/compat/simd-x86/include +ifeq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/simd.h)$(shell grep -F "generic-y += simd.h" "$(srctree)/arch/$(SRCARCH)/Kbuild"),) +ccflags-y += -I$(src)/compat/simd-asm/include endif ifeq ($(wildcard $(srctree)/include/linux/simd.h),) diff --git a/src/compat/compat.h b/src/compat/compat.h index 8c366f5..796736c 100644 --- a/src/compat/compat.h +++ b/src/compat/compat.h @@ -737,24 +737,6 @@ static inline void crypto_xor_cpy(u8 *dst, const u8 *src1, const u8 *src2, #define read_cpuid_part() read_cpuid_part_number() #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) || (!defined(CONFIG_X86_64) && !defined(CONFIG_ARM64) && !defined(CONFIG_ARM)) -#if defined(CONFIG_X86_64) -#include <asm/fpu/api.h> -#endif -static __must_check inline bool may_use_simd(void) -{ -#if defined(CONFIG_X86_64) - return irq_fpu_usable(); -#elif defined(CONFIG_ARM64) && defined(CONFIG_KERNEL_MODE_NEON) - return true; -#elif defined(CONFIG_ARM) && defined(CONFIG_KERNEL_MODE_NEON) - return !in_nmi() && !in_irq() && !in_serving_softirq(); -#else - return false; -#endif -} -#endif - #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) #define hlist_add_behind(a, b) hlist_add_after(b, a) #endif diff --git a/src/compat/simd-asm/include/asm/simd.h b/src/compat/simd-asm/include/asm/simd.h new file mode 100644 index 0000000..a975b38 --- /dev/null +++ b/src/compat/simd-asm/include/asm/simd.h @@ -0,0 +1,21 @@ +#ifndef _COMPAT_ASM_SIMD_H +#define _COMPAT_ASM_SIMD_H + +#if defined(CONFIG_X86_64) +#include <asm/fpu/api.h> +#endif + +static __must_check inline bool may_use_simd(void) +{ +#if defined(CONFIG_X86_64) + return irq_fpu_usable(); +#elif defined(CONFIG_ARM64) && defined(CONFIG_KERNEL_MODE_NEON) + return true; +#elif defined(CONFIG_ARM) && defined(CONFIG_KERNEL_MODE_NEON) + return !in_nmi() && !in_irq() && !in_serving_softirq(); +#else + return false; +#endif +} + +#endif diff --git a/src/compat/simd-x86/include/asm/simd.h b/src/compat/simd-x86/include/asm/simd.h deleted file mode 100644 index f3f9117..0000000 --- a/src/compat/simd-x86/include/asm/simd.h +++ /dev/null @@ -1 +0,0 @@ -#include <asm/i387.h> diff --git a/src/compat/simd/include/linux/simd.h b/src/compat/simd/include/linux/simd.h index a117afd..11ee98a 100644 --- a/src/compat/simd/include/linux/simd.h +++ b/src/compat/simd/include/linux/simd.h @@ -7,13 +7,12 @@ #define _WG_SIMD_H #include <linux/sched.h> +#include <asm/simd.h> #if defined(CONFIG_X86_64) #include <linux/version.h> #include <asm/fpu/api.h> -#include <asm/simd.h> #elif defined(CONFIG_KERNEL_MODE_NEON) #include <asm/neon.h> -#include <asm/simd.h> #endif typedef enum { |