All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>,
	Steffen Einsle <einsle@phptrix.de>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2] x86/msr: handle reads to MSR_P5_MC_{ADDR,TYPE}
Date: Thu, 28 Apr 2022 12:39:19 +0200	[thread overview]
Message-ID: <4843821d-4e9b-f57d-cf84-375f0b8a3ff2@suse.com> (raw)
In-Reply-To: <20220428091359.90431-1-roger.pau@citrix.com>

On 28.04.2022 11:13, Roger Pau Monne wrote:
> --- a/xen/arch/x86/cpu/mcheck/mce.h
> +++ b/xen/arch/x86/cpu/mcheck/mce.h
> @@ -169,6 +169,11 @@ static inline int mce_vendor_bank_msr(const struct vcpu *v, uint32_t msr)
>          if (msr >= MSR_IA32_MC0_CTL2 &&
>              msr < MSR_IA32_MCx_CTL2(v->arch.vmce.mcg_cap & MCG_CAP_COUNT) )
>              return 1;
> +
> +    case X86_VENDOR_CENTAUR:
> +    case X86_VENDOR_SHANGHAI:
> +        if (msr == MSR_P5_MC_ADDR || msr == MSR_P5_MC_TYPE)
> +            return 1;
>          break;

You want to have some fall-through annotation there, perhaps preferably
the pseudo-keyword one.

> --- a/xen/arch/x86/cpu/mcheck/mce_intel.c
> +++ b/xen/arch/x86/cpu/mcheck/mce_intel.c
> @@ -1008,8 +1008,24 @@ int vmce_intel_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
>  
>  int vmce_intel_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
>  {
> +    const struct cpuid_policy *cp = v->domain->arch.cpuid;
>      unsigned int bank = msr - MSR_IA32_MC0_CTL2;
>  
> +    switch ( msr )
> +    {
> +    case MSR_P5_MC_ADDR:
> +        /* Bank 0 is used for the 'bank 0 quirk' on older processors. */
> +        *val = v->arch.vmce.bank[1].mci_addr;
> +        return 1;
> +
> +    case MSR_P5_MC_TYPE:
> +        *val = v->arch.vmce.bank[1].mci_status;
> +        return 1;
> +    }

Could I ask you to add a reference to vcpu_fill_mc_msrs() in the comment?

> +    if ( cp->x86_vendor & (X86_VENDOR_CENTAUR | X86_VENDOR_SHANGHAI) )
> +        return 0;

I think this better would be !(cp->x86_vendor & X86_VENDOR_INTEL).

Jan



  reply	other threads:[~2022-04-28 10:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-28  9:13 [PATCH v2] x86/msr: handle reads to MSR_P5_MC_{ADDR,TYPE} Roger Pau Monne
2022-04-28 10:39 ` Jan Beulich [this message]
2022-04-28 10:52   ` Roger Pau Monné

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=4843821d-4e9b-f57d-cf84-375f0b8a3ff2@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=einsle@phptrix.de \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.