public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Borislav Petkov <bp@amd64.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>, Jacob Shin <jacob.shin@amd.com>,
	Andre Przywara <andre.przywara@amd.com>,
	jeremy@goop.org, xen-devel@lists.xensource.com,
	LKML <linux-kernel@vger.kernel.org>,
	Jan Beulich <JBeulich@suse.com>, Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <borislav.petkov@amd.com>
Subject: Re: [PATCH 4/4] x86, CPU, AMD: Deprecate AMD-specific MSR variants
Date: Wed, 6 Jun 2012 16:07:04 -0400	[thread overview]
Message-ID: <20120606200704.GB9602@phenom.dumpdata.com> (raw)
In-Reply-To: <1338562358-28182-5-git-send-email-bp@amd64.org>

On Fri, Jun 01, 2012 at 04:52:38PM +0200, Borislav Petkov wrote:
> From: Borislav Petkov <borislav.petkov@amd.com>
> 
> Now that all users of {rd,wr}msr_amd_safe have been fixed, deprecate its
> use by making them private to amd.c and adding warnings when used on
> anything else beside K8.
> 

Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
> ---
>  arch/x86/include/asm/msr.h |   27 ---------------------------
>  arch/x86/kernel/cpu/amd.c  |   33 +++++++++++++++++++++++++++++++++
>  2 files changed, 33 insertions(+), 27 deletions(-)
> 
> diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
> index 81860cc012d1..cb33b5f00267 100644
> --- a/arch/x86/include/asm/msr.h
> +++ b/arch/x86/include/asm/msr.h
> @@ -211,33 +211,6 @@ do {                                                            \
>  
>  #endif	/* !CONFIG_PARAVIRT */
>  
> -static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p)
> -{
> -	u32 gprs[8] = { 0 };
> -	int err;
> -
> -	gprs[1] = msr;
> -	gprs[7] = 0x9c5a203a;
> -
> -	err = rdmsr_safe_regs(gprs);
> -
> -	*p = gprs[0] | ((u64)gprs[2] << 32);
> -
> -	return err;
> -}
> -
> -static inline int wrmsrl_amd_safe(unsigned msr, unsigned long long val)
> -{
> -	u32 gprs[8] = { 0 };
> -
> -	gprs[0] = (u32)val;
> -	gprs[1] = msr;
> -	gprs[2] = val >> 32;
> -	gprs[7] = 0x9c5a203a;
> -
> -	return wrmsr_safe_regs(gprs);
> -}
> -
>  #define checking_wrmsrl(msr, val) wrmsr_safe((msr), (u32)(val),		\
>  					     (u32)((val) >> 32))
>  
> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> index 80ccd99542e6..c928eb26ada6 100644
> --- a/arch/x86/kernel/cpu/amd.c
> +++ b/arch/x86/kernel/cpu/amd.c
> @@ -19,6 +19,39 @@
>  
>  #include "cpu.h"
>  
> +static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p)
> +{
> +	struct cpuinfo_x86 *c = &cpu_data(smp_processor_id());
> +	u32 gprs[8] = { 0 };
> +	int err;
> +
> +	WARN_ONCE((c->x86 != 0xf), "%s should only be used on K8!\n", __func__);
> +
> +	gprs[1] = msr;
> +	gprs[7] = 0x9c5a203a;
> +
> +	err = rdmsr_safe_regs(gprs);
> +
> +	*p = gprs[0] | ((u64)gprs[2] << 32);
> +
> +	return err;
> +}
> +
> +static inline int wrmsrl_amd_safe(unsigned msr, unsigned long long val)
> +{
> +	struct cpuinfo_x86 *c = &cpu_data(smp_processor_id());
> +	u32 gprs[8] = { 0 };
> +
> +	WARN_ONCE((c->x86 != 0xf), "%s should only be used on K8!\n", __func__);
> +
> +	gprs[0] = (u32)val;
> +	gprs[1] = msr;
> +	gprs[2] = val >> 32;
> +	gprs[7] = 0x9c5a203a;
> +
> +	return wrmsr_safe_regs(gprs);
> +}
> +
>  #ifdef CONFIG_X86_32
>  /*
>   *	B step AMD K6 before B 9730xxxx have hardware bugs that can cause
> -- 
> 1.7.9.3.362.g71319

  parent reply	other threads:[~2012-06-06 20:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1338562358-28182-1-git-send-email-bp@amd64.org>
2012-06-01 14:53 ` [PATCH 0/4] x86, CPU, AMD: Cleanup AMD-specific MSR-rw users H. Peter Anvin
2012-06-01 14:57   ` Borislav Petkov
2012-06-01 15:06     ` H. Peter Anvin
     [not found] ` <1338562358-28182-2-git-send-email-bp@amd64.org>
2012-06-06 20:06   ` [PATCH 1/4] x86, pvops: Remove hooks for {rd,wr}msr_safe_regs Konrad Rzeszutek Wilk
2012-06-07 21:58   ` [tip:x86/cpu] " tip-bot for Andre Przywara
     [not found] ` <1338562358-28182-3-git-send-email-bp@amd64.org>
2012-06-01 18:22   ` [PATCH 2/4] x86, CPU: Fix show_msr MSR accessing function Yinghai Lu
2012-06-01 22:50     ` Borislav Petkov
2012-06-06 20:07   ` Konrad Rzeszutek Wilk
2012-06-07 21:59   ` [tip:x86/cpu] x86, cpu: " tip-bot for Borislav Petkov
     [not found] ` <1338562358-28182-4-git-send-email-bp@amd64.org>
2012-06-06 20:07   ` [PATCH 3/4] x86, AMD: Fix crash as Xen Dom0 on AMD Trinity systems Konrad Rzeszutek Wilk
2012-06-06 22:00   ` H. Peter Anvin
2012-06-07  7:21     ` Borislav Petkov
2012-06-07  7:49       ` Andre Przywara
2012-06-07  8:08         ` Greg KH
2012-06-07  8:18           ` Andre Przywara
2012-06-07 13:25             ` [GIT PULL] x86, CPU, AMD: Cleanup AMD-specific MSR-rw users Borislav Petkov
2012-06-07 16:27           ` [PATCH 3/4] x86, AMD: Fix crash as Xen Dom0 on AMD Trinity systems H. Peter Anvin
2012-06-07 22:00   ` [tip:x86/cpu] x86, cpu, amd: " tip-bot for Andre Przywara
     [not found] ` <1338562358-28182-5-git-send-email-bp@amd64.org>
2012-06-06 20:07   ` Konrad Rzeszutek Wilk [this message]
2012-06-07 22:01   ` [tip:x86/cpu] x86, cpu, amd: Deprecate AMD-specific MSR variants tip-bot for Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120606200704.GB9602@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=andre.przywara@amd.com \
    --cc=borislav.petkov@amd.com \
    --cc=bp@amd64.org \
    --cc=hpa@zytor.com \
    --cc=jacob.shin@amd.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox