Skip to contentSkip to conversation

xen/arm: implement smp_call_function

PATCH In review Julien Grall 2 participants 2 messages May 7, 2013 – May 8, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xen/arm: implement smp_call_function

From: Julien Grall <[email protected]>

Move smp_call_function and on_selected_cpus to common code.

---
Changes in V2:
- Add copyright header in xen/common/smp.c

 xen/arch/arm/gic.c            |    3 ++
 xen/arch/arm/smp.c            |   11 ++--
 xen/arch/x86/smp.c            |   88 ++------------------------------
 xen/common/Makefile           |    1 +
 xen/common/smp.c              |  112 +++++++++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/gic.h     |    1 +
 xen/include/asm-x86/hardirq.h |    1 +
 xen/include/xen/smp.h         |    7 +++
 8 files changed, 134 insertions(+), 90 deletions(-)
 create mode 100644 xen/common/smp.c
xen/arch/arm/gic.c +3 -0
index a8cdd0b..61de230 100644
@@ -672,6 +672,9 @@ static void do_sgi(struct cpu_user_regs *regs, int othercpu, enum gic_sgi sgi)
     case GIC_SGI_DUMP_STATE:
         dump_execstate(regs);
         break;
+    case GIC_SGI_CALL_FUNCTION:
+        smp_call_function_interrupt();
+        break;
     default:
         panic("Unhandled SGI %d on CPU%d\n", sgi, smp_processor_id());
         break;
xen/arch/arm/smp.c +4 -7
index 2a429bd..4042db5 100644
@@ -11,17 +11,14 @@ void flush_tlb_mask(const cpumask_t *mask)
     flush_xen_data_tlb();
 }
 
-void smp_call_function(
-    void (*func) (void *info),
-    void *info,
-    int wait)
+void smp_send_event_check_mask(const cpumask_t *mask)
 {
-    printk("%s not implmented\n", __func__);
+    send_SGI_mask(mask, GIC_SGI_EVENT_CHECK);
 }
 
-void smp_send_event_check_mask(const cpumask_t *mask)
+void smp_send_call_function_mask(const cpumask_t *mask)
 {
-    send_SGI_mask(mask, GIC_SGI_EVENT_CHECK);
+    send_SGI_mask(mask, GIC_SGI_CALL_FUNCTION);
 }
 
 /*
xen/arch/x86/smp.c +5 -83

108 lines not on this page · raw message

xen/common/Makefile +1 -0
index 8a0c506..0dc2050 100644
@@ -26,6 +26,7 @@ obj-y += schedule.o
 obj-y += shutdown.o
 obj-y += softirq.o
 obj-y += sort.o
+obj-y += smp.o
 obj-y += spinlock.o
 obj-y += stop_machine.o
 obj-y += string.o
xen/common/smp.c new file +112 -0

112 lines not on this page · raw message

xen/include/asm-arm/gic.h +1 -0
index 8611885..84ebc83 100644
@@ -175,6 +175,7 @@ extern void gic_restore_state(struct vcpu *v);
 enum gic_sgi {
     GIC_SGI_EVENT_CHECK = 0,
     GIC_SGI_DUMP_STATE  = 1,
+    GIC_SGI_CALL_FUNCTION = 2,
 };
 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);
xen/include/asm-x86/hardirq.h +1 -0
index e573007..01a41b9 100644
@@ -3,6 +3,7 @@
 
 #include <xen/config.h>
 #include <xen/cache.h>
+#include <xen/types.h>
 
 typedef struct {
 	unsigned int __softirq_pending;
xen/include/xen/smp.h +7 -0
index e05f390..6febb56 100644
@@ -58,6 +58,13 @@ static inline void on_each_cpu(
     on_selected_cpus(&cpu_online_map, func, info, wait);
 }
 
+/*
+ * Call a function on the current CPU
+ */
+void smp_call_function_interrupt(void);
+
+void smp_send_call_function_mask(const cpumask_t *mask);
+
 #define smp_processor_id() raw_smp_processor_id()
 
 int alloc_cpu_id(void);
Signature · 1 line
1.7.10.4