}
}
-static void get_featureset(xc_interface *xch, unsigned int idx)
+static int get_featureset(xc_interface *xch, unsigned int idx)
{
struct fsinfo *f = &featuresets[idx];
if ( !f->fs )
err(1, "calloc(, featureset)");
- if ( xc_get_cpu_featureset(xch, idx, &f->len, f->fs) )
- err(1, "xc_get_featureset()");
+ return xc_get_cpu_featureset(xch, idx, &f->len, f->fs);
}
static void dump_info(xc_interface *xch, bool detail)
printf("\nDynamic sets:\n");
for ( i = 0; i < ARRAY_SIZE(featuresets); ++i )
{
- get_featureset(xch, i);
+ if ( get_featureset(xch, i) )
+ {
+ if ( errno == EOPNOTSUPP )
+ {
+ printf("%s featureset not supported by Xen\n",
+ featuresets[i].name);
+ continue;
+ }
+
+ err(1, "xc_get_featureset()");
+ }
decode_featureset(featuresets[i].fs, featuresets[i].len,
featuresets[i].name, detail);
case XEN_SYSCTL_get_cpu_featureset:
{
- static const struct cpuid_policy *const policy_table[] = {
+ static const struct cpuid_policy *const policy_table[4] = {
[XEN_SYSCTL_cpu_featureset_raw] = &raw_cpuid_policy,
[XEN_SYSCTL_cpu_featureset_host] = &host_cpuid_policy,
+#ifdef CONFIG_PV
[XEN_SYSCTL_cpu_featureset_pv] = &pv_max_cpuid_policy,
+#endif
+#ifdef CONFIG_HVM
[XEN_SYSCTL_cpu_featureset_hvm] = &hvm_max_cpuid_policy,
+#endif
};
const struct cpuid_policy *p = NULL;
uint32_t featureset[FSCAPINTS];
/* Look up requested featureset. */
if ( sysctl->u.cpu_featureset.index < ARRAY_SIZE(policy_table) )
+ {
p = policy_table[sysctl->u.cpu_featureset.index];
- /* Bad featureset index? */
- if ( !p )
- ret = -EINVAL;
+ if ( !p )
+ ret = -EOPNOTSUPP;
+ }
else
+ /* Bad featureset index? */
+ ret = -EINVAL;
+
+ if ( !ret )
cpuid_policy_to_featureset(p, featureset);
/* Copy the requested featureset into place. */
* - Host: The values Xen is using, (after command line overrides, etc).
* - PV: Maximum set of features which can be given to a PV guest.
* - HVM: Maximum set of features which can be given to a HVM guest.
+ * May fail with -EOPNOTSUPP if querying for PV or HVM data when support is
+ * compiled out of Xen.
*/
struct xen_sysctl_cpu_featureset {
#define XEN_SYSCTL_cpu_featureset_raw 0