[PATCH 04/27] smpboot, x86,xen: Determine smp booting implementations at run-time

From: Srivatsa S. Bhat
Date: Fri Jun 01 2012 - 05:12:07 EST


x86 and xen use the smp_ops structure to determine their respective
implementations of common functions at run-time, by registering appropriate
function pointers at early boot. Hook on to this mechanism for generic smp
booting implementation as well.

Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
Cc: x86@xxxxxxxxxx
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@xxxxxxxxxxxxxxxxxx>
---

arch/x86/include/asm/smp.h | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index f483945..ac1f3eb 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -72,6 +72,10 @@ struct smp_ops {
void (*stop_other_cpus)(int wait);
void (*smp_send_reschedule)(int cpu);

+ void (*cpu_pre_starting)(void *arg);
+ void (*cpu_pre_online)(void *arg);
+ void (*cpu_post_online)(void *arg);
+
int (*cpu_up)(unsigned cpu, struct task_struct *tidle);
int (*cpu_disable)(void);
void (*cpu_die)(unsigned int cpu);
@@ -115,6 +119,24 @@ static inline void smp_cpus_done(unsigned int max_cpus)
smp_ops.smp_cpus_done(max_cpus);
}

+static inline void __cpu_pre_starting(void *arg)
+{
+ smp_ops.cpu_pre_starting(arg);
+}
+#define __cpu_pre_starting __cpu_pre_starting
+
+static inline void __cpu_pre_online(void *arg)
+{
+ smp_ops.cpu_pre_online(arg);
+}
+#define __cpu_pre_online __cpu_pre_online
+
+static inline void __cpu_post_online(void *arg)
+{
+ smp_ops.cpu_post_online(arg);
+}
+#define __cpu_post_online __cpu_post_online
+
static inline int __cpu_up(unsigned int cpu, struct task_struct *tidle)
{
return smp_ops.cpu_up(cpu, tidle);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/