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

[Xen-changelog] Allow EVTCHNOP_bind_{ipi, virq} to specify the vcpu to



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID ec84b119e4ed1f69bd91ec9233c2c3feab464b2e
# Parent  f13b4b7306050106951f248adfb1a856437571e7
Allow EVTCHNOP_bind_{ipi,virq} to specify the vcpu to
bind to. Previously the alloacted port was implicitly
bound to the calling vcpu.

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

diff -r f13b4b730605 -r ec84b119e4ed 
linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c     Tue Oct  4 14:02:35 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c     Tue Oct  4 14:02:51 2005
@@ -189,6 +189,7 @@
        if ((irq = per_cpu(virq_to_irq, cpu)[virq]) == -1) {
                op.cmd              = EVTCHNOP_bind_virq;
                op.u.bind_virq.virq = virq;
+               op.u.bind_virq.vcpu = cpu;
                BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
                evtchn = op.u.bind_virq.port;
 
@@ -252,6 +253,7 @@
 
        if ((evtchn = per_cpu(ipi_to_evtchn, cpu)[ipi]) == -1) {
                op.cmd = EVTCHNOP_bind_ipi;
+               op.u.bind_ipi.vcpu = cpu;
                BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
                evtchn = op.u.bind_ipi.port;
 
@@ -666,6 +668,7 @@
                /* Get a new binding from Xen. */
                op.cmd              = EVTCHNOP_bind_virq;
                op.u.bind_virq.virq = virq;
+               op.u.bind_virq.vcpu = 0;
                BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
                evtchn = op.u.bind_virq.port;
         
@@ -687,6 +690,7 @@
 
                /* Get a new binding from Xen. */
                op.cmd = EVTCHNOP_bind_ipi;
+               op.u.bind_ipi.vcpu = 0;
                BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
                evtchn = op.u.bind_ipi.port;
         
diff -r f13b4b730605 -r ec84b119e4ed tools/libxc/xc_evtchn.c
--- a/tools/libxc/xc_evtchn.c   Tue Oct  4 14:02:35 2005
+++ b/tools/libxc/xc_evtchn.c   Tue Oct  4 14:02:51 2005
@@ -90,7 +90,8 @@
 
     op.cmd = EVTCHNOP_bind_virq;
     op.u.bind_virq.virq = (u32)virq;
-   
+    op.u.bind_virq.vcpu = 0;
+
     if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 )
     {
         if ( port != NULL )
diff -r f13b4b730605 -r ec84b119e4ed xen/common/event_channel.c
--- a/xen/common/event_channel.c        Tue Oct  4 14:02:35 2005
+++ b/xen/common/event_channel.c        Tue Oct  4 14:02:51 2005
@@ -244,15 +244,15 @@
 static long evtchn_bind_virq(evtchn_bind_virq_t *bind)
 {
     struct evtchn *chn;
-    struct vcpu   *v = current;
-    struct domain *d = v->domain;
+    struct vcpu   *v;
+    struct domain *d = current->domain;
     int            port, virq = bind->virq;
 
     if ( virq >= ARRAY_SIZE(v->virq_to_evtchn) )
         return -EINVAL;
 
-    if ( d->domain_id == 0 && virq >= VIRQ_CONSOLE )
-        v = d->vcpu[0];
+    if ( (v = d->vcpu[bind->vcpu]) == NULL )
+        return -ENOENT;
 
     spin_lock(&d->evtchn_lock);
 
@@ -288,13 +288,16 @@
     struct domain *d = current->domain;
     int            port;
 
+    if ( d->vcpu[bind->vcpu] == NULL )
+        return -ENOENT;
+
     spin_lock(&d->evtchn_lock);
 
     if ( (port = get_free_port(d)) >= 0 )
     {
         chn = evtchn_from_port(d, port);
         chn->state          = ECS_IPI;
-        chn->notify_vcpu_id = current->vcpu_id;
+        chn->notify_vcpu_id = bind->vcpu;
     }
 
     spin_unlock(&d->evtchn_lock);
diff -r f13b4b730605 -r ec84b119e4ed xen/include/public/event_channel.h
--- a/xen/include/public/event_channel.h        Tue Oct  4 14:02:35 2005
+++ b/xen/include/public/event_channel.h        Tue Oct  4 14:02:51 2005
@@ -51,22 +51,24 @@
 } evtchn_bind_interdomain_t;
 
 /*
- * EVTCHNOP_bind_virq: Bind a local event channel to IRQ <irq> on calling vcpu.
+ * EVTCHNOP_bind_virq: Bind a local event channel to VIRQ <irq> on specified
+ * vcpu.
  * NOTES:
  *  1. A virtual IRQ may be bound to at most one event channel per vcpu.
- *  2. The allocated event channel is bound to the calling vcpu. The binding
+ *  2. The allocated event channel is bound to the specified vcpu. The binding
  *     may not be changed.
  */
 #define EVTCHNOP_bind_virq        1
 typedef struct evtchn_bind_virq {
     /* IN parameters. */
     u32 virq;
+    u32 vcpu;
     /* OUT parameters. */
     u32 port;
 } evtchn_bind_virq_t;
 
 /*
- * EVTCHNOP_bind_pirq: Bind a local event channel to IRQ <irq>.
+ * EVTCHNOP_bind_pirq: Bind a local event channel to PIRQ <irq>.
  * NOTES:
  *  1. A physical IRQ may be bound to at most one event channel per domain.
  *  2. Only a sufficiently-privileged domain may bind to a physical IRQ.
@@ -84,11 +86,12 @@
 /*
  * EVTCHNOP_bind_ipi: Bind a local event channel to receive events.
  * NOTES:
- *  1. The allocated event channel is bound to the calling vcpu. The binding
+ *  1. The allocated event channel is bound to the specified vcpu. The binding
  *     may not be changed.
  */
 #define EVTCHNOP_bind_ipi         7
 typedef struct evtchn_bind_ipi {
+    u32 vcpu;
     /* OUT parameters. */
     u32 port;
 } evtchn_bind_ipi_t;

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