>>> On 08.06.18 at 11:59, <roger....@citrix.com> wrote:
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -3491,10 +3491,13 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t 
> *msr_content)
>          index = msr - MSR_MTRRfix4K_C0000;
>          *msr_content = fixed_range_base[index + 3];
>          break;
> -    case MSR_IA32_MTRR_PHYSBASE(0)...MSR_IA32_MTRR_PHYSMASK(MTRR_VCNT-1):
> +    case MSR_IA32_MTRR_PHYSBASE(0)...MSR_IA32_MTRR_PHYSMASK(MTRR_VCNT_MAX - 
> 1):
>          if ( !d->arch.cpuid->basic.mtrr )
>              goto gp_fault;
>          index = msr - MSR_IA32_MTRR_PHYSBASE(0);
> +        if ( (index / 2) >=
> +             MASK_EXTR(v->arch.hvm_vcpu.mtrr.mtrr_cap, MTRRcap_VCNT) )

I'd prefer if the line wrapping here and ...

> @@ -3652,10 +3655,13 @@ int hvm_msr_write_intercept(unsigned int msr, 
> uint64_t msr_content,
>                                       index, msr_content) )
>              goto gp_fault;
>          break;
> -    case MSR_IA32_MTRR_PHYSBASE(0)...MSR_IA32_MTRR_PHYSMASK(MTRR_VCNT-1):
> +    case MSR_IA32_MTRR_PHYSBASE(0)...MSR_IA32_MTRR_PHYSMASK(MTRR_VCNT_MAX - 
> 1):
>          if ( !d->arch.cpuid->basic.mtrr )
>              goto gp_fault;
> -        if ( !mtrr_var_range_msr_set(v->domain, &v->arch.hvm_vcpu.mtrr,
> +        index = msr - MSR_IA32_MTRR_PHYSBASE(0);
> +        if ( ((index / 2) >= MASK_EXTR(v->arch.hvm_vcpu.mtrr.mtrr_cap,
> +                                       MTRRcap_VCNT)) ||

... here was done as similarly as possible, to make it as easy as possible for
the reader to recognize this is twice the same expression.

With that (and this is easy enough to be done while committing, so no reason
on its own to send another version)
Reviewed-by: Jan Beulich <jbeul...@suse.com>

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to