bitkeeper revision 1.949 (40c849bbwzGqdgyEGz_X9EcI9GanBw)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 10 Jun 2004 11:44:59 +0000 (11:44 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 10 Jun 2004 11:44:59 +0000 (11:44 +0000)
Plumb bind_virq Xen command thru to Python.

tools/xc/lib/xc.h
tools/xc/lib/xc_evtchn.c
tools/xc/py/Xc.c

index 86edd09c4f197bf5e395778893d366e399d54552..19cd72026548c73e9da886cdcf3c6d2df01edc57 100644 (file)
@@ -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);
index 22654be515b8b7cde5df4de86dc7b9ba5f0d6682..624f5b1c156000d9063b75d227c974385ccd7d5b 100644 (file)
@@ -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)
index bac671183d3c7e95a6db9610bc365c60d593e3f5..e1ac79077d60892c1608e9907eb1631a5a013177 100644 (file)
@@ -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"