From 3d309b88d7e3d1b183596fa5a8a5f20d7bde7cca Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 22 Nov 2017 23:16:52 +0100 Subject: compat: support AVX512BW+VL by lying --- src/compat/compat.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src') 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 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0) #include @@ -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 +#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) -- cgit v1.2.3-59-g8ed1b