From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933122AbeALBl5 (ORCPT + 1 other); Thu, 11 Jan 2018 20:41:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:44814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932412AbeALBl4 (ORCPT ); Thu, 11 Jan 2018 20:41:56 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 927B821749 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=luto@kernel.org X-Google-Smtp-Source: ACJfBotKlMuN+V9llpdh9vRfr6vbxtjoUEVCYCkEzhLrzlnjKBBtWr/d48VneFc7B9wb8SgGmunZ7MwMPYQe7Ao3Yzc= MIME-Version: 1.0 In-Reply-To: <1515720739-43819-2-git-send-email-ashok.raj@intel.com> References: <1515720739-43819-1-git-send-email-ashok.raj@intel.com> <1515720739-43819-2-git-send-email-ashok.raj@intel.com> From: Andy Lutomirski Date: Thu, 11 Jan 2018 17:41:34 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/5] x86/ibrs: Introduce native_rdmsrl, and native_wrmsrl To: Ashok Raj Cc: LKML , Thomas Gleixner , Tim Chen , Andy Lutomirski , Linus Torvalds , Greg KH , Dave Hansen , Andrea Arcangeli , Andi Kleen , Arjan Van De Ven , David Woodhouse , Peter Zijlstra , Dan Williams , Paolo Bonzini , Jun Nakajima , Asit Mallick Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Thu, Jan 11, 2018 at 5:32 PM, Ashok Raj wrote: > - 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; > +} What's wrong with native_read_msr()? > + > +static inline void native_wrmsrl(unsigned int msr, u64 val) > +{ > + __wrmsr(msr, (u32) (val & 0xffffffffULL), (u32) (val >> 32)); > +} What's wrong with just wrmsrl()? If you really need a native helper like this, please add it to arch/x86/asm/msr.h.