mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
tools: Pass grant table limits to XEN_DOMCTL_set_gnttab_limits
XEN_DOMCTL_set_gnttab_limits is a fairly new hypercall, and is strictly mandatory. As it pertains to domain limits, it should be provided at createdomain time. In preparation to remove the hypercall, extend xen_domctl_createdomain with the fields and arrange for all callers to pass appropriate details. There is no change in construction behaviour yet, but later patches will rearrange the hypervisor internals, then delete the hypercall. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Christian Lindig <christian.lindig@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
This commit is contained in:
1 parent
f04955e185
commit
a903bf5233
7 files changed
+27
-7
No files matched your search
@@ -67,6 +67,14 @@ static int build(xc_interface *xch)
|
||||
.ssidref = SECINITSID_DOMU,
|
||||
.flags = XEN_DOMCTL_CDF_xs_domain,
|
||||
.max_evtchn_port = -1, /* No limit. */
|
||||
|
||||
/*
|
||||
* 1 grant frame is enough: we don't need many grants.
|
||||
* Mini-OS doesn't like less than 4, though, so use 4.
|
||||
* 128 maptrack frames: 256 entries per frame, enough for 32768 domains.
|
||||
*/
|
||||
.max_grant_frames = 4,
|
||||
.max_maptrack_frames = 128,
|
||||
};
|
||||
|
||||
xs_fd = open("/dev/xen/xenbus_backend", O_RDWR);
|
||||
@@ -104,12 +112,8 @@ static int build(xc_interface *xch)
|
||||
fprintf(stderr, "xc_domain_setmaxmem failed\n");
|
||||
goto err;
|
||||
}
|
||||
/*
|
||||
* 1 grant frame is enough: we don't need many grants.
|
||||
* Mini-OS doesn't like less than 4, though, so use 4.
|
||||
* 128 maptrack frames: 256 entries per frame, enough for 32768 domains.
|
||||
*/
|
||||
rv = xc_domain_set_gnttab_limits(xch, domid, 4, 128);
|
||||
rv = xc_domain_set_gnttab_limits(xch, domid, config.max_grant_frames,
|
||||
config.max_maptrack_frames);
|
||||
if ( rv )
|
||||
{
|
||||
fprintf(stderr, "xc_domain_set_gnttab_limits failed\n");
|
||||
|
||||
@@ -567,6 +567,8 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
|
||||
struct xen_domctl_createdomain create = {
|
||||
.ssidref = info->ssidref,
|
||||
.max_evtchn_port = b_info->event_channels,
|
||||
.max_grant_frames = b_info->max_grant_frames,
|
||||
.max_maptrack_frames = b_info->max_maptrack_frames,
|
||||
};
|
||||
|
||||
if (info->type != LIBXL_DOMAIN_TYPE_PV) {
|
||||
|
||||
@@ -64,6 +64,8 @@ type domctl_create_config =
|
||||
handle: string;
|
||||
flags: domain_create_flag list;
|
||||
max_evtchn_port: int;
|
||||
max_grant_frames: int;
|
||||
max_maptrack_frames: int;
|
||||
arch: arch_domainconfig;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,8 @@ type domctl_create_config = {
|
||||
handle: string;
|
||||
flags: domain_create_flag list;
|
||||
max_evtchn_port: int;
|
||||
max_grant_frames: int;
|
||||
max_maptrack_frames: int;
|
||||
arch: arch_domainconfig;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,13 +129,17 @@ CAMLprim value stub_xc_domain_create(value xch, value config)
|
||||
#define VAL_HANDLE Field(config, 1)
|
||||
#define VAL_FLAGS Field(config, 2)
|
||||
#define VAL_MAX_EVTCHN_PORT Field(config, 3)
|
||||
#define VAL_ARCH Field(config, 4)
|
||||
#define VAL_MAX_GRANT_FRAMES Field(config, 4)
|
||||
#define VAL_MAX_MAPTRACK_FRAMES Field(config, 5)
|
||||
#define VAL_ARCH Field(config, 6)
|
||||
|
||||
uint32_t domid = 0;
|
||||
int result;
|
||||
struct xen_domctl_createdomain cfg = {
|
||||
.ssidref = Int32_val(VAL_SSIDREF),
|
||||
.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),
|
||||
};
|
||||
|
||||
domain_handle_of_uuid_string(cfg.handle, String_val(VAL_HANDLE));
|
||||
@@ -171,6 +175,8 @@ CAMLprim value stub_xc_domain_create(value xch, value config)
|
||||
}
|
||||
|
||||
#undef VAL_ARCH
|
||||
#undef VAL_MAX_MAPTRACK_FRAMES
|
||||
#undef VAL_MAX_GRANT_FRAMES
|
||||
#undef VAL_MAX_EVTCHN_PORT
|
||||
#undef VAL_FLAGS
|
||||
#undef VAL_HANDLE
|
||||
|
||||
@@ -126,6 +126,8 @@ static PyObject *pyxc_domain_create(XcObject *self,
|
||||
0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef,
|
||||
},
|
||||
.max_evtchn_port = -1, /* No limit. */
|
||||
.max_grant_frames = 32,
|
||||
.max_maptrack_frames = 1024,
|
||||
};
|
||||
|
||||
static char *kwd_list[] = { "domid", "ssidref", "handle", "flags", "target", NULL };
|
||||
|
||||
@@ -71,6 +71,8 @@ struct xen_domctl_createdomain {
|
||||
* mapping space, xenheap, etc) a guest may consume.
|
||||
*/
|
||||
uint32_t max_evtchn_port;
|
||||
uint32_t max_grant_frames;
|
||||
uint32_t max_maptrack_frames;
|
||||
|
||||
struct xen_arch_domainconfig arch;
|
||||
};
|
||||
|
||||