|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 23/30] xen+tools: Export maximum host and guest cpu featuresets via SYSCTL
On Fri, Feb 05, 2016 at 01:42:16PM +0000, Andrew Cooper wrote:
> And provide stubs for toolstack use.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
> CC: Jan Beulich <JBeulich@xxxxxxxx>
> CC: Tim Deegan <tim@xxxxxxx>
> CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
> CC: Wei Liu <wei.liu2@xxxxxxxxxx>
> CC: David Scott <dave@xxxxxxxxxx>
> CC: Rob Hoes <Rob.Hoes@xxxxxxxxxx>
>
> v2:
> * Rebased to use libxencall
> * Improve hypercall documentation
> ---
> tools/libxc/include/xenctrl.h | 3 ++
> tools/libxc/xc_cpuid_x86.c | 27 +++++++++++++++
> tools/ocaml/libs/xc/xenctrl.ml | 3 ++
> tools/ocaml/libs/xc/xenctrl.mli | 4 +++
> tools/ocaml/libs/xc/xenctrl_stubs.c | 35 ++++++++++++++++++++
> xen/arch/x86/sysctl.c | 66
> +++++++++++++++++++++++++++++++++++++
> xen/include/public/sysctl.h | 25 ++++++++++++++
> 7 files changed, 163 insertions(+)
>
> diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
> index 1a5f4ec..5a7500a 100644
> --- a/tools/libxc/include/xenctrl.h
> +++ b/tools/libxc/include/xenctrl.h
> @@ -2571,6 +2571,9 @@ int xc_psr_cat_get_domain_data(xc_interface *xch,
> uint32_t domid,
> int xc_psr_cat_get_l3_info(xc_interface *xch, uint32_t socket,
> uint32_t *cos_max, uint32_t *cbm_len,
> bool *cdp_enabled);
> +
> +int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
> + uint32_t *nr_features, uint32_t *featureset);
> #endif
>
> /* Compat shims */
> diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
> index c142595..7b802da 100644
> --- a/tools/libxc/xc_cpuid_x86.c
> +++ b/tools/libxc/xc_cpuid_x86.c
> @@ -33,6 +33,33 @@
> #define DEF_MAX_INTELEXT 0x80000008u
> #define DEF_MAX_AMDEXT 0x8000001cu
>
> +int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
> + uint32_t *nr_features, uint32_t *featureset)
> +{
> + DECLARE_SYSCTL;
> + DECLARE_HYPERCALL_BOUNCE(featureset,
> + *nr_features * sizeof(*featureset),
> + XC_HYPERCALL_BUFFER_BOUNCE_OUT);
> + int ret;
> +
> + if ( xc_hypercall_bounce_pre(xch, featureset) )
> + return -1;
> +
> + sysctl.cmd = XEN_SYSCTL_get_cpu_featureset;
> + sysctl.u.cpu_featureset.index = index;
> + sysctl.u.cpu_featureset.nr_features = *nr_features;
> + set_xen_guest_handle(sysctl.u.cpu_featureset.features, featureset);
> +
> + ret = do_sysctl(xch, &sysctl);
> +
> + xc_hypercall_bounce_post(xch, featureset);
> +
> + if ( !ret )
> + *nr_features = sysctl.u.cpu_featureset.nr_features;
> +
> + return ret;
> +}
> +
Looks like a sensible wrapper, so
Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |