]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
x86/fpu: Create 'union thread_xstate' helper for fpstate_init()
authorIngo Molnar <mingo@kernel.org>
Thu, 30 Apr 2015 08:23:42 +0000 (10:23 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 19 May 2015 13:48:07 +0000 (15:48 +0200)
fpstate_init() only uses fpu->state, so pass that in to it.

This enables the cleanup we will do in the next patch.

Cc: Andy Lutomirski <luto@amacapital.net>
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: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/include/asm/fpu/internal.h
arch/x86/kernel/fpu/core.c
arch/x86/kernel/fpu/xstate.c
arch/x86/kvm/x86.c

index 0236ae6ffc26028a58e4a6770e4ef30a042e223c..b74aa4329aeb0a77213c7c4c0d54675ac118c5e3 100644 (file)
@@ -29,7 +29,7 @@ extern void fpu__init_system(struct cpuinfo_x86 *c);
 
 extern void fpu__activate_curr(struct fpu *fpu);
 
-extern void fpstate_init(struct fpu *fpu);
+extern void fpstate_init(union thread_xstate *state);
 #ifdef CONFIG_MATH_EMULATION
 extern void fpstate_init_soft(struct i387_soft_struct *soft);
 #else
index 494ab4c57268507f48be37822b3164366176f0e2..8e4cad57be3df726a572df53dce1ec63e64337d3 100644 (file)
@@ -202,19 +202,19 @@ static inline void fpstate_init_fstate(struct i387_fsave_struct *fp)
        fp->fos = 0xffff0000u;
 }
 
-void fpstate_init(struct fpu *fpu)
+void fpstate_init(union thread_xstate *state)
 {
        if (!cpu_has_fpu) {
-               fpstate_init_soft(&fpu->state.soft);
+               fpstate_init_soft(&state->soft);
                return;
        }
 
-       memset(&fpu->state, 0, xstate_size);
+       memset(state, 0, xstate_size);
 
        if (cpu_has_fxsr)
-               fpstate_init_fxstate(&fpu->state.fxsave);
+               fpstate_init_fxstate(&state->fxsave);
        else
-               fpstate_init_fstate(&fpu->state.fsave);
+               fpstate_init_fstate(&state->fsave);
 }
 EXPORT_SYMBOL_GPL(fpstate_init);
 
@@ -282,7 +282,7 @@ void fpu__activate_curr(struct fpu *fpu)
        WARN_ON_ONCE(fpu != &current->thread.fpu);
 
        if (!fpu->fpstate_active) {
-               fpstate_init(fpu);
+               fpstate_init(&fpu->state);
 
                /* Safe to do for the current task: */
                fpu->fpstate_active = 1;
@@ -321,7 +321,7 @@ static void fpu__activate_stopped(struct fpu *child_fpu)
        if (child_fpu->fpstate_active) {
                child_fpu->last_cpu = -1;
        } else {
-               fpstate_init(child_fpu);
+               fpstate_init(&child_fpu->state);
 
                /* Safe to do for stopped child tasks: */
                child_fpu->fpstate_active = 1;
index 8285d4b4076357c31470f21e1f93a85abc66b416..afbd5827743095504f10ab5c82d7181e8a8e139f 100644 (file)
@@ -456,7 +456,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
 
                if (__copy_from_user(&fpu->state.xsave, buf_fx, state_size) ||
                    __copy_from_user(&env, buf, sizeof(env))) {
-                       fpstate_init(fpu);
+                       fpstate_init(&fpu->state);
                        err = -1;
                } else {
                        sanitize_restored_xstate(tsk, &env, xfeatures, fx_only);
index f4438179398b972951486dfaaa6e2df155f78dba..3d811bb2728f77712cf7b23b6cee609f5ba9e04a 100644 (file)
@@ -7004,7 +7004,7 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
 
 static void fx_init(struct kvm_vcpu *vcpu)
 {
-       fpstate_init(&vcpu->arch.guest_fpu);
+       fpstate_init(&vcpu->arch.guest_fpu.state);
        if (cpu_has_xsaves)
                vcpu->arch.guest_fpu.state.xsave.header.xcomp_bv =
                        host_xcr0 | XSTATE_COMPACTION_ENABLED;