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

[Xen-devel] [PATCH 01/25] xen/evtchn: expose evtchn_bind_ipi_vcpu0_domain for use within Xen



Allocates an IPI-bound event channel on vcpu0 for specified domain.

Is able to bypass the existence check on vcpu number since vcpu 0
should always exist. Bypass is required at the point of use by Argo.

Signed-off-by: Christopher Clark <christopher.clark6@xxxxxxxxxxxxxx>
---
 xen/common/event_channel.c | 35 +++++++++++++++++++++++++++++------
 xen/include/xen/event.h    |  3 +++
 2 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index f34d4f0..3dfde83 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -411,17 +411,12 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, 
evtchn_port_t port)
 }
 
 
-static long evtchn_bind_ipi(evtchn_bind_ipi_t *bind)
+static long evtchn_bind_ipi_domain(struct domain *d, evtchn_bind_ipi_t *bind)
 {
     struct evtchn *chn;
-    struct domain *d = current->domain;
     int            port, vcpu = bind->vcpu;
     long           rc = 0;
 
-    if ( (vcpu < 0) || (vcpu >= d->max_vcpus) ||
-         (d->vcpu[vcpu] == NULL) )
-        return -ENOENT;
-
     spin_lock(&d->event_lock);
 
     if ( (port = get_free_port(d)) < 0 )
@@ -446,6 +441,34 @@ static long evtchn_bind_ipi(evtchn_bind_ipi_t *bind)
 }
 
 
+static long evtchn_bind_ipi(evtchn_bind_ipi_t *bind)
+{
+    struct domain *d = current->domain;
+    int         vcpu = bind->vcpu;
+
+    if ( (vcpu < 0) || (vcpu >= d->max_vcpus) ||
+         (d->vcpu[vcpu] == NULL) )
+        return -ENOENT;
+
+    return evtchn_bind_ipi_domain(d, bind);
+}
+
+long evtchn_bind_ipi_vcpu0_domain(struct domain *d, evtchn_port_t *out_port)
+{
+    evtchn_bind_ipi_t bind_ipi;
+    long              rc;
+
+    bind_ipi.vcpu = 0;
+
+    rc = evtchn_bind_ipi_domain(d, &bind_ipi);
+
+    if ( !rc )
+        *out_port = bind_ipi.port;
+
+    return rc;
+}
+
+
 static void link_pirq_port(int port, struct evtchn *chn, struct vcpu *v)
 {
     chn->u.pirq.prev_port = 0;
diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h
index ebb879e..18c3738 100644
--- a/xen/include/xen/event.h
+++ b/xen/include/xen/event.h
@@ -86,6 +86,9 @@ void notify_via_xen_event_channel(struct domain *ld, int 
lport);
 /* Inject an event channel notification into the guest */
 void arch_evtchn_inject(struct vcpu *v);
 
+/* Allocate an IPI event channel on vcpu0 for the specified domain */
+long evtchn_bind_ipi_vcpu0_domain(struct domain *d, evtchn_port_t *out_port);
+
 /*
  * Internal event channel object storage.
  *
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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