Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031828AbbEER7q (ORCPT ); Tue, 5 May 2015 13:59:46 -0400 Received: from mail-wg0-f52.google.com ([74.125.82.52]:34079 "EHLO mail-wg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031790AbbEER7m (ORCPT ); Tue, 5 May 2015 13:59:42 -0400 From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Andy Lutomirski , Borislav Petkov , Dave Hansen , Fenghua Yu , "H. Peter Anvin" , Linus Torvalds , Oleg Nesterov , Thomas Gleixner Subject: [PATCH 190/208] x86/fpu: Create 'union thread_xstate' helper for fpstate_init() Date: Tue, 5 May 2015 19:58:14 +0200 Message-Id: <1430848712-28064-30-git-send-email-mingo@kernel.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1430848712-28064-1-git-send-email-mingo@kernel.org> References: <1430848712-28064-1-git-send-email-mingo@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3926 Lines: 114 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 Cc: Borislav Petkov Cc: Dave Hansen Cc: Fenghua Yu Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Thomas Gleixner Signed-off-by: Ingo Molnar --- arch/x86/include/asm/fpu/internal.h | 2 +- arch/x86/kernel/fpu/core.c | 14 +++++++------- arch/x86/kernel/fpu/xstate.c | 2 +- arch/x86/kvm/x86.c | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h index 0236ae6ffc26..b74aa4329aeb 100644 --- a/arch/x86/include/asm/fpu/internal.h +++ b/arch/x86/include/asm/fpu/internal.h @@ -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 diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c index 8eeba60bf78b..2642a1ebed2a 100644 --- a/arch/x86/kernel/fpu/core.c +++ b/arch/x86/kernel/fpu/core.c @@ -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 != ¤t->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; diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c index 8285d4b40763..afbd58277430 100644 --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c @@ -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); diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f4438179398b..3d811bb2728f 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -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; -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/