diff options
| -rw-r--r-- | arch/x86/include/asm/fpu/types.h | 7 | ||||
| -rw-r--r-- | arch/x86/kernel/fpu/xstate.c | 3 | ||||
| -rw-r--r-- | arch/x86/kernel/fpu/xstate.h | 4 | 
3 files changed, 12 insertions, 2 deletions
| diff --git a/arch/x86/include/asm/fpu/types.h b/arch/x86/include/asm/fpu/types.h index eb17f31b06d2..de16862bf230 100644 --- a/arch/x86/include/asm/fpu/types.h +++ b/arch/x86/include/asm/fpu/types.h @@ -591,6 +591,13 @@ struct fpu_state_config {  	 * even without XSAVE support, i.e. legacy features FP + SSE  	 */  	u64 legacy_features; +	/* +	 * @independent_features: +	 * +	 * Features that are supported by XSAVES, but not managed as part of +	 * the FPU core, such as LBR +	 */ +	u64 independent_features;  };  /* FPU state configuration information */ diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c index c5a026fee5e0..1339f8328db5 100644 --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c @@ -788,6 +788,9 @@ void __init fpu__init_system_xstate(unsigned int legacy_size)  		goto out_disable;  	} +	fpu_kernel_cfg.independent_features = fpu_kernel_cfg.max_features & +					      XFEATURE_MASK_INDEPENDENT; +  	/*  	 * Clear XSAVE features that are disabled in the normal CPUID.  	 */ diff --git a/arch/x86/kernel/fpu/xstate.h b/arch/x86/kernel/fpu/xstate.h index 2ee0b9c53dcc..afb404cd2059 100644 --- a/arch/x86/kernel/fpu/xstate.h +++ b/arch/x86/kernel/fpu/xstate.h @@ -62,9 +62,9 @@ static inline u64 xfeatures_mask_supervisor(void)  static inline u64 xfeatures_mask_independent(void)  {  	if (!cpu_feature_enabled(X86_FEATURE_ARCH_LBR)) -		return XFEATURE_MASK_INDEPENDENT & ~XFEATURE_MASK_LBR; +		return fpu_kernel_cfg.independent_features & ~XFEATURE_MASK_LBR; -	return XFEATURE_MASK_INDEPENDENT; +	return fpu_kernel_cfg.independent_features;  }  /* XSAVE/XRSTOR wrapper functions */ | 
