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

[Xen-changelog] Add new interface for allocating reserved event-channel



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID e1152d55ea314944a4256354e163058d81bfbeba
# Parent  68ef2efa929b26f9e5ab71a5590c899d044c48ce
Add new interface for allocating reserved event-channel
ports to arbitrary Xen subsystems.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 68ef2efa929b -r e1152d55ea31 xen/common/event_channel.c
--- a/xen/common/event_channel.c        Wed Apr  5 16:15:34 2006
+++ b/xen/common/event_channel.c        Wed Apr  5 16:41:51 2006
@@ -45,6 +45,7 @@
         rc = (_errno);                                              \
         goto out;                                                   \
     } while ( 0 )
+
 
 static int get_free_port(struct domain *d)
 {
@@ -360,7 +361,7 @@
             rc = -EINVAL;
             goto out;
         }
-    
+
         port2 = chn1->u.interdomain.remote_port;
         BUG_ON(!port_is_valid(d2, port2));
 
@@ -437,6 +438,7 @@
 
     return ret;
 }
+
 
 void evtchn_set_pending(struct vcpu *v, int port)
 {
@@ -471,6 +473,7 @@
     }
 }
 
+
 void send_guest_virq(struct vcpu *v, int virq)
 {
     int port = v->virq_to_evtchn[virq];
@@ -478,6 +481,7 @@
     if ( likely(port != 0) )
         evtchn_set_pending(v, port);
 }
+
 
 void send_guest_pirq(struct domain *d, int pirq)
 {
@@ -485,6 +489,7 @@
     struct evtchn *chn = evtchn_from_port(d, port);
     evtchn_set_pending(d->vcpu[chn->notify_vcpu_id], port);
 }
+
 
 static long evtchn_status(evtchn_status_t *status)
 {
@@ -550,6 +555,7 @@
     return rc;
 }
 
+
 long evtchn_bind_vcpu(unsigned int port, unsigned int vcpu_id)
 {
     struct domain *d = current->domain;
@@ -584,6 +590,7 @@
     spin_unlock(&d->evtchn_lock);
     return rc;
 }
+
 
 static long evtchn_unmask(evtchn_unmask_t *unmask)
 {
@@ -620,6 +627,7 @@
     return 0;
 }
 
+
 long do_event_channel_op(GUEST_HANDLE(evtchn_op_t) uop)
 {
     long rc;
@@ -691,6 +699,48 @@
     }
 
     return rc;
+}
+
+
+int evtchn_open_reserved_port(struct domain *d)
+{
+    struct evtchn *chn;
+    int            port;
+
+    spin_lock(&d->evtchn_lock);
+
+    if ( (port = get_free_port(d)) >= 0 )
+    {
+        chn = evtchn_from_port(d, port);
+        chn->state = ECS_RESERVED;
+    }
+
+    spin_unlock(&d->evtchn_lock);
+
+    return port;
+}
+
+
+void evtchn_close_reserved_port(struct domain *d, int port)
+{
+    struct evtchn *chn;
+
+    spin_lock(&d->evtchn_lock);
+
+    BUG_ON(!port_is_valid(d, port));
+
+    chn = evtchn_from_port(d, port);
+    chn->state          = ECS_FREE;
+    chn->notify_vcpu_id = 0;
+
+    spin_unlock(&d->evtchn_lock);
+}
+
+
+void evtchn_notify_reserved_port(struct domain *d, int port)
+{
+    struct evtchn *chn = evtchn_from_port(d, port);
+    evtchn_set_pending(d->vcpu[chn->notify_vcpu_id], port);
 }
 
 
diff -r 68ef2efa929b -r e1152d55ea31 xen/include/xen/event.h
--- a/xen/include/xen/event.h   Wed Apr  5 16:15:34 2006
+++ b/xen/include/xen/event.h   Wed Apr  5 16:41:51 2006
@@ -45,4 +45,9 @@
 /* Bind a local event-channel port to the specified VCPU. */
 extern long evtchn_bind_vcpu(unsigned int port, unsigned int vcpu_id);
 
+/* Reserved event-channel ports for other Xen subsystems. */
+int evtchn_open_reserved_port(struct domain *d);
+void evtchn_close_reserved_port(struct domain *d, int port);
+void evtchn_notify_reserved_port(struct domain *d, int port);
+
 #endif /* __XEN_EVENT_H__ */

_______________________________________________
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®.