aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/xc/lib/xc.h3
-rw-r--r--tools/xc/lib/xc_evtchn.c22
-rw-r--r--tools/xc/py/Xc.c26
3 files changed, 51 insertions, 0 deletions
diff --git a/tools/xc/lib/xc.h b/tools/xc/lib/xc.h
index 86edd09c4f..19cd720265 100644
--- a/tools/xc/lib/xc.h
+++ b/tools/xc/lib/xc.h
@@ -229,6 +229,9 @@ int xc_evtchn_bind_interdomain(int xc_handle,
u32 dom2, /* may be DOMID_SELF */
int *port1,
int *port2);
+int xc_evtchn_bind_virq(int xc_handle,
+ int virq,
+ int *port);
int xc_evtchn_close(int xc_handle,
u32 dom, /* may be DOMID_SELF */
int port);
diff --git a/tools/xc/lib/xc_evtchn.c b/tools/xc/lib/xc_evtchn.c
index 22654be515..624f5b1c15 100644
--- a/tools/xc/lib/xc_evtchn.c
+++ b/tools/xc/lib/xc_evtchn.c
@@ -8,6 +8,7 @@
#include "xc_private.h"
+
static int do_evtchn_op(int xc_handle, evtchn_op_t *op)
{
int ret = -1;
@@ -29,6 +30,7 @@ static int do_evtchn_op(int xc_handle, evtchn_op_t *op)
out1: return ret;
}
+
int xc_evtchn_bind_interdomain(int xc_handle,
u32 dom1,
u32 dom2,
@@ -54,6 +56,26 @@ int xc_evtchn_bind_interdomain(int xc_handle,
}
+int xc_evtchn_bind_virq(int xc_handle,
+ int virq,
+ int *port)
+{
+ evtchn_op_t op;
+ int rc;
+
+ op.cmd = EVTCHNOP_bind_virq;
+ op.u.bind_virq.virq = (u32)virq;
+
+ if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 )
+ {
+ if ( port != NULL )
+ *port = op.u.bind_virq.port;
+ }
+
+ return rc;
+}
+
+
int xc_evtchn_close(int xc_handle,
u32 dom,
int port)
diff --git a/tools/xc/py/Xc.c b/tools/xc/py/Xc.c
index bac671183d..e1ac79077d 100644
--- a/tools/xc/py/Xc.c
+++ b/tools/xc/py/Xc.c
@@ -1050,6 +1050,25 @@ static PyObject *pyxc_evtchn_bind_interdomain(PyObject *self,
"port2", port2);
}
+static PyObject *pyxc_evtchn_bind_virq(PyObject *self,
+ PyObject *args,
+ PyObject *kwds)
+{
+ XcObject *xc = (XcObject *)self;
+
+ int virq, port;
+
+ static char *kwd_list[] = { "virq", NULL };
+
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &virq) )
+ return NULL;
+
+ if ( xc_evtchn_bind_virq(xc->xc_handle, virq, &port) != 0 )
+ return PyErr_SetFromErrno(xc_error);
+
+ return PyInt_FromLong(port);
+}
+
static PyObject *pyxc_evtchn_close(PyObject *self,
PyObject *args,
PyObject *kwds)
@@ -1648,6 +1667,13 @@ static PyMethodDef pyxc_methods[] = {
" port1 [int]: Port-id for endpoint at dom1.\n"
" port2 [int]: Port-id for endpoint at dom2.\n" },
+ { "evtchn_bind_virq",
+ (PyCFunction)pyxc_evtchn_bind_virq,
+ METH_VARARGS | METH_KEYWORDS, "\n"
+ "Bind an event channel to the specified VIRQ.\n"
+ " virq [int]: VIRQ to bind.\n\n"
+ "Returns: [int] Bound event-channel port.\n" },
+
{ "evtchn_close",
(PyCFunction)pyxc_evtchn_close,
METH_VARARGS | METH_KEYWORDS, "\n"