From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751420AbdAYIdr (ORCPT ); Wed, 25 Jan 2017 03:33:47 -0500 Received: from terminus.zytor.com ([65.50.211.136]:42622 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751371AbdAYIdm (ORCPT ); Wed, 25 Jan 2017 03:33:42 -0500 Date: Wed, 25 Jan 2017 00:31:53 -0800 From: tip-bot for Yu-cheng Yu Message-ID: Cc: torvalds@linux-foundation.org, fenghua.yu@intel.com, linux-kernel@vger.kernel.org, peterz@infradead.org, ravi.v.shankar@intel.com, mingo@kernel.org, hpa@zytor.com, yu-cheng.yu@intel.com, dave.hansen@linux.intel.com, riel@redhat.com, bp@alien8.de, luto@kernel.org, tglx@linutronix.de, oleg@redhat.com Reply-To: linux-kernel@vger.kernel.org, fenghua.yu@intel.com, torvalds@linux-foundation.org, mingo@kernel.org, hpa@zytor.com, ravi.v.shankar@intel.com, peterz@infradead.org, dave.hansen@linux.intel.com, bp@alien8.de, riel@redhat.com, yu-cheng.yu@intel.com, oleg@redhat.com, tglx@linutronix.de, luto@kernel.org In-Reply-To: <1485282346-15437-1-git-send-email-yu-cheng.yu@intel.com> References: <1485282346-15437-1-git-send-email-yu-cheng.yu@intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/fpu] x86/fpu/xstate: Move XSAVES state init to a function Git-Commit-ID: a5828ed3d03d38399159dc17a98cefde3109a66b X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: a5828ed3d03d38399159dc17a98cefde3109a66b Gitweb: http://git.kernel.org/tip/a5828ed3d03d38399159dc17a98cefde3109a66b Author: Yu-cheng Yu AuthorDate: Tue, 24 Jan 2017 10:25:46 -0800 Committer: Ingo Molnar CommitDate: Wed, 25 Jan 2017 08:25:12 +0100 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 Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Dave Hansen Cc: Fenghua Yu Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Peter Zijlstra Cc: Ravi V. Shankar Cc: Rik van Riel Cc: Thomas Gleixner 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 --- arch/x86/include/asm/fpu/internal.h | 10 ++++++++++ arch/x86/kernel/fpu/core.c | 9 +-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h index d4a6849..255645f 100644 --- a/arch/x86/include/asm/fpu/internal.h +++ b/arch/x86/include/asm/fpu/internal.h @@ -87,6 +87,16 @@ extern void fpstate_init_soft(struct swregs_state *soft); #else static inline void fpstate_init_soft(struct swregs_state *soft) {} #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) { fx->cwd = 0x37f; diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c index de72344..e1114f0 100644 --- a/arch/x86/kernel/fpu/core.c +++ b/arch/x86/kernel/fpu/core.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include @@ -179,14 +178,8 @@ void fpstate_init(union fpregs_state *state) 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)) - state->xsave.header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT | - xfeatures_mask; - + fpstate_init_xstate(&state->xsave); if (static_cpu_has(X86_FEATURE_FXSR)) fpstate_init_fxstate(&state->fxsave); else