On Wed, 2015-12-16 at 21:24 +0000, Andrew Cooper wrote: > Later changes will cause the cpuid generation logic to seed their > information > from a featureset. This patch adds the infrastructure to specify a > featureset, and will obtain the appropriate default from Xen if omitted. > > Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com> > --- > CC: Ian Campbell <ian.campb...@citrix.com> > CC: Ian Jackson <ian.jack...@eu.citrix.com> > CC: Wei Liu <wei.l...@citrix.com> > --- > tools/libxc/include/xenctrl.h | 3 ++ > tools/libxc/xc_cpuid_x86.c | 90 > ++++++++++++++++++++++++++++++++++++++----- > 2 files changed, 84 insertions(+), 9 deletions(-) > > diff --git a/tools/libxc/include/xenctrl.h > b/tools/libxc/include/xenctrl.h > index 27e1f45..b44aec7 100644 > --- a/tools/libxc/include/xenctrl.h > +++ b/tools/libxc/include/xenctrl.h > @@ -2211,6 +2211,9 @@ int xc_cpuid_set(xc_interface *xch, > char **config_transformed); > int xc_cpuid_apply_policy(xc_interface *xch, > domid_t domid); > +int xc_cpuid_apply_policy_with_featureset(xc_interface *xch, domid_t domid, > + uint32_t *featureset, > + unsigned int nr_features);
We should aim to eventually only have one apply policy interface here not two, unless there is some good reason why xc_cpuid_apply_policy() should remain? AIUI passing featureset==NULL is going to be semantically identical to the old interface, so I think we should just go with adding the new parameters to the existing function. > @@ -103,6 +109,32 @@ static int get_cpuid_domain_info(xc_interface *xch, > domid_t domid, > info->hvm = di.hvm; > info->pvh = di.pvh; > > + /* Get featureset information. */ > + rc = xc_get_featureset(xch, XEN_SYSCTL_featureset_host, > + &host_nr_features, NULL); > + if ( rc ) > + return rc; > + > + if ( host_nr_features < XEN_FEATURESET_7c0 ) > + return -EINVAL; Could we assert this? I mean if Xen and libxc don't agree on this then something went pretty wrong during the dev window. > + > + info->featureset = calloc(host_nr_features, sizeof(*info->featureset)); > + if ( !info->featureset ) > + return -ENOMEM; > + > + info->nr_features = host_nr_features; > + > + if ( featureset ) > + { > + memcpy(info->featureset, featureset, > + min(host_nr_features, nr_features) * > sizeof(*info->featureset)); > + > + /* Check for trucated set bits. */ "truncated" Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel