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

Re: [Xen-devel] [PATCH 04/10] x86/cpuid: Handle leaf 0x4 in guest_cpuid()



>>> On 20.02.17 at 12:00, <andrew.cooper3@xxxxxxxxxx> wrote:
> --- a/xen/arch/x86/cpuid.c
> +++ b/xen/arch/x86/cpuid.c
> @@ -163,6 +163,9 @@ static void recalculate_xstate(struct cpuid_policy *p)
>   */
>  static void recalculate_misc(struct cpuid_policy *p)
>  {
> +    /* Leaves with subleaf unions. */
> +    p->basic.raw[0x4] = p->basic.raw[0x7] = p->basic.raw[0xd] = EMPTY_LEAF;

How come you play with leaves 7 and 0xd here?

> @@ -244,6 +248,25 @@ static void __init calculate_raw_policy(void)
>          cpuid_leaf(i, &p->basic.raw[i]);
>      }
>  
> +    if ( p->basic.max_leaf >= 4 )
> +    {
> +        for ( i = 0; i < ARRAY_SIZE(p->cache.raw); ++i )
> +        {
> +            cpuid_count_leaf(4, i, &p->cache.raw[i]);
> +
> +            if ( p->cache.subleaf[i].type == 0 )
> +                break;
> +        }
> +
> +        /*
> +         * The choice of CPUID_GUEST_NR_CACHE is arbitrary.  It is expected
> +         * that it will eventually need increasing for future hardware.
> +         */
> +        if ( i == ARRAY_SIZE(p->cache.raw) )
> +            printk(XENLOG_WARNING
> +                   "CPUID: Insufficient Leaf 4 space for this hardware\n");
> +    }

It probably doesn't hurt, but it's one off: There's no enough space
only when the next (i-th) doesn't report type 0.

> @@ -125,6 +126,15 @@ struct cpuid_policy
>          };
>      } basic;
>  
> +    /* Structured cache leaf: 0x00000004[xx] */
> +    union {
> +        struct cpuid_leaf raw[CPUID_GUEST_NR_CACHE];
> +        struct {
> +            uint32_t type:4,

According to the SDM version I'm looking at this is a 5 bit field.

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®.