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

[Xen-devel] [PATCH v6a 03/17] xen/arm: make sgi handling generic



From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>

move all the hw specific sgi handling functionality
to one function and use it.

changes in v6a: change send_SGI() parameter order

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
Acked-by: Julien Grall <julien.grall@xxxxxxxxxx>
Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 xen/arch/arm/gic.c        |   37 ++++++++++++++++++++++++++++---------
 xen/include/asm-arm/gic.h |    8 ++++++++
 2 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 4d2a92d..df7462d 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -483,21 +483,40 @@ void __init gic_init(void)
     spin_unlock(&gic.lock);
 }
 
-void send_SGI_mask(const cpumask_t *cpumask, enum gic_sgi sgi)
+static void send_SGI(enum gic_sgi sgi, enum gic_sgi_mode irqmode,
+                     const cpumask_t *cpu_mask)
 {
     unsigned int mask = 0;
+
+    switch ( irqmode )
+    {
+    case SGI_TARGET_OTHERS:
+        GICD[GICD_SGIR] = GICD_SGI_TARGET_OTHERS | sgi;
+        break;
+    case SGI_TARGET_SELF:
+        GICD[GICD_SGIR] = GICD_SGI_TARGET_SELF | sgi;
+        break;
+    case SGI_TARGET_LIST:
+        mask = gic_cpu_mask(cpu_mask);
+        GICD[GICD_SGIR] = GICD_SGI_TARGET_LIST |
+                          (mask << GICD_SGI_TARGET_SHIFT) | sgi;
+        break;
+    default:
+        BUG();
+    }
+}
+
+void send_SGI_mask(const cpumask_t *cpumask, enum gic_sgi sgi)
+{
     cpumask_t online_mask;
 
     ASSERT(sgi < 16); /* There are only 16 SGIs */
 
     cpumask_and(&online_mask, cpumask, &cpu_online_map);
-    mask = gic_cpu_mask(&online_mask);
 
     dsb(sy);
 
-    GICD[GICD_SGIR] = GICD_SGI_TARGET_LIST
-        | (mask<<GICD_SGI_TARGET_SHIFT)
-        | sgi;
+    send_SGI(sgi, SGI_TARGET_LIST, &online_mask);
 }
 
 void send_SGI_one(unsigned int cpu, enum gic_sgi sgi)
@@ -512,18 +531,18 @@ void send_SGI_self(enum gic_sgi sgi)
 
     dsb(sy);
 
-    GICD[GICD_SGIR] = GICD_SGI_TARGET_SELF
-        | sgi;
+    send_SGI(sgi, SGI_TARGET_SELF, cpumask_of(smp_processor_id()));
 }
 
 void send_SGI_allbutself(enum gic_sgi sgi)
 {
+   cpumask_t all_others_mask;
    ASSERT(sgi < 16); /* There are only 16 SGIs */
 
+   cpumask_andnot(&all_others_mask, &cpu_possible_map, 
cpumask_of(smp_processor_id()));
    dsb(sy);
 
-   GICD[GICD_SGIR] = GICD_SGI_TARGET_OTHERS
-       | sgi;
+   send_SGI(sgi, SGI_TARGET_OTHERS, &all_others_mask);
 }
 
 void smp_send_state_dump(unsigned int cpu)
diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
index 8e37ccf..c7b7368 100644
--- a/xen/include/asm-arm/gic.h
+++ b/xen/include/asm-arm/gic.h
@@ -210,6 +210,14 @@ enum gic_sgi {
     GIC_SGI_DUMP_STATE  = 1,
     GIC_SGI_CALL_FUNCTION = 2,
 };
+
+/* SGI irq mode types */
+enum gic_sgi_mode {
+    SGI_TARGET_LIST,
+    SGI_TARGET_OTHERS,
+    SGI_TARGET_SELF,
+};
+
 extern void send_SGI_mask(const cpumask_t *cpumask, enum gic_sgi sgi);
 extern void send_SGI_one(unsigned int cpu, enum gic_sgi sgi);
 extern void send_SGI_self(enum gic_sgi sgi);
-- 
1.7.9.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®.