From: Roger Pau Monné Date: Wed, 17 Nov 2021 11:43:05 +0000 (+0100) Subject: tools/python: fix python libxc bindings to pass a max grant version X-Git-Tag: 4.16.0-rc4~7 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=1cffc48f1e1f972daeec579c62de4bb24f3152fa;p=xen.git tools/python: fix python libxc bindings to pass a max grant version Such max version should be provided by the caller, otherwise the bindings will default to specifying a max version of 2, which is inline with the current defaults in the hypervisor. Fixes: 7379f9e10a ('gnttab: allow setting max version per-domain') Signed-off-by: Roger Pau Monné Acked-by: Andrew Cooper Acked-by: Ian Jackson Acked-by: Marek Marczykowski-Górecki Release-Acked-by: Ian Jackson --- diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 6293d205a3..fd00861032 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -116,7 +116,7 @@ static PyObject *pyxc_domain_create(XcObject *self, PyObject *args, PyObject *kwds) { - uint32_t dom = 0, target = 0; + uint32_t dom = 0, target = 0, max_grant_version = 2; int ret; size_t i; PyObject *pyhandle = NULL; @@ -132,12 +132,13 @@ static PyObject *pyxc_domain_create(XcObject *self, }; static char *kwd_list[] = { "domid", "ssidref", "handle", "flags", - "target", "max_vcpus", NULL }; + "target", "max_vcpus", "max_grant_version", + NULL }; - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOiii", kwd_list, + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOiiii", kwd_list, &dom, &config.ssidref, &pyhandle, &config.flags, &target, - &config.max_vcpus) ) + &config.max_vcpus, &max_grant_version) ) return NULL; if ( pyhandle != NULL ) { @@ -162,6 +163,7 @@ static PyObject *pyxc_domain_create(XcObject *self, #else #error Architecture not supported #endif + config.grant_opts = XEN_DOMCTL_GRANT_version(max_grant_version); if ( (ret = xc_domain_create(self->xc_handle, &dom, &config)) < 0 ) return pyxc_error_to_exception(self->xc_handle);