LOG(ERROR, "Couldn't set HVM_PARAM_TIMER_MODE");
goto out;
}
- if (xc_hvm_param_set(xch, domid, HVM_PARAM_NESTEDHVM,
- libxl_defbool_val(info->nested_hvm))) {
- LOG(ERROR, "Couldn't set HVM_PARAM_NESTEDHVM");
- goto out;
- }
if (xc_hvm_param_set(xch, domid, HVM_PARAM_ALTP2M, altp2m)) {
LOG(ERROR, "Couldn't set HVM_PARAM_ALTP2M");
goto out;
case HVM_PARAM_MEMORY_EVENT_CR3:
case HVM_PARAM_MEMORY_EVENT_CR4:
case HVM_PARAM_MEMORY_EVENT_INT3:
+ case HVM_PARAM_NESTEDHVM:
case HVM_PARAM_MEMORY_EVENT_SINGLE_STEP:
case HVM_PARAM_BUFIOREQ_EVTCHN:
case HVM_PARAM_MEMORY_EVENT_MSR:
case HVM_PARAM_ACPI_IOPORTS_LOCATION:
rc = pmtimer_change_ioport(d, value);
break;
- case HVM_PARAM_NESTEDHVM:
- rc = xsm_hvm_param_nested(XSM_PRIV, d);
- if ( rc )
- break;
- if ( value > 1 )
- rc = -EINVAL;
- /*
- * Remove the check below once we have
- * shadow-on-shadow.
- */
- if ( !paging_mode_hap(d) && value )
- rc = -EINVAL;
- if ( value &&
- d->arch.hvm.params[HVM_PARAM_ALTP2M] )
- rc = -EINVAL;
- /* Set up NHVM state for any vcpus that are already up. */
- if ( value &&
- !d->arch.hvm.params[HVM_PARAM_NESTEDHVM] )
- for_each_vcpu(d, v)
- if ( rc == 0 )
- rc = nestedhvm_vcpu_initialise(v);
- if ( !value || rc )
- for_each_vcpu(d, v)
- nestedhvm_vcpu_destroy(v);
- break;
case HVM_PARAM_ALTP2M:
rc = xsm_hvm_param_altp2mhvm(XSM_PRIV, d);
if ( rc )
break;
- if ( value > XEN_ALTP2M_limited )
- rc = -EINVAL;
- if ( value &&
- d->arch.hvm.params[HVM_PARAM_NESTEDHVM] )
+ if ( (value > XEN_ALTP2M_limited) ||
+ (value && nestedhvm_enabled(d)) )
rc = -EINVAL;
break;
case HVM_PARAM_TRIPLE_FAULT_REASON:
case HVM_PARAM_MEMORY_EVENT_CR3:
case HVM_PARAM_MEMORY_EVENT_CR4:
case HVM_PARAM_MEMORY_EVENT_INT3:
+ case HVM_PARAM_NESTEDHVM:
case HVM_PARAM_MEMORY_EVENT_SINGLE_STEP:
case HVM_PARAM_BUFIOREQ_EVTCHN:
case HVM_PARAM_MEMORY_EVENT_MSR:
};
/* Nested HVM on/off per domain */
-static always_inline bool nestedhvm_enabled(const struct domain *d)
+static inline bool nestedhvm_enabled(const struct domain *d)
{
- return is_hvm_domain(d) && d->arch.hvm.params &&
- d->arch.hvm.params[HVM_PARAM_NESTEDHVM];
+ return IS_ENABLED(CONFIG_HVM) && (d->options & XEN_DOMCTL_CDF_nested_virt);
}
/* Nested VCPU */
#define HVM_PARAM_MEMORY_EVENT_CR3 21
#define HVM_PARAM_MEMORY_EVENT_CR4 22
#define HVM_PARAM_MEMORY_EVENT_INT3 23
+#define HVM_PARAM_NESTEDHVM 24
#define HVM_PARAM_MEMORY_EVENT_SINGLE_STEP 25
#define HVM_PARAM_BUFIOREQ_EVTCHN 26
#define HVM_PARAM_MEMORY_EVENT_MSR 30
*/
#define HVM_PARAM_ACPI_IOPORTS_LOCATION 19
-/* Boolean: Enable nestedhvm (hvm only) */
-#define HVM_PARAM_NESTEDHVM 24
-
/* Params for the mem event rings */
#define HVM_PARAM_PAGING_RING_PFN 27
#define HVM_PARAM_MONITOR_RING_PFN 28