[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 05.02.16 at 14:42, <andrew.cooper3@xxxxxxxxxx> wrote: > @@ -190,6 +191,71 @@ long arch_do_sysctl( > } > break; > > + case XEN_SYSCTL_get_cpu_featureset: > + { > + const uint32_t *featureset; > + unsigned int nr; > + > + /* Request for maximum number of features? */ > + if ( guest_handle_is_null(sysctl->u.cpu_featureset.features) ) > + { > + sysctl->u.cpu_featureset.nr_features = FSCAPINTS; > + if ( __copy_field_to_guest(u_sysctl, sysctl, > + u.cpu_featureset.nr_features) ) > + ret = -EFAULT; > + break; > + } > + > + /* Clip the number of entries. */ > + nr = sysctl->u.cpu_featureset.nr_features; > + if ( nr > FSCAPINTS ) > + nr = FSCAPINTS; min() (perhaps even allowing to obviate the comment)? > + switch ( sysctl->u.cpu_featureset.index ) > + { > + case XEN_SYSCTL_cpu_featureset_raw: > + featureset = raw_featureset; > + break; > + > + case XEN_SYSCTL_cpu_featureset_host: > + featureset = host_featureset; > + break; > + > + case XEN_SYSCTL_cpu_featureset_pv: > + featureset = pv_featureset; > + break; > + > + case XEN_SYSCTL_cpu_featureset_hvm: > + featureset = hvm_featureset; > + break; > + > + default: > + featureset = NULL; > + break; > + } > + > + /* Bad featureset index? */ > + if ( !ret && !featureset ) > + ret = -EINVAL; Nothing above altered "ret" from its zero value, so the check here is pointless. > --- a/xen/include/public/sysctl.h > +++ b/xen/include/public/sysctl.h > @@ -766,6 +766,29 @@ struct xen_sysctl_tmem_op { > typedef struct xen_sysctl_tmem_op xen_sysctl_tmem_op_t; > DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tmem_op_t); > > +/* > + * XEN_SYSCTL_get_cpu_featureset (x86 specific) > + * > + * Return information about the maximum sets of features which can be offered > + * to different types of guests. This is all strictly information as found > in > + * `cpuid` feature leaves with no synthetic additions. > + */ The reference to guests in the comment conflicts with the raw and host types below. > +struct xen_sysctl_cpu_featureset { > +#define XEN_SYSCTL_cpu_featureset_raw 0 > +#define XEN_SYSCTL_cpu_featureset_host 1 > +#define XEN_SYSCTL_cpu_featureset_pv 2 > +#define XEN_SYSCTL_cpu_featureset_hvm 3 > + uint32_t index; /* IN: Which featureset to query? */ > + uint32_t nr_features; /* IN/OUT: Number of entries in/written to > + * 'features', or the maximum number of features if > + * the guest handle is NULL. NB. All featuresets > + * come from the same numberspace, so have the same > + * maximum length. */ > + XEN_GUEST_HANDLE_64(uint32) features; /* OUT: */ Stray colon. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |