diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xenstore-domain.c index 47717508a2..3236d14416 100644 --- a/tools/helpers/init-xenstore-domain.c +++ b/tools/helpers/init-xenstore-domain.c @@ -66,6 +66,7 @@ static int build(xc_interface *xch) struct xen_domctl_createdomain config = { .ssidref = SECINITSID_DOMU, .flags = XEN_DOMCTL_CDF_xs_domain, + .max_vcpus = 1, .max_evtchn_port = -1, /* No limit. */ /* @@ -100,7 +101,7 @@ static int build(xc_interface *xch) fprintf(stderr, "xc_domain_create failed\n"); goto err; } - rv = xc_domain_max_vcpus(xch, domid, 1); + rv = xc_domain_max_vcpus(xch, domid, config.max_vcpus); if ( rv ) { fprintf(stderr, "xc_domain_max_vcpus failed\n"); diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 8b755e412d..60676304e9 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -566,6 +566,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config, if (!libxl_domid_valid_guest(*domid)) { struct xen_domctl_createdomain create = { .ssidref = info->ssidref, + .max_vcpus = b_info->max_vcpus, .max_evtchn_port = b_info->event_channels, .max_grant_frames = b_info->max_grant_frames, .max_maptrack_frames = b_info->max_maptrack_frames, diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index 42f45c4b67..40fbd3790f 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -63,6 +63,7 @@ type domctl_create_config = ssidref: int32; handle: string; flags: domain_create_flag list; + max_vcpus: int; max_evtchn_port: int; max_grant_frames: int; max_maptrack_frames: int; diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli index 0db58162d0..906ce9486b 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -55,6 +55,7 @@ type domctl_create_config = { ssidref: int32; handle: string; flags: domain_create_flag list; + max_vcpus: int; max_evtchn_port: int; max_grant_frames: int; max_maptrack_frames: int; diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c index 1b5abd9f3a..578a014eac 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -128,15 +128,17 @@ CAMLprim value stub_xc_domain_create(value xch, value config) #define VAL_SSIDREF Field(config, 0) #define VAL_HANDLE Field(config, 1) #define VAL_FLAGS Field(config, 2) -#define VAL_MAX_EVTCHN_PORT Field(config, 3) -#define VAL_MAX_GRANT_FRAMES Field(config, 4) -#define VAL_MAX_MAPTRACK_FRAMES Field(config, 5) -#define VAL_ARCH Field(config, 6) +#define VAL_MAX_VCPUS Field(config, 3) +#define VAL_MAX_EVTCHN_PORT Field(config, 4) +#define VAL_MAX_GRANT_FRAMES Field(config, 5) +#define VAL_MAX_MAPTRACK_FRAMES Field(config, 6) +#define VAL_ARCH Field(config, 7) uint32_t domid = 0; int result; struct xen_domctl_createdomain cfg = { .ssidref = Int32_val(VAL_SSIDREF), + .max_vcpus = Int_val(VAL_MAX_VCPUS), .max_evtchn_port = Int_val(VAL_MAX_EVTCHN_PORT), .max_grant_frames = Int_val(VAL_MAX_GRANT_FRAMES), .max_maptrack_frames = Int_val(VAL_MAX_MAPTRACK_FRAMES), @@ -178,6 +180,7 @@ CAMLprim value stub_xc_domain_create(value xch, value config) #undef VAL_MAX_MAPTRACK_FRAMES #undef VAL_MAX_GRANT_FRAMES #undef VAL_MAX_EVTCHN_PORT +#undef VAL_MAX_VCPUS #undef VAL_FLAGS #undef VAL_HANDLE #undef VAL_SSIDREF diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 6bd58ecbcd..b137d5a839 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -125,16 +125,19 @@ static PyObject *pyxc_domain_create(XcObject *self, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, }, + .max_vcpus = 1, .max_evtchn_port = -1, /* No limit. */ .max_grant_frames = 32, .max_maptrack_frames = 1024, }; - static char *kwd_list[] = { "domid", "ssidref", "handle", "flags", "target", NULL }; + static char *kwd_list[] = { "domid", "ssidref", "handle", "flags", + "target", "max_vcpus", NULL }; - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOii", kwd_list, + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOiii", kwd_list, &dom, &config.ssidref, &pyhandle, - &config.flags, &target)) + &config.flags, &target, + &config.max_vcpus) ) return NULL; if ( pyhandle != NULL ) { diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index 2b496d4e31..512e21d1b8 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -70,6 +70,7 @@ struct xen_domctl_createdomain { * Various domain limits, which impact the quantity of resources (global * mapping space, xenheap, etc) a guest may consume. */ + uint32_t max_vcpus; uint32_t max_evtchn_port; uint32_t max_grant_frames; uint32_t max_maptrack_frames;