Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933096AbeALBc0 (ORCPT + 1 other); Thu, 11 Jan 2018 20:32:26 -0500 Received: from mga11.intel.com ([192.55.52.93]:45984 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932321AbeALBcX (ORCPT ); Thu, 11 Jan 2018 20:32:23 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,346,1511856000"; d="scan'208";a="10605994" From: Ashok Raj To: linux-kernel@vger.kernel.org, Thomas Gleixner , Tim Chen , Andy Lutomirski , Linus Torvalds , Greg KH Cc: Ashok Raj , Dave Hansen , Andrea Arcangeli , Andi Kleen , Arjan Van De Ven , David Woodhouse , Peter Zijlstra , Dan Williams , Paolo Bonzini , Jun Nakajima , Asit Mallick Subject: [PATCH 1/5] x86/ibrs: Introduce native_rdmsrl, and native_wrmsrl Date: Thu, 11 Jan 2018 17:32:15 -0800 Message-Id: <1515720739-43819-2-git-send-email-ashok.raj@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515720739-43819-1-git-send-email-ashok.raj@intel.com> References: <1515720739-43819-1-git-send-email-ashok.raj@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: - Remove including microcode.h, and use native macros from asm/msr.h - added license header for spec_ctrl.c Signed-off-by: Ashok Raj --- arch/x86/include/asm/spec_ctrl.h | 17 ++++++++++++++++- arch/x86/kernel/cpu/spec_ctrl.c | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/spec_ctrl.h b/arch/x86/include/asm/spec_ctrl.h index 948959b..2dfa31b 100644 --- a/arch/x86/include/asm/spec_ctrl.h +++ b/arch/x86/include/asm/spec_ctrl.h @@ -3,12 +3,27 @@ #ifndef _ASM_X86_SPEC_CTRL_H #define _ASM_X86_SPEC_CTRL_H -#include +#include +#include void spec_ctrl_scan_feature(struct cpuinfo_x86 *c); void spec_ctrl_unprotected_begin(void); void spec_ctrl_unprotected_end(void); +static inline u64 native_rdmsrl(unsigned int msr) +{ + u64 val; + + val = __rdmsr(msr); + + return val; +} + +static inline void native_wrmsrl(unsigned int msr, u64 val) +{ + __wrmsr(msr, (u32) (val & 0xffffffffULL), (u32) (val >> 32)); +} + static inline void __disable_indirect_speculation(void) { native_wrmsrl(MSR_IA32_SPEC_CTRL, SPEC_CTRL_ENABLE_IBRS); diff --git a/arch/x86/kernel/cpu/spec_ctrl.c b/arch/x86/kernel/cpu/spec_ctrl.c index 843b4e6..9e9d013 100644 --- a/arch/x86/kernel/cpu/spec_ctrl.c +++ b/arch/x86/kernel/cpu/spec_ctrl.c @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #include #include -- 2.7.4