if ( xc_get_system_cpu_policy(xch, i, &nr_leaves, leaves,
&nr_msrs, msrs) )
+ {
+ if ( errno == EOPNOTSUPP )
+ {
+ printf("%s policy not supported by Xen\n",
+ sys_policies[i]);
+ continue;
+ }
+
err(1, "xc_get_system_cpu_policy(, %s,,)", sys_policies[i]);
+ }
print_policy(sys_policies[i], leaves, nr_leaves,
msrs, nr_msrs);
#include <asm/psr.h>
#include <asm/cpuid.h>
-const struct cpu_policy system_policies[] = {
+const struct cpu_policy system_policies[6] = {
[ XEN_SYSCTL_cpu_policy_raw ] = {
&raw_cpuid_policy,
&raw_msr_policy,
&host_cpuid_policy,
&host_msr_policy,
},
+#ifdef CONFIG_PV
[ XEN_SYSCTL_cpu_policy_pv_max ] = {
&pv_max_cpuid_policy,
&pv_max_msr_policy,
},
- [ XEN_SYSCTL_cpu_policy_hvm_max ] = {
- &hvm_max_cpuid_policy,
- &hvm_max_msr_policy,
- },
[ XEN_SYSCTL_cpu_policy_pv_default ] = {
&pv_max_cpuid_policy,
&pv_max_msr_policy,
},
+#endif
+#ifdef CONFIG_HVM
+ [ XEN_SYSCTL_cpu_policy_hvm_max ] = {
+ &hvm_max_cpuid_policy,
+ &hvm_max_msr_policy,
+ },
[ XEN_SYSCTL_cpu_policy_hvm_default ] = {
&hvm_max_cpuid_policy,
&hvm_max_msr_policy,
},
+#endif
};
struct l3_cache_info {
array_index_nospec(sysctl->u.cpu_policy.index,
ARRAY_SIZE(system_policies))];
+ if ( !policy->cpuid || !policy->msr )
+ {
+ ret = -EOPNOTSUPP;
+ break;
+ }
+
/* Process the CPUID leaves. */
if ( guest_handle_is_null(sysctl->u.cpu_policy.cpuid_policy) )
sysctl->u.cpu_policy.nr_leaves = CPUID_MAX_SERIALISED_LEAVES;
* experimental features outside of security support.
* - Default_*: Default set of features a PV or HVM guest can use. This is
* the security supported set.
+ * May fail with -EOPNOTSUPP if querying for PV or HVM data when support is
+ * compiled out of Xen.
*/
struct xen_sysctl_cpu_policy {
#define XEN_SYSCTL_cpu_policy_raw 0