|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2] x86: cap address bits CPUID output
>>> On 09.05.16 at 15:21, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 09/05/16 14:15, Jan Beulich wrote:
>> Don't use more or report more to guests than we are capable of
>> handling.
>>
>> At once
>> - correct the involved extended CPUID level checks,
>> - simplify the code in hvm_cpuid() and mtrr_top_of_ram().
>>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>
> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, with perhaps one
> tweak
>
>> --- a/xen/arch/x86/hvm/hvm.c
>> +++ b/xen/arch/x86/hvm/hvm.c
>> @@ -3504,19 +3504,19 @@ void hvm_cpuid(unsigned int input, unsig
>> break;
>>
>> case 0x80000008:
>> + *eax &= 0xff;
>> count = d->arch.paging.gfn_bits + PAGE_SHIFT;
>> - if ( (*eax & 0xff) > count )
>> - *eax = (*eax & ~0xff) | count;
>> + if ( *eax > count )
>> + *eax = count;
>>
>> hvm_cpuid(1, NULL, NULL, NULL, &_edx);
>> count = _edx & (cpufeat_mask(X86_FEATURE_PAE) |
>> cpufeat_mask(X86_FEATURE_PSE36)) ? 36 : 32;
>> - if ( (*eax & 0xff) < count )
>> - *eax = (*eax & ~0xff) | count;
>> + if ( *eax < count )
>> + *eax = count;
>>
>> hvm_cpuid(0x80000001, NULL, NULL, NULL, &_edx);
>> - *eax = (*eax & ~0xffff00) | (_edx & cpufeat_mask(X86_FEATURE_LM)
>> - ? 0x3000 : 0x2000);
>> + *eax |= _edx & cpufeat_mask(X86_FEATURE_LM) ? vaddr_bits << 8 :
>> 0x2000;
In that case I'd prefer
*eax |= (_edx & cpufeat_mask(X86_FEATURE_LM) ? vaddr_bits : 32) << 8;
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |