[patch 04/34] idle: Provide a generic entry point for the idle code
From: Thomas Gleixner
Date: Thu Mar 21 2013 - 18:03:01 EST
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@xxxxxxxxxxxxx>
---
include/linux/cpu.h | 8 ++++++++
init/main.c | 2 +-
kernel/Makefile | 1 +
kernel/cpu/Makefile | 1 +
kernel/cpu/idle.c | 10 ++++++++++
5 files changed, 21 insertions(+), 1 deletion(-)
Index: linux-2.6/include/linux/cpu.h
===================================================================
--- linux-2.6.orig/include/linux/cpu.h
+++ linux-2.6/include/linux/cpu.h
@@ -212,4 +212,12 @@ static inline int disable_nonboot_cpus(v
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: linux-2.6/init/main.c
===================================================================
--- linux-2.6.orig/init/main.c
+++ linux-2.6/init/main.c
@@ -384,7 +384,7 @@ static noinline void __init_refok rest_i
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: linux-2.6/kernel/Makefile
===================================================================
--- linux-2.6.orig/kernel/Makefile
+++ linux-2.6/kernel/Makefile
@@ -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
Index: linux-2.6/kernel/cpu/Makefile
===================================================================
--- /dev/null
+++ linux-2.6/kernel/cpu/Makefile
@@ -0,0 +1 @@
+obj-y = idle.o
Index: linux-2.6/kernel/cpu/idle.c
===================================================================
--- /dev/null
+++ linux-2.6/kernel/cpu/idle.c
@@ -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();
+}
--
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/