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

- From: Srivatsa S. Bhat \<hidden\>
- Date: 2012-06-01 09:12:10 
- List: linux-arch
- Page: https://ratatoskr.run/linux-arch/2012/06/3873117
- Thread: https://ratatoskr.run/linux-arch/2012/06/3873118/t.md

```text
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 <redacted>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Konrad Rzeszutek Wilk <redacted>
Cc: Jeremy Fitzhardinge <redacted>
Signed-off-by: Srivatsa S. Bhat <redacted>
---

 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);
```
