[PATCH 4/5] init: Support negative CPUs boot and halt code

From: Frederic Weisbecker
Date: Tue Mar 31 2015 - 19:21:56 EST


Only x86 is supported for now.

Not-Yet-Signed-off-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>
---
arch/x86/kernel/reboot.c | 8 ++++++++
init/main.c | 7 +++++++
2 files changed, 15 insertions(+)

diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index bae6c60..d3ae1a3 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -582,8 +582,10 @@ static void native_machine_emergency_restart(void)
}
}

+#if CONFIG_NR_CPUS >= 0
void native_machine_shutdown(void)
{
+
/* Stop the cpus and apics */
#ifdef CONFIG_X86_IO_APIC
/*
@@ -620,6 +622,12 @@ void native_machine_shutdown(void)
x86_platform.iommu_shutdown();
#endif
}
+#else /* #if CONFIG_NR_CPUS >= 0 */
+void native_machine_shutdown(void)
+{
+ start_kernel();
+}
+#endif

static void __machine_emergency_restart(int emergency)
{
diff --git a/init/main.c b/init/main.c
index 6f0f1c5f..8933c8f 100644
--- a/init/main.c
+++ b/init/main.c
@@ -486,6 +486,7 @@ static void __init mm_init(void)
vmalloc_init();
}

+#if CONFIG_NR_CPUS >= 0
asmlinkage __visible void __init start_kernel(void)
{
char *command_line;
@@ -673,6 +674,12 @@ asmlinkage __visible void __init start_kernel(void)
/* Do the rest non-__init'ed, we're now alive */
rest_init();
}
+#else /* #if CONFIG_NR_CPUS >= 0 */
+asmlinkage __visible void __init start_kernel(void)
+{
+ native_machine_shutdown();
+}
+#endif

/* Call all constructor functions linked into the kernel. */
static void __init do_ctors(void)
--
2.1.4

--
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/