typedef struct xen_arch_domainconfig xc_domain_configuration_t;
-int xc_domain_create_config(xc_interface *xch,
- uint32_t ssidref,
- xen_domain_handle_t handle,
- uint32_t flags,
- uint32_t *pdomid,
- xc_domain_configuration_t *config);
-int xc_domain_create(xc_interface *xch,
- uint32_t ssidref,
- xen_domain_handle_t handle,
- uint32_t flags,
- uint32_t *pdomid);
+int xc_domain_create(xc_interface *xch, uint32_t ssidref,
+ xen_domain_handle_t handle, uint32_t flags,
+ uint32_t *pdomid, xc_domain_configuration_t *config);
/* Functions to produce a dump of a given domain
#include <xen/memory.h>
#include <xen/hvm/hvm_op.h>
-int xc_domain_create_config(xc_interface *xch,
- uint32_t ssidref,
- xen_domain_handle_t handle,
- uint32_t flags,
- uint32_t *pdomid,
- xc_domain_configuration_t *config)
+int xc_domain_create(xc_interface *xch, uint32_t ssidref,
+ xen_domain_handle_t handle, uint32_t flags,
+ uint32_t *pdomid, xc_domain_configuration_t *config)
{
+ xc_domain_configuration_t lconfig;
int err;
DECLARE_DOMCTL;
+ if ( config == NULL )
+ {
+ memset(&lconfig, 0, sizeof(lconfig));
+
+#if defined (__i386) || defined(__x86_64__)
+ if ( flags & XEN_DOMCTL_CDF_hvm_guest )
+ lconfig.emulation_flags = XEN_X86_EMU_ALL;
+#elif defined (__arm__) || defined(__aarch64__)
+ lconfig.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
+ lconfig.nr_spis = 0;
+#else
+#error Architecture not supported
+#endif
+
+ config = &lconfig;
+ }
+
domctl.cmd = XEN_DOMCTL_createdomain;
domctl.domain = (domid_t)*pdomid;
domctl.u.createdomain.ssidref = ssidref;
return 0;
}
-int xc_domain_create(xc_interface *xch,
- uint32_t ssidref,
- xen_domain_handle_t handle,
- uint32_t flags,
- uint32_t *pdomid)
-{
- xc_domain_configuration_t config;
-
- memset(&config, 0, sizeof(config));
-
-#if defined (__i386) || defined(__x86_64__)
- /* No arch-specific configuration for now */
-#elif defined (__arm__) || defined(__aarch64__)
- config.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
- config.nr_spis = 0;
-#else
- errno = ENOSYS;
- return -1;
-#endif
-
- return xc_domain_create_config(xch, ssidref, handle,
- flags, pdomid, &config);
-}
-
int xc_domain_cacheflush(xc_interface *xch, uint32_t domid,
xen_pfn_t start_pfn, xen_pfn_t nr_pfns)
{
/* Valid domid here means we're soft resetting. */
if (!libxl_domid_valid_guest(*domid)) {
- ret = xc_domain_create_config(ctx->xch, info->ssidref,
- handle, flags, domid,
- xc_config);
+ ret = xc_domain_create(ctx->xch, info->ssidref, handle, flags, domid,
+ xc_config);
if (ret < 0) {
LOGE(ERROR, "domain creation fail");
rc = ERROR_FAIL;
}
caml_enter_blocking_section();
- result = xc_domain_create(_H(xch), c_ssidref, h, c_flags, &domid);
+ result = xc_domain_create(_H(xch), c_ssidref, h, c_flags, &domid, NULL);
caml_leave_blocking_section();
if (result < 0)
}
if ( (ret = xc_domain_create(self->xc_handle, ssidref,
- handle, flags, &dom)) < 0 )
+ handle, flags, &dom, NULL)) < 0 )
return pyxc_error_to_exception(self->xc_handle);
if ( target )
rv = xc_flask_context_to_sid(xch, argv[3], strlen(argv[3]), &ssid);
if (rv) goto err;
- rv = xc_domain_create(xch, ssid, handle, 0, &domid);
+ rv = xc_domain_create(xch, ssid, handle, 0, &domid, NULL);
if (rv) goto err;
rv = xc_domain_max_vcpus(xch, domid, 1);
if (rv) goto err;