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

Re: [Xen-devel] [PATCH 09/27] x86/cpuid: Dispatch cpuid_hypervisor_leaves() from guest_cpuid()



>>> On 04.01.17 at 16:40, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 04/01/17 15:34, Jan Beulich wrote:
>>>>> On 04.01.17 at 13:39, <andrew.cooper3@xxxxxxxxxx> wrote:
>>> @@ -929,83 +927,71 @@ int cpuid_hypervisor_leaves( uint32_t idx, uint32_t 
>>> sub_idx,
>>>              limit = XEN_CPUID_MAX_NUM_LEAVES;
>>>      }
>>>  
>>> -    if ( idx > limit ) 
>>> -        return 0;
>>> +    if ( idx > limit )
>>> +        return;
>>>  
>>>      switch ( idx )
>>>      {
>>>      case 0:
>>> -        *eax = base + limit; /* Largest leaf */
>>> -        *ebx = XEN_CPUID_SIGNATURE_EBX;
>>> -        *ecx = XEN_CPUID_SIGNATURE_ECX;
>>> -        *edx = XEN_CPUID_SIGNATURE_EDX;
>>> +        res->a = base + limit; /* Largest leaf */
>>> +        res->b = XEN_CPUID_SIGNATURE_EBX;
>>> +        res->c = XEN_CPUID_SIGNATURE_ECX;
>>> +        res->d = XEN_CPUID_SIGNATURE_EDX;
>>>          break;
>>>  
>>>      case 1:
>>> -        *eax = (xen_major_version() << 16) | xen_minor_version();
>>> -        *ebx = 0;          /* Reserved */
>>> -        *ecx = 0;          /* Reserved */
>>> -        *edx = 0;          /* Reserved */
>>> +        res->a = (xen_major_version() << 16) | xen_minor_version();
>>>          break;
>>>  
>>>      case 2:
>>> -        *eax = 1;          /* Number of hypercall-transfer pages */
>>> -        *ebx = 0x40000000; /* MSR base address */
>>> -        if ( is_viridian_domain(currd) )
>>> -            *ebx = 0x40000200;
>>> -        *ecx = 0;          /* Features 1 */
>>> -        *edx = 0;          /* Features 2 */
>>> -        if ( is_pv_domain(currd) )
>>> -            *ecx |= XEN_CPUID_FEAT1_MMU_PT_UPDATE_PRESERVE_AD;
>>> +        res->a = 1;          /* Number of hypercall-transfer pages */
>>> +        res->b = 0x40000000; /* MSR base address */
>>> +        if ( is_viridian_domain(d) )
>>> +            res->b = 0x40000200;
>> Could I talk you into making this a conditional expression, as you're
>> touching it anyway?
> 
> Ok.  I did find the value of 0x40000200 particularly odd (given that we
> split the CPUID leaves on the 100 boundary), but it has been like that
> for ages.

I guess the assumption was that the MSR space might grow faster
than the CPUID one, and personally I would agree with such a
guess. Not sure whether the Viridian spec perhaps calls out that
value as an upper limit for its MSR space (otherwise I'm not really
clear how we would deal with them growing beyond that boundary).

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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