WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [XEN] New event-channel reset operation.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEN] New event-channel reset operation.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 20 Jan 2007 09:10:07 -0800
Delivery-date: Sat, 20 Jan 2007 09:10:15 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1169227257 0
# Node ID 62e2e515febe4ccdfa60056f0e4210e051bdc3e6
# Parent  f89126a590738ad804463772230dde0b4a6640ba
[XEN] New event-channel reset operation.
Plumbed through libxenctrl to python.

From: Andrei Petrov <andrei.petrov@xxxxxxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/libxc/xc_evtchn.c            |    9 ++++++++-
 tools/libxc/xenctrl.h              |    3 +++
 tools/python/xen/lowlevel/xc/xc.c  |   24 ++++++++++++++++++++++++
 xen/common/event_channel.c         |   31 +++++++++++++++++++++++++++++++
 xen/include/public/event_channel.h |   13 +++++++++++++
 5 files changed, 79 insertions(+), 1 deletion(-)

diff -r f89126a59073 -r 62e2e515febe tools/libxc/xc_evtchn.c
--- a/tools/libxc/xc_evtchn.c   Fri Jan 19 16:11:31 2007 +0000
+++ b/tools/libxc/xc_evtchn.c   Fri Jan 19 17:20:57 2007 +0000
@@ -37,7 +37,7 @@ int xc_evtchn_alloc_unbound(int xc_handl
                             uint32_t dom,
                             uint32_t remote_dom)
 {
-    int         rc;
+    int rc;
     struct evtchn_alloc_unbound arg = {
         .dom = (domid_t)dom,
         .remote_dom = (domid_t)remote_dom
@@ -49,3 +49,10 @@ int xc_evtchn_alloc_unbound(int xc_handl
 
     return rc;
 }
+
+int xc_evtchn_reset(int xc_handle,
+                    uint32_t dom)
+{
+    struct evtchn_reset arg = { .dom = (domid_t)dom };
+    return do_evtchn_op(xc_handle, EVTCHNOP_reset, &arg, sizeof(arg));
+}
diff -r f89126a59073 -r 62e2e515febe tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Fri Jan 19 16:11:31 2007 +0000
+++ b/tools/libxc/xenctrl.h     Fri Jan 19 17:20:57 2007 +0000
@@ -432,6 +432,9 @@ int xc_evtchn_alloc_unbound(int xc_handl
                             uint32_t dom,
                             uint32_t remote_dom);
 
+int xc_evtchn_reset(int xc_handle,
+                    uint32_t dom);
+
 int xc_physdev_pci_access_modify(int xc_handle,
                                  uint32_t domid,
                                  int bus,
diff -r f89126a59073 -r 62e2e515febe tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Fri Jan 19 16:11:31 2007 +0000
+++ b/tools/python/xen/lowlevel/xc/xc.c Fri Jan 19 17:20:57 2007 +0000
@@ -478,6 +478,24 @@ static PyObject *pyxc_evtchn_alloc_unbou
     return PyInt_FromLong(port);
 }
 
+static PyObject *pyxc_evtchn_reset(XcObject *self,
+                                  PyObject *args,
+                                  PyObject *kwds)
+{
+    uint32_t dom;
+
+    static char *kwd_list[] = { "dom", NULL };
+
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) )
+        return NULL;
+
+    if ( xc_evtchn_reset(self->xc_handle, dom) < 0 )
+        return pyxc_error_to_exception();
+
+    Py_INCREF(zero);
+    return zero;
+}
+
 static PyObject *pyxc_physdev_pci_access_modify(XcObject *self,
                                                 PyObject *args,
                                                 PyObject *kwds)
@@ -1201,6 +1219,12 @@ static PyMethodDef pyxc_methods[] = {
       " dom        [int]: Domain whose port space to allocate from.\n"
       " remote_dom [int]: Remote domain to accept connections from.\n\n"
       "Returns: [int] Unbound event-channel port.\n" },
+
+    { "evtchn_reset", 
+      (PyCFunction)pyxc_evtchn_reset,
+      METH_VARARGS | METH_KEYWORDS, "\n"
+      "Reset all connections.\n"
+      " dom [int]: Domain to reset.\n" },
 
     { "physdev_pci_access_modify",
       (PyCFunction)pyxc_physdev_pci_access_modify,
diff -r f89126a59073 -r 62e2e515febe xen/common/event_channel.c
--- a/xen/common/event_channel.c        Fri Jan 19 16:11:31 2007 +0000
+++ b/xen/common/event_channel.c        Fri Jan 19 17:20:57 2007 +0000
@@ -735,6 +735,29 @@ static long evtchn_unmask(evtchn_unmask_
 }
 
 
+static long evtchn_reset(evtchn_reset_t *r)
+{
+    domid_t dom = r->dom;
+    struct domain *d;
+    int i;
+
+    if ( dom == DOMID_SELF )
+        dom = current->domain->domain_id;
+    else if ( !IS_PRIV(current->domain) )
+        return -EPERM;
+
+    if ( (d = find_domain_by_id(dom)) == NULL )
+        return -ESRCH;
+
+    for ( i = 0; port_is_valid(d, i); i++ )
+        (void)__evtchn_close(d, i);
+
+    put_domain(d);
+
+    return 0;
+}
+
+
 long do_event_channel_op(int cmd, XEN_GUEST_HANDLE(void) arg)
 {
     long rc;
@@ -830,6 +853,14 @@ long do_event_channel_op(int cmd, XEN_GU
         if ( copy_from_guest(&unmask, arg, 1) != 0 )
             return -EFAULT;
         rc = evtchn_unmask(&unmask);
+        break;
+    }
+
+    case EVTCHNOP_reset: {
+        struct evtchn_reset reset;
+        if ( copy_from_guest(&reset, arg, 1) != 0 )
+            return -EFAULT;
+        rc = evtchn_reset(&reset);
         break;
     }
 
diff -r f89126a59073 -r 62e2e515febe xen/include/public/event_channel.h
--- a/xen/include/public/event_channel.h        Fri Jan 19 16:11:31 2007 +0000
+++ b/xen/include/public/event_channel.h        Fri Jan 19 17:20:57 2007 +0000
@@ -217,6 +217,19 @@ typedef struct evtchn_unmask evtchn_unma
 typedef struct evtchn_unmask evtchn_unmask_t;
 
 /*
+ * EVTCHNOP_reset: Close all event channels associated with specified domain.
+ * NOTES:
+ *  1. <dom> may be specified as DOMID_SELF.
+ *  2. Only a sufficiently-privileged domain may specify other than DOMID_SELF.
+ */
+#define EVTCHNOP_reset           10
+struct evtchn_reset {
+    /* IN parameters. */
+    domid_t dom;
+};
+typedef struct evtchn_reset evtchn_reset_t;
+
+/*
  * Argument to event_channel_op_compat() hypercall. Superceded by new
  * event_channel_op() hypercall since 0x00030202.
  */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XEN] New event-channel reset operation., Xen patchbot-unstable <=