aboutsummaryrefslogtreecommitdiffstats
path: root/tools/python
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2012-02-10 17:24:50 +0000
committerIan Campbell <ian.campbell@citrix.com>2012-02-10 17:24:50 +0000
commitc06bde41af2f41500a2b29a11b7cca0fb92af21b (patch)
tree2b151dae1a933b7c1768606ae772a93c093a1fad /tools/python
parentc13b827e66a93b121b48bd1fa6db1a11e77031c9 (diff)
downloadxen-c06bde41af2f41500a2b29a11b7cca0fb92af21b.tar.gz
xen-c06bde41af2f41500a2b29a11b7cca0fb92af21b.tar.bz2
xen-c06bde41af2f41500a2b29a11b7cca0fb92af21b.zip
xend: populate HVM guest grant table on boot
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/python')
-rw-r--r--tools/python/xen/lowlevel/xc/xc.c35
-rw-r--r--tools/python/xen/xend/XendConstants.py1
-rw-r--r--tools/python/xen/xend/image.py7
3 files changed, 43 insertions, 0 deletions
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 5f8f711e40..7c89756af1 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -1008,6 +1008,30 @@ static PyObject *pyxc_hvm_build(XcObject *self,
return Py_BuildValue("{}");
}
+static PyObject *pyxc_gnttab_hvm_seed(XcObject *self,
+ PyObject *args,
+ PyObject *kwds)
+{
+ uint32_t dom, console_domid, xenstore_domid;
+ unsigned long xenstore_gmfn = 0;
+ unsigned long console_gmfn = 0;
+ static char *kwd_list[] = { "domid",
+ "console_gmfn", "xenstore_gmfn",
+ "console_domid", "xenstore_domid", NULL };
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiii", kwd_list,
+ &dom,
+ &console_gmfn, &xenstore_gmfn,
+ &console_domid, &xenstore_domid) )
+ return NULL;
+
+ if ( xc_dom_gnttab_hvm_seed(self->xc_handle, dom,
+ console_gmfn, xenstore_gmfn,
+ console_domid, xenstore_domid) != 0 )
+ return pyxc_error_to_exception(self->xc_handle);
+
+ return Py_None;
+}
+
static PyObject *pyxc_evtchn_alloc_unbound(XcObject *self,
PyObject *args,
PyObject *kwds)
@@ -2439,6 +2463,17 @@ static PyMethodDef pyxc_methods[] = {
" vcpu_avail [long, 1]: Which Virtual CPUS available.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
+ { "gnttab_hvm_seed",
+ (PyCFunction)pyxc_gnttab_hvm_seed,
+ METH_KEYWORDS, "\n"
+ "Initialise HVM guest grant table.\n"
+ " dom [int]: Identifier of domain to build into.\n"
+ " console_gmfn [int]: \n"
+ " xenstore_gmfn [int]: \n"
+ " console_domid [int]: \n"
+ " xenstore_domid [int]: \n"
+ "Returns: None on sucess. Raises exception on error.\n" },
+
{ "hvm_get_param",
(PyCFunction)pyxc_get_hvm_param,
METH_VARARGS | METH_KEYWORDS, "\n"
diff --git a/tools/python/xen/xend/XendConstants.py b/tools/python/xen/xend/XendConstants.py
index 117d124a64..c41b0fae54 100644
--- a/tools/python/xen/xend/XendConstants.py
+++ b/tools/python/xen/xend/XendConstants.py
@@ -52,6 +52,7 @@ HVM_PARAM_TIMER_MODE = 10
HVM_PARAM_HPET_ENABLED = 11
HVM_PARAM_ACPI_S_STATE = 14
HVM_PARAM_VPT_ALIGN = 16
+HVM_PARAM_CONSOLE_PFN = 17
HVM_PARAM_NESTEDHVM = 24 # x86
restart_modes = [
diff --git a/tools/python/xen/xend/image.py b/tools/python/xen/xend/image.py
index f1464ac1f2..f3768b4612 100644
--- a/tools/python/xen/xend/image.py
+++ b/tools/python/xen/xend/image.py
@@ -971,6 +971,13 @@ class HVMImageHandler(ImageHandler):
xc.hvm_set_param(self.vm.getDomid(), HVM_PARAM_STORE_EVTCHN,
store_evtchn)
+ console_mfn = xc.hvm_get_param(self.vm.getDomid(), HVM_PARAM_CONSOLE_PFN)
+ xc.gnttab_hvm_seed(domid = self.vm.getDomid(),
+ console_gmfn = console_mfn,
+ xenstore_gmfn = rc['store_mfn'],
+ console_domid = 0,
+ xenstore_domid = 0)
+
return rc