From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: Re: [PATCH v2 23/30] xen+tools: Export maximum host and guest cpu featuresets via SYSCTL Date: Fri, 5 Feb 2016 16:12:12 +0000 Message-ID: <20160205161212.GD23178@citrix.com> References: <1454679743-18133-1-git-send-email-andrew.cooper3@citrix.com> <1454679743-18133-24-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1454679743-18133-24-git-send-email-andrew.cooper3@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Wei Liu , Ian Campbell , Tim Deegan , Rob Hoes , Xen-devel , Jan Beulich , David Scott List-Id: xen-devel@lists.xenproject.org On Fri, Feb 05, 2016 at 01:42:16PM +0000, Andrew Cooper wrote: > And provide stubs for toolstack use. > > Signed-off-by: Andrew Cooper > --- > CC: Jan Beulich > CC: Tim Deegan > CC: Ian Campbell > CC: Wei Liu > CC: David Scott > CC: Rob Hoes > > 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