x86/fpu: Clean up CPU feature tests

Further disintegration of internal.h:

Move the CPU feature tests to a core header and remove the unused one.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20211015011539.401510559@linutronix.de
This commit is contained in:
Thomas Gleixner 2021-10-15 03:16:21 +02:00 committed by Borislav Petkov
parent 63e81807c1
commit d06241f52c
4 changed files with 14 additions and 18 deletions

View file

@ -51,24 +51,6 @@ extern void fpu__resume_cpu(void);
# define WARN_ON_FPU(x) ({ (void)(x); 0; })
#endif
/*
* FPU related CPU feature flag helper routines:
*/
static __always_inline __pure bool use_xsaveopt(void)
{
return static_cpu_has(X86_FEATURE_XSAVEOPT);
}
static __always_inline __pure bool use_xsave(void)
{
return static_cpu_has(X86_FEATURE_XSAVE);
}
static __always_inline __pure bool use_fxsr(void)
{
return static_cpu_has(X86_FEATURE_FXSR);
}
extern union fpregs_state init_fpstate;
extern void fpstate_init_user(union fpregs_state *state);

View file

@ -17,6 +17,7 @@
#include <linux/hardirq.h>
#include <linux/pkeys.h>
#include "internal.h"
#include "xstate.h"
#define CREATE_TRACE_POINTS

View file

@ -2,6 +2,17 @@
#ifndef __X86_KERNEL_FPU_INTERNAL_H
#define __X86_KERNEL_FPU_INTERNAL_H
/* CPU feature check wrappers */
static __always_inline __pure bool use_xsave(void)
{
return cpu_feature_enabled(X86_FEATURE_XSAVE);
}
static __always_inline __pure bool use_fxsr(void)
{
return cpu_feature_enabled(X86_FEATURE_FXSR);
}
/* Init functions */
extern void fpu__init_prepare_fx_sw_frame(void);

View file

@ -10,6 +10,8 @@
#include <asm/fpu/regset.h>
#include <asm/fpu/xstate.h>
#include "internal.h"
/*
* The xstateregs_active() routine is the same as the regset_fpregs_active() routine,
* as the "regset->n" for the xstate regset will be updated based on the feature