|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v6 03/12] libs/guest: allow fetching a specific CPUID leaf from a cpu policy
On 17.01.2022 10:48, Roger Pau Monne wrote:
> Introduce an interface that returns a specific leaf/subleaf from a cpu
> policy in xen_cpuid_leaf_t format.
>
> This is useful to callers can peek data from the opaque
> xc_cpu_policy_t type.
>
> No caller of the interface introduced on this patch.
>
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
with a nit:
> --- a/tools/libs/guest/xg_cpuid_x86.c
> +++ b/tools/libs/guest/xg_cpuid_x86.c
> @@ -855,6 +855,31 @@ int xc_cpu_policy_update_msrs(xc_interface *xch,
> xc_cpu_policy_t *policy,
> return rc;
> }
>
> +int xc_cpu_policy_get_cpuid(xc_interface *xch, const xc_cpu_policy_t *policy,
> + uint32_t leaf, uint32_t subleaf,
> + xen_cpuid_leaf_t *out)
> +{
> + const struct cpuid_leaf *tmp;
> +
> + *out = (xen_cpuid_leaf_t){};
> +
> + tmp = x86_cpuid_get_leaf(&policy->cpuid, leaf, subleaf);
> + if ( !tmp )
> + {
> + /* Unable to find a matching leaf. */
> + errno = ENOENT;
> + return -1;
> + }
> +
> + out->leaf = leaf;
> + out->subleaf = subleaf;
> + out->a = tmp->a;
> + out->b = tmp->b;
> + out->c = tmp->c;
> + out->d = tmp->d;
> + return 0;
> +}
Hypervisor style, which aiui also applies to libxc, would prefer a blank
line before the main "return" of a function.
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |