idle: Provide a generic entry point for the idle code
authorThomas Gleixner <tglx@linutronix.de>
Thu, 21 Mar 2013 21:49:34 +0000 (22:49 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 8 Apr 2013 15:39:23 +0000 (17:39 +0200)
For now this calls cpu_idle(), but in the long run we want to move the
cpu bringup code to the core and therefor we add a state argument.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Reviewed-by: Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Cc: Magnus Damm <magnus.damm@gmail.com>
Link: http://lkml.kernel.org/r/20130321215233.583190032@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/linux/cpu.h
init/main.c
kernel/Makefile
kernel/cpu/Makefile [new file with mode: 0644]
kernel/cpu/idle.c [new file with mode: 0644]

index ce7a074f251991e963722cc90cad771045ddaf01..7419e30c55fb305465c0edd7e68f81068b7c0aa3 100644 (file)
@@ -212,4 +212,12 @@ static inline int disable_nonboot_cpus(void) { return 0; }
 static inline void enable_nonboot_cpus(void) {}
 #endif /* !CONFIG_PM_SLEEP_SMP */
 
+enum cpuhp_state {
+       CPUHP_OFFLINE,
+       CPUHP_ONLINE,
+};
+
+void cpu_startup_entry(enum cpuhp_state state);
+void cpu_idle(void);
+
 #endif /* _LINUX_CPU_H_ */
index 63534a141b4eb6c0f36c5ac0d99d2733028ff96e..adb179d3e0f8f3cf3c73abf27acce4878b53214c 100644 (file)
@@ -384,7 +384,7 @@ static noinline void __init_refok rest_init(void)
        init_idle_bootup_task(current);
        schedule_preempt_disabled();
        /* Call into cpu_idle with preempt disabled */
-       cpu_idle();
+       cpu_startup_entry(CPUHP_ONLINE);
 }
 
 /* Check for early params. */
index bbde5f1a4486ae4a76546cf98d5109b31c5a5200..d1574d47cf27ed38890efbfc6526d81ba923adc2 100644 (file)
@@ -24,6 +24,7 @@ endif
 
 obj-y += sched/
 obj-y += power/
+obj-y += cpu/
 
 obj-$(CONFIG_CHECKPOINT_RESTORE) += kcmp.o
 obj-$(CONFIG_FREEZER) += freezer.o
diff --git a/kernel/cpu/Makefile b/kernel/cpu/Makefile
new file mode 100644 (file)
index 0000000..59ab052
--- /dev/null
@@ -0,0 +1 @@
+obj-y  = idle.o
diff --git a/kernel/cpu/idle.c b/kernel/cpu/idle.c
new file mode 100644 (file)
index 0000000..1908f00
--- /dev/null
@@ -0,0 +1,10 @@
+/*
+ * Generic entry point for the idle threads
+ */
+#include <linux/sched.h>
+#include <linux/cpu.h>
+
+void cpu_startup_entry(enum cpuhp_state state)
+{
+       cpu_idle();
+}