mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-04 09:36:52 +07:00
x86/fpu/xstate: Move XSAVES state init to a function
Make XSTATE init similar to existing code; move it to a separate function. There is no functionality change. Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ravi V. Shankar <ravi.v.shankar@intel.com> Cc: Rik van Riel <riel@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1485282346-15437-1-git-send-email-yu-cheng.yu@intel.com [ Minor cleanliness edits. ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
dffba9a31c
commit
a5828ed3d0
@ -87,6 +87,16 @@ extern void fpstate_init_soft(struct swregs_state *soft);
|
|||||||
#else
|
#else
|
||||||
static inline void fpstate_init_soft(struct swregs_state *soft) {}
|
static inline void fpstate_init_soft(struct swregs_state *soft) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static inline void fpstate_init_xstate(struct xregs_state *xsave)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* XRSTORS requires these bits set in xcomp_bv, or it will
|
||||||
|
* trigger #GP:
|
||||||
|
*/
|
||||||
|
xsave->header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT | xfeatures_mask;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void fpstate_init_fxstate(struct fxregs_state *fx)
|
static inline void fpstate_init_fxstate(struct fxregs_state *fx)
|
||||||
{
|
{
|
||||||
fx->cwd = 0x37f;
|
fx->cwd = 0x37f;
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include <asm/fpu/regset.h>
|
#include <asm/fpu/regset.h>
|
||||||
#include <asm/fpu/signal.h>
|
#include <asm/fpu/signal.h>
|
||||||
#include <asm/fpu/types.h>
|
#include <asm/fpu/types.h>
|
||||||
#include <asm/fpu/xstate.h>
|
|
||||||
#include <asm/traps.h>
|
#include <asm/traps.h>
|
||||||
|
|
||||||
#include <linux/hardirq.h>
|
#include <linux/hardirq.h>
|
||||||
@ -179,14 +178,8 @@ void fpstate_init(union fpregs_state *state)
|
|||||||
|
|
||||||
memset(state, 0, fpu_kernel_xstate_size);
|
memset(state, 0, fpu_kernel_xstate_size);
|
||||||
|
|
||||||
/*
|
|
||||||
* XRSTORS requires that this bit is set in xcomp_bv, or
|
|
||||||
* it will #GP. Make sure it is replaced after the memset().
|
|
||||||
*/
|
|
||||||
if (static_cpu_has(X86_FEATURE_XSAVES))
|
if (static_cpu_has(X86_FEATURE_XSAVES))
|
||||||
state->xsave.header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT |
|
fpstate_init_xstate(&state->xsave);
|
||||||
xfeatures_mask;
|
|
||||||
|
|
||||||
if (static_cpu_has(X86_FEATURE_FXSR))
|
if (static_cpu_has(X86_FEATURE_FXSR))
|
||||||
fpstate_init_fxstate(&state->fxsave);
|
fpstate_init_fxstate(&state->fxsave);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user