Commit 3e261c14 authored by Ingo Molnar's avatar Ingo Molnar

x86/fpu: Simplify the xsave_state*() methods

These functions (xsave_state() and xsave_state_booting()) have a 'mask'
argument that is always -1.

Propagate this into the functions instead and eliminate the extra argument.

Does not change the generated code, because these were inlined functions.
Reviewed-by: default avatarBorislav Petkov <bp@alien8.de>
Cc: Andy Lutomirski <luto@amacapital.net>
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: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 4d164092
...@@ -527,9 +527,9 @@ static inline void __save_fpu(struct task_struct *tsk) ...@@ -527,9 +527,9 @@ static inline void __save_fpu(struct task_struct *tsk)
{ {
if (use_xsave()) { if (use_xsave()) {
if (unlikely(system_state == SYSTEM_BOOTING)) if (unlikely(system_state == SYSTEM_BOOTING))
xsave_state_booting(&tsk->thread.fpu.state->xsave, -1); xsave_state_booting(&tsk->thread.fpu.state->xsave);
else else
xsave_state(&tsk->thread.fpu.state->xsave, -1); xsave_state(&tsk->thread.fpu.state->xsave);
} else } else
fpu_fxsave(&tsk->thread.fpu); fpu_fxsave(&tsk->thread.fpu);
} }
......
...@@ -70,8 +70,9 @@ extern void update_regset_xstate_info(unsigned int size, u64 xstate_mask); ...@@ -70,8 +70,9 @@ extern void update_regset_xstate_info(unsigned int size, u64 xstate_mask);
* This function is called only during boot time when x86 caps are not set * This function is called only during boot time when x86 caps are not set
* up and alternative can not be used yet. * up and alternative can not be used yet.
*/ */
static inline int xsave_state_booting(struct xsave_struct *fx, u64 mask) static inline int xsave_state_booting(struct xsave_struct *fx)
{ {
u64 mask = -1;
u32 lmask = mask; u32 lmask = mask;
u32 hmask = mask >> 32; u32 hmask = mask >> 32;
int err = 0; int err = 0;
...@@ -123,8 +124,9 @@ static inline int xrstor_state_booting(struct xsave_struct *fx, u64 mask) ...@@ -123,8 +124,9 @@ static inline int xrstor_state_booting(struct xsave_struct *fx, u64 mask)
/* /*
* Save processor xstate to xsave area. * Save processor xstate to xsave area.
*/ */
static inline int xsave_state(struct xsave_struct *fx, u64 mask) static inline int xsave_state(struct xsave_struct *fx)
{ {
u64 mask = -1;
u32 lmask = mask; u32 lmask = mask;
u32 hmask = mask >> 32; u32 hmask = mask >> 32;
int err = 0; int err = 0;
...@@ -189,7 +191,7 @@ static inline int xrstor_state(struct xsave_struct *fx, u64 mask) ...@@ -189,7 +191,7 @@ static inline int xrstor_state(struct xsave_struct *fx, u64 mask)
*/ */
static inline void fpu_xsave(struct fpu *fpu) static inline void fpu_xsave(struct fpu *fpu)
{ {
xsave_state(&fpu->state->xsave, -1); xsave_state(&fpu->state->xsave);
} }
/* /*
......
...@@ -558,11 +558,12 @@ static void __init setup_init_fpu_buf(void) ...@@ -558,11 +558,12 @@ static void __init setup_init_fpu_buf(void)
* Init all the features state with header_bv being 0x0 * Init all the features state with header_bv being 0x0
*/ */
xrstor_state_booting(init_xstate_buf, -1); xrstor_state_booting(init_xstate_buf, -1);
/* /*
* Dump the init state again. This is to identify the init state * Dump the init state again. This is to identify the init state
* of any feature which is not represented by all zero's. * of any feature which is not represented by all zero's.
*/ */
xsave_state_booting(init_xstate_buf, -1); xsave_state_booting(init_xstate_buf);
} }
static enum { AUTO, ENABLE, DISABLE } eagerfpu = AUTO; static enum { AUTO, ENABLE, DISABLE } eagerfpu = AUTO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment