On 06.05.2024 09:46, Fonyuy-Asheri Caleb wrote:
> I came across these constants in the code 
> (xen/include/xen/lib/x86/cpu-policy.h file) but no explanation of why they 
> have been set that way. 
> 
> #define CPUID_GUEST_NR_BASIC (0xdu + 1) 
> #define CPUID_GUEST_NR_CACHE (5u + 1) 
> #define CPUID_GUEST_NR_FEAT (2u + 1) 
> #define CPUID_GUEST_NR_TOPO (1u + 1) 
> #define CPUID_GUEST_NR_XSTATE (62u + 1) 
> #define CPUID_GUEST_NR_EXTD_INTEL (0x8u + 1) 
> #define CPUID_GUEST_NR_EXTD_AMD (0x21u + 1) 
> 
> Please can someone explain to me why we have these constants or point to a 
> documentation which explains it? 

These specify the number of (sub)leaves Xen supports, first and foremost to
dimension internal arrays accordingly. I.e. the "why" lies in the way they're
used.

> I am particularly interested in the CPUID_GUEST_NR_BASIC given that for intel 
> processors for example, we have 
> basic leaves running up to 0x21u already for recent processors. This value 
> sort of forces a particular max leaf value. 

Right, but support (for guests) for these needs properly enabling. Hence why
that limit is the way it is, for the time being.

Jan

Reply via email to