@@ -5,7 +5,12 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
libxl_domain_config *d_config,
struct xen_domctl_createdomain *config)
{
- switch(d_config->c_info.type) {
+ libxl_domain_create_info *info = &d_config->c_info;
+
+ if (info->type == LIBXL_DOMAIN_TYPE_HVM)
+ config->flags |= XEN_DOMCTL_CDF_evtchn_upcall;
+
+ switch(info->type) {
case LIBXL_DOMAIN_TYPE_HVM:
config->arch.emulation_flags = (XEN_X86_EMU_ALL & ~XEN_X86_EMU_VPCI);
break;
@@ -66,6 +66,7 @@ type domain_create_flag =
| CDF_IOMMU
| CDF_NESTED_VIRT
| CDF_EVTCHN_FIFO
+ | CDF_EVTCHN_UPCALL
type domain_create_iommu_opts =
| IOMMU_NO_SHAREPT
@@ -59,6 +59,7 @@ type domain_create_flag =
| CDF_IOMMU
| CDF_NESTED_VIRT
| CDF_EVTCHN_FIFO
+ | CDF_EVTCHN_UPCALL
type domain_create_iommu_opts =
| IOMMU_NO_SHAREPT
@@ -662,11 +662,19 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
}
if ( !hvm )
+ {
+ if ( config->flags & XEN_DOMCTL_CDF_evtchn_upcall )
+ {
+ dprintk(XENLOG_INFO, "Per-vCPU event channel vector only supported for HVM guests\n");
+ return -EINVAL;
+ }
+
/*
* It is only meaningful for XEN_DOMCTL_CDF_oos_off to be clear
* for HVM guests.
*/
config->flags |= XEN_DOMCTL_CDF_oos_off;
+ }
if ( nested_virt && !hap )
{
@@ -4037,6 +4037,9 @@ static int hvmop_set_evtchn_upcall_vector(
struct domain *d = current->domain;
struct vcpu *v;
+ if ( !(d->options & XEN_DOMCTL_CDF_evtchn_upcall) )
+ return -ENOSYS;
+
if ( !is_hvm_domain(d) )
return -EINVAL;
@@ -751,6 +751,7 @@ static struct domain *__init create_dom0(const module_t *image,
if ( opt_dom0_pvh )
{
dom0_cfg.flags |= (XEN_DOMCTL_CDF_hvm |
+ XEN_DOMCTL_CDF_evtchn_upcall |
((hvm_hap_supported() && !opt_dom0_shadow) ?
XEN_DOMCTL_CDF_hap : 0));
@@ -307,7 +307,8 @@ static int sanitise_domain_config(struct xen_domctl_createdomain *config)
~(XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap |
XEN_DOMCTL_CDF_s3_integrity | XEN_DOMCTL_CDF_oos_off |
XEN_DOMCTL_CDF_xs_domain | XEN_DOMCTL_CDF_iommu |
- XEN_DOMCTL_CDF_nested_virt | XEN_DOMCTL_CDF_evtchn_fifo) )
+ XEN_DOMCTL_CDF_nested_virt | XEN_DOMCTL_CDF_evtchn_fifo |
+ XEN_DOMCTL_CDF_evtchn_upcall ) )
{
dprintk(XENLOG_INFO, "Unknown CDF flags %#x\n", config->flags);
return -EINVAL;
@@ -72,9 +72,11 @@ struct xen_domctl_createdomain {
#define XEN_DOMCTL_CDF_nested_virt (1U << _XEN_DOMCTL_CDF_nested_virt)
#define _XEN_DOMCTL_CDF_evtchn_fifo 7
#define XEN_DOMCTL_CDF_evtchn_fifo (1U << _XEN_DOMCTL_CDF_evtchn_fifo)
+#define _XEN_DOMCTL_CDF_evtchn_upcall 8
+#define XEN_DOMCTL_CDF_evtchn_upcall (1U << _XEN_DOMCTL_CDF_evtchn_upcall)
/* Max XEN_DOMCTL_CDF_* constant. Used for ABI checking. */
-#define XEN_DOMCTL_CDF_MAX XEN_DOMCTL_CDF_evtchn_fifo
+#define XEN_DOMCTL_CDF_MAX XEN_DOMCTL_CDF_evtchn_upcall
uint32_t flags;