[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] x86/msr: handle reads to MSR_P5_MC_{ADDR,TYPE}


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 28 Apr 2022 12:39:19 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lEDezbWKENeWgQHA+ZYebJ9iu3swu/0Z4wX2q7pOqQY=; b=MklIyz2Ph/jN/OoBvgxjqvv9zs0yp8xNX43Da+lh2nBCKFphxGPQoHRenohtr3sjiHpUenBSGFNjjzrlPnjCPerDpybNiMbYXouj2CkQF6dsfzivz2RK/WKgCjUnKfmwMcK6dDCdsg9djbBoRwZGyEoKCRbC8sks7YZ3qxa7jnUxz2FVH3jS3vt6GMfxJSjigBHaLKCFNNWTISlf17w1X36800soUi2gAC36msItoZ2OGSzhri9Bq8Iff9hknn4vKY1Fb+GoGsLPHkOvHHUnF1OwOzVdrsCXdnu5kKPELjIoojNeLxs0YuPSBzVFjee389AQiSnflZQ5CHcMX/gnVw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m1OWSYfBkdWhWbcnyu+2zvMO23/E2cHPCOcPN0bNRKZ7nYuTRjObJnstOJYazGzioHufJ7orUMtDXCXmrCLVsZyo44Za3ph5lWnUO81hUEfGoWL3rGD3kVVVv0DZljGBdCY80eifYzUfOgYJeRdwUJYmlOum7kaaxx0HiJ0VU8aII2cSZ7lCuAwT9QysYs6tlDuBXwVUI1YZ6q+qKHj8DWZQvNZMOpc2lbtAzGE1s3WJwNUNBtQ+kqmxdZH5LqQjAwOvTD265iBoVS2bT9/dyG7QTQoIjfISGXuhgpA+2DgdMbBj70/HwRyBVYis74oggzwK1M6UM1ng7M81ah93mg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Steffen Einsle <einsle@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 28 Apr 2022 10:39:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.