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

[Xen-devel] [PATCH 6/7] xen/arm: introduce gic callbacks



Introduce callbacks to receive notifications from the GIC when a
specific IRQ has been EOI'd by the guest.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 xen/arch/arm/gic.c        |   12 ++++++++++++
 xen/arch/arm/setup.c      |    1 +
 xen/include/asm-arm/gic.h |    5 +++++
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 1c8219d..0ecc0f1 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -52,6 +52,7 @@ static struct {
 static irq_desc_t irq_desc[NR_IRQS];
 static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc);
 static DEFINE_PER_CPU(uint64_t, lr_mask);
+static gic_callback_fn_t gic_callbacks[NR_IRQS];
 
 unsigned nr_lrs;
 
@@ -619,6 +620,12 @@ int gicv_setup(struct domain *d)
                         gic.vbase);
 }
 
+void register_gic_callback(int irq, gic_callback_fn_t fn)
+{
+    ASSERT(irq < NR_IRQS);
+    gic_callbacks[irq] = fn;
+}
+
 static void maintenance_interrupt(int irq, void *dev_id, struct cpu_user_regs 
*regs)
 {
     int i = 0, virq;
@@ -655,6 +662,11 @@ static void maintenance_interrupt(int irq, void *dev_id, 
struct cpu_user_regs *r
         list_del_init(&p->inflight);
         spin_unlock_irq(&v->arch.vgic.lock);
 
+        if ( gic_callbacks[virq] != NULL )
+        {
+            gic_callbacks[virq](v, virq);
+        }
+
         i++;
     }
 }
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index e1ab7f6..5680c73 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -40,6 +40,7 @@
 #include <asm/vfp.h>
 #include <asm/early_printk.h>
 #include <asm/gic.h>
+#include "vtimer.h"
 
 static __used void init_done(void)
 {
diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
index bf30fbd..f4b0324 100644
--- a/xen/include/asm-arm/gic.h
+++ b/xen/include/asm-arm/gic.h
@@ -153,6 +153,11 @@ extern void gic_disable_cpu(void);
 /* setup the gic virtual interface for a guest */
 extern int gicv_setup(struct domain *d);
 
+typedef void (*gic_callback_fn_t)(struct vcpu *v, int irq);
+/* register a per-irq callback: the gic driver is going to call the
+ * callback when the guest EOIs that particular irq. */
+void register_gic_callback(int irq, gic_callback_fn_t fn);
+
 /* Context switch */
 extern void gic_save_state(struct vcpu *v);
 extern void gic_restore_state(struct vcpu *v);
-- 
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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