From fbb8035a46a84ac7c5ee53c875c1de6f202d0884 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 26 May 2019 20:38:30 +0200 Subject: zinc: arm64: use cpu_get_elf_hwcap accessor for 5.2 --- src/compat/compat.h | 4 ++++ src/crypto/zinc/chacha20/chacha20-arm-glue.c | 2 +- src/crypto/zinc/poly1305/poly1305-arm-glue.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/compat/compat.h b/src/compat/compat.h index 436fe44..c34f754 100644 --- a/src/compat/compat.h +++ b/src/compat/compat.h @@ -829,6 +829,10 @@ static inline void skb_mark_not_on_list(struct sk_buff *skb) #define COMPAT_CANNOT_INDIVIDUAL_NETLINK_OPS_POLICY #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) && defined(__aarch64__) +#define cpu_have_named_feature(name) (elf_hwcap & (HWCAP_ ## name)) +#endif + /* https://github.com/ClangBuiltLinux/linux/issues/7 */ #if defined( __clang__) && (!defined(CONFIG_CLANG_VERSION) || CONFIG_CLANG_VERSION < 80000) #include diff --git a/src/crypto/zinc/chacha20/chacha20-arm-glue.c b/src/crypto/zinc/chacha20/chacha20-arm-glue.c index 84c3bb7..41e2e79 100644 --- a/src/crypto/zinc/chacha20/chacha20-arm-glue.c +++ b/src/crypto/zinc/chacha20/chacha20-arm-glue.c @@ -21,7 +21,7 @@ static bool *const chacha20_nobs[] __initconst = { &chacha20_use_neon }; static void __init chacha20_fpu_init(void) { #if defined(CONFIG_ZINC_ARCH_ARM64) - chacha20_use_neon = elf_hwcap & HWCAP_ASIMD; + chacha20_use_neon = cpu_have_named_feature(ASIMD); #elif defined(CONFIG_ZINC_ARCH_ARM) switch (read_cpuid_part()) { case ARM_CPU_PART_CORTEX_A7: diff --git a/src/crypto/zinc/poly1305/poly1305-arm-glue.c b/src/crypto/zinc/poly1305/poly1305-arm-glue.c index a80f046..291fe4b 100644 --- a/src/crypto/zinc/poly1305/poly1305-arm-glue.c +++ b/src/crypto/zinc/poly1305/poly1305-arm-glue.c @@ -20,7 +20,7 @@ static bool *const poly1305_nobs[] __initconst = { &poly1305_use_neon }; static void __init poly1305_fpu_init(void) { #if defined(CONFIG_ZINC_ARCH_ARM64) - poly1305_use_neon = elf_hwcap & HWCAP_ASIMD; + poly1305_use_neon = cpu_have_named_feature(ASIMD); #elif defined(CONFIG_ZINC_ARCH_ARM) poly1305_use_neon = elf_hwcap & HWCAP_NEON; #endif -- cgit v1.2.3-59-g8ed1b