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

Re: [Xen-devel] [PATCH v2 17/30] xen/x86: setup PVHv2 Dom0 CPUs



>>> On 27.09.16 at 17:57, <roger.pau@xxxxxxxxxx> wrote:
> The logic used to setup the CPUID leaves is extremely simplistic (and
> probably wrong for hardware different than mine). I'm not sure what's the
> best way to deal with this, the code that currently sets the CPUID leaves
> for HVM guests lives in libxc, maybe moving it xen/common would be better?

Yeah, a pre-populated array of leaves certainly won't do.

> +    rc = arch_set_info_hvm_guest(v, &cpu_ctx);
> +    if ( rc )
> +    {
> +        printk("Unable to setup Dom0 BSP context: %d\n", rc);
> +        return rc;
> +    }
> +    clear_bit(_VPF_down, &v->pause_flags);

Even if it may not matter right away, I think you want to clear this
flag later, after having completed all setup.

> +    for ( i = 0; i < ARRAY_SIZE(cpuid_leaves); i++ )
> +    {
> +        d->arch.cpuids[i].input[0] = cpuid_leaves[i].index;
> +        d->arch.cpuids[i].input[1] = cpuid_leaves[i].count;
> +        if ( d->arch.cpuids[i].input[1] == XEN_CPUID_INPUT_UNUSED )
> +            cpuid(d->arch.cpuids[i].input[0], &d->arch.cpuids[i].eax,
> +                  &d->arch.cpuids[i].ebx, &d->arch.cpuids[i].ecx,
> +                  &d->arch.cpuids[i].edx);
> +        else
> +            cpuid_count(d->arch.cpuids[i].input[0], 
> d->arch.cpuids[i].input[1],
> +                        &d->arch.cpuids[i].eax, &d->arch.cpuids[i].ebx,
> +                        &d->arch.cpuids[i].ecx, &d->arch.cpuids[i].edx);

Why this if/else? It is always fine to use cpuid_count().

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