[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
- To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Mon, 17 Jan 2022 13:28:33 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rtWZEOfJ9AiHdhqjH4nGoRpCIwysbRJTTeRjHzakYi8=; b=AmnCHRKVjXVxdAft6Q/razNAf03+R2DnbRbVG4hDzhTt3wDQU4NOSF2x5QAMWjjEx+Fm3F5MI500q2cpbmTRlR8lbSzeuZ3BuD9oU37U2Vh9cFX6EjIaGQl5ekdNJS3IXb21Lbbuxeg6yQto0ZT2Y9rKGd3FRU9gTJPIEH8HAC1MX6ojvGVGqzfipXCOUDkSzxovbUaQtcizOHfF4lDBrVB2H8Eu/rXQWA9n0bu4Vjp2vCTB33ctWXRCCc7E/IcsE7msCwGll5jJE74Fi2dRuMxLUAVoQYxD8F2R6s8Tz08BEV6SlOs/qgi2tvb2OSVhoDcojPnD9llk0UKP4vb1fw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CUeCcl/Dh9Ncuie2wrWgAOCJKGK18EiXXWS9oxcNv+kgKY5ArQ3vRR6Etg/5FDqgB52iSNgrvC+iNdLERtLrjiDMfm6Dml03WB7WZCxwGWIvViUCw24uxlK6K0Nydie7MwZb7yiUWtwJxgorV8K7N/tn0lBwe9L5z5bf6mXDFS24IlyO7mC0qU/zrLUz4cYvhAxKZqGIfPugo6JOZVhOLTdgUpcdGIjAwQHjHWPKPHlAgL133zmkWH5doRru2xCXumgUvM9stsEMjYHMz75JerIc59UFMtOH0ndZ9mzMx1Y+0c+Fv63OrRK2aR3HdRbMmbpn0fCNtL+IGTfwQdnDyw==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Mon, 17 Jan 2022 12:28:51 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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
|