[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Merge.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 1fb835267a50551fc071673fa27eb1490b90ec91
# Parent  03c8002068d9d60c7bbfc2f41af975e09b2e2211
# Parent  fc0040fd13d8c72c095d90db2bf935f44134e97e
Merge.
---
 extras/mini-os/console/xencons_ring.c |    2 
 extras/mini-os/events.c               |   72 +++++++++++++++++++---------------
 extras/mini-os/gnttab.c               |   12 +++++
 extras/mini-os/include/events.h       |   24 ++++++-----
 extras/mini-os/include/gnttab.h       |    1 
 extras/mini-os/time.c                 |    2 
 extras/mini-os/xenbus/xenbus.c        |    3 -
 7 files changed, 71 insertions(+), 45 deletions(-)

diff -r 03c8002068d9 -r 1fb835267a50 extras/mini-os/console/xencons_ring.c
--- a/extras/mini-os/console/xencons_ring.c     Fri Jul 28 16:53:58 2006 +0100
+++ b/extras/mini-os/console/xencons_ring.c     Fri Jul 28 16:54:17 2006 +0100
@@ -53,7 +53,7 @@ int xencons_ring_send(const char *data, 
 
 
 
-static void handle_input(int port, struct pt_regs *regs, void *ign)
+static void handle_input(evtchn_port_t port, struct pt_regs *regs, void *ign)
 {
        struct xencons_interface *intf = xencons_interface();
        XENCONS_RING_IDX cons, prod;
diff -r 03c8002068d9 -r 1fb835267a50 extras/mini-os/events.c
--- a/extras/mini-os/events.c   Fri Jul 28 16:53:58 2006 +0100
+++ b/extras/mini-os/events.c   Fri Jul 28 16:54:17 2006 +0100
@@ -26,20 +26,20 @@
 
 /* this represents a event handler. Chaining or sharing is not allowed */
 typedef struct _ev_action_t {
-       void (*handler)(int, struct pt_regs *, void *);
+       evtchn_handler_t handler;
        void *data;
     u32 count;
 } ev_action_t;
 
 
 static ev_action_t ev_actions[NR_EVS];
-void default_handler(int port, struct pt_regs *regs, void *data);
+void default_handler(evtchn_port_t port, struct pt_regs *regs, void *data);
 
 
 /*
  * Demux events to different handlers.
  */
-int do_event(u32 port, struct pt_regs *regs)
+int do_event(evtchn_port_t port, struct pt_regs *regs)
 {
     ev_action_t  *action;
     if (port >= NR_EVS) {
@@ -60,8 +60,8 @@ int do_event(u32 port, struct pt_regs *r
 
 }
 
-int bind_evtchn( u32 port, void (*handler)(int, struct pt_regs *, void *),
-                                void *data )
+evtchn_port_t bind_evtchn(evtchn_port_t port, evtchn_handler_t handler,
+                                                 void *data)
 {
        if(ev_actions[port].handler != default_handler)
         printk("WARN: Handler for port %d already registered, replacing\n",
@@ -77,7 +77,7 @@ int bind_evtchn( u32 port, void (*handle
        return port;
 }
 
-void unbind_evtchn( u32 port )
+void unbind_evtchn(evtchn_port_t port )
 {
        if (ev_actions[port].handler == default_handler)
                printk("WARN: No handler for port %d when unbinding\n", port);
@@ -86,8 +86,7 @@ void unbind_evtchn( u32 port )
        ev_actions[port].data = NULL;
 }
 
-int bind_virq( u32 virq, void (*handler)(int, struct pt_regs *, void *data),
-                          void *data)
+int bind_virq(uint32_t virq, evtchn_handler_t handler, void *data)
 {
        evtchn_op_t op;
 
@@ -103,11 +102,6 @@ int bind_virq( u32 virq, void (*handler)
     }
     bind_evtchn(op.u.bind_virq.port, handler, data);
        return 0;
-}
-
-void unbind_virq( u32 port )
-{
-       unbind_evtchn(port);
 }
 
 #if defined(__x86_64__)
@@ -142,32 +136,48 @@ void init_events(void)
     }
 }
 
-void default_handler(int port, struct pt_regs *regs, void *ignore)
+void default_handler(evtchn_port_t port, struct pt_regs *regs, void *ignore)
 {
     printk("[Port %d] - event received\n", port);
 }
 
+/* Create a port available to the pal for exchanging notifications.
+   Returns the result of the hypervisor call. */
+
 /* Unfortunate confusion of terminology: the port is unbound as far
    as Xen is concerned, but we automatically bind a handler to it
    from inside mini-os. */
-int evtchn_alloc_unbound(void (*handler)(int, struct pt_regs *regs,
-                                                                               
 void *data),
-                                                void *data)
+
+int evtchn_alloc_unbound(domid_t pal, evtchn_handler_t handler,
+                                                void *data, evtchn_port_t 
*port)
 {
-       u32 port;
-       evtchn_op_t op;
-       int err;
+    evtchn_op_t op;
+    op.cmd = EVTCHNOP_alloc_unbound;
+    op.u.alloc_unbound.dom = DOMID_SELF;
+    op.u.alloc_unbound.remote_dom = pal;
+    int err = HYPERVISOR_event_channel_op(&op);
+    if (err)
+               return err;
+    *port = bind_evtchn(op.u.alloc_unbound.port, handler, data);
+    return err;
+}
 
-       op.cmd = EVTCHNOP_alloc_unbound;
-       op.u.alloc_unbound.dom = DOMID_SELF;
-       op.u.alloc_unbound.remote_dom = 0;
+/* Connect to a port so as to allow the exchange of notifications with
+   the pal. Returns the result of the hypervisor call. */
 
-       err = HYPERVISOR_event_channel_op(&op);
-       if (err) {
-               printk("Failed to alloc unbound evtchn: %d.\n", err);
-               return -1;
-       }
-       port = op.u.alloc_unbound.port;
-       bind_evtchn(port, handler, data);
-       return port;
+int evtchn_bind_interdomain(domid_t pal, evtchn_port_t remote_port,
+                           evtchn_handler_t handler, void *data,
+                           evtchn_port_t *local_port)
+{
+    evtchn_op_t op;
+    op.cmd = EVTCHNOP_bind_interdomain;
+    op.u.bind_interdomain.remote_dom = pal;
+    op.u.bind_interdomain.remote_port = remote_port;
+    int err = HYPERVISOR_event_channel_op(&op);
+    if (err)
+               return err;
+       evtchn_port_t port = op.u.bind_interdomain.local_port;
+    clear_evtchn(port);              /* Without, handler gets invoked now! */
+    *local_port = bind_evtchn(port, handler, data);
+    return err;
 }
diff -r 03c8002068d9 -r 1fb835267a50 extras/mini-os/gnttab.c
--- a/extras/mini-os/gnttab.c   Fri Jul 28 16:53:58 2006 +0100
+++ b/extras/mini-os/gnttab.c   Fri Jul 28 16:54:17 2006 +0100
@@ -137,6 +137,18 @@ gnttab_alloc_and_grant(void **map)
     return gref;
 }
 
+static const char *gnttabop_error_msgs[] = GNTTABOP_error_msgs;
+
+const char *
+gnttabop_error(int16_t status)
+{
+    status = -status;
+    if (status < 0 || status >= ARRAY_SIZE(gnttabop_error_msgs))
+       return "bad status";
+    else
+        return gnttabop_error_msgs[status];
+}
+
 void
 init_gnttab(void)
 {
diff -r 03c8002068d9 -r 1fb835267a50 extras/mini-os/include/events.h
--- a/extras/mini-os/include/events.h   Fri Jul 28 16:53:58 2006 +0100
+++ b/extras/mini-os/include/events.h   Fri Jul 28 16:54:17 2006 +0100
@@ -22,20 +22,22 @@
 #include<traps.h>
 #include <xen/event_channel.h>
 
+typedef void (*evtchn_handler_t)(evtchn_port_t, struct pt_regs *, void *);
+
 /* prototypes */
-int do_event(u32 port, struct pt_regs *regs);
-int bind_virq( u32 virq, void (*handler)(int, struct pt_regs *, void *data),
-                          void *data);
-int bind_evtchn( u32 virq, void (*handler)(int, struct pt_regs *, void *data),
-                                void *data );
-void unbind_evtchn( u32 port );
+int do_event(evtchn_port_t port, struct pt_regs *regs);
+int bind_virq(uint32_t virq, evtchn_handler_t handler, void *data);
+evtchn_port_t bind_evtchn(evtchn_port_t port, evtchn_handler_t handler,
+                                                 void *data);
+void unbind_evtchn(evtchn_port_t port);
 void init_events(void);
-void unbind_virq( u32 port );
-int evtchn_alloc_unbound(void (*handler)(int, struct pt_regs *regs,
-                                                                               
 void *data),
-                                                void *data);
+int evtchn_alloc_unbound(domid_t pal, evtchn_handler_t handler,
+                                                void *data, evtchn_port_t 
*port);
+int evtchn_bind_interdomain(domid_t pal, evtchn_port_t remote_port,
+                                                       evtchn_handler_t 
handler, void *data,
+                                                       evtchn_port_t 
*local_port);
 
-static inline int notify_remote_via_evtchn(int port)
+static inline int notify_remote_via_evtchn(evtchn_port_t port)
 {
     evtchn_op_t op;
     op.cmd = EVTCHNOP_send;
diff -r 03c8002068d9 -r 1fb835267a50 extras/mini-os/include/gnttab.h
--- a/extras/mini-os/include/gnttab.h   Fri Jul 28 16:53:58 2006 +0100
+++ b/extras/mini-os/include/gnttab.h   Fri Jul 28 16:54:17 2006 +0100
@@ -10,5 +10,6 @@ grant_ref_t gnttab_grant_transfer(domid_
 grant_ref_t gnttab_grant_transfer(domid_t domid, unsigned long pfn);
 unsigned long gnttab_end_transfer(grant_ref_t gref);
 int gnttab_end_access(grant_ref_t ref);
+const char *gnttabop_error(int16_t status);
 
 #endif /* !__GNTTAB_H__ */
diff -r 03c8002068d9 -r 1fb835267a50 extras/mini-os/time.c
--- a/extras/mini-os/time.c     Fri Jul 28 16:53:58 2006 +0100
+++ b/extras/mini-os/time.c     Fri Jul 28 16:54:17 2006 +0100
@@ -215,7 +215,7 @@ void block_domain(u32 millisecs)
 /*
  * Just a dummy 
  */
-static void timer_handler(int ev, struct pt_regs *regs, void *ign)
+static void timer_handler(evtchn_port_t ev, struct pt_regs *regs, void *ign)
 {
     static int i;
 
diff -r 03c8002068d9 -r 1fb835267a50 extras/mini-os/xenbus/xenbus.c
--- a/extras/mini-os/xenbus/xenbus.c    Fri Jul 28 16:53:58 2006 +0100
+++ b/extras/mini-os/xenbus/xenbus.c    Fri Jul 28 16:54:17 2006 +0100
@@ -112,7 +112,8 @@ static void xenbus_thread_func(void *ign
     }
 }
 
-static void xenbus_evtchn_handler(int port, struct pt_regs *regs, void *ign)
+static void xenbus_evtchn_handler(evtchn_port_t port, struct pt_regs *regs,
+                                 void *ign)
 {
     wake_up(&xb_waitq);
 }

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.