diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-11-22 23:16:52 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-11-22 23:19:39 +0100 |
commit | 71db96bcb99cc8e8e06885d7fa8819c6a02c963a (patch) | |
tree | 5de1244dc5c476403d6dd5b525f130d208c839c0 /src/compat | |
parent | ee4722ce71b58c51dd357248d185d4dd4d9ba067 (diff) |
compat: support AVX512BW+VL by lying
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/compat')
-rw-r--r-- | src/compat/compat.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/compat/compat.h b/src/compat/compat.h index 4609417..9de4d23 100644 --- a/src/compat/compat.h +++ b/src/compat/compat.h @@ -486,8 +486,7 @@ static int get_device_dump_real(a, b) #define COMPAT_CANNOT_USE_IFF_NO_QUEUE #endif -#if defined(CONFIG_X86_64) -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#if defined(CONFIG_X86_64) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) #include <asm/user.h> #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0) #include <asm/xsave.h> @@ -507,6 +506,20 @@ static inline int cpu_has_xfeatures(u64 xfeatures_needed, const char **feature_n #define XFEATURE_MASK_ZMM_Hi256 XSTATE_ZMM_Hi256 #endif #endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) && defined(CONFIG_X86_64) +/* This is incredibly dumb and reckless, but as it turns out, there's + * not really hardware Linux runs properly on that supports F but not BW + * and VL, so in practice this isn't so bad. Plus, this is compat layer, + * so the bar remains fairly low. + */ +#include <asm/cpufeature.h> +#ifndef X86_FEATURE_AVX512BW +#define X86_FEATURE_AVX512BW X86_FEATURE_AVX512F +#endif +#ifndef X86_FEATURE_AVX512VL +#define X86_FEATURE_AVX512VL X86_FEATURE_AVX512F +#endif #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) |