/* This must be done before setting cpu_online_map */
spin_debug_enable();
- set_cpu_sibling_map(smp_processor_id());
+ set_cpu_sibling_map(cpu);
+ notify_cpu_starting(cpu);
wmb();
/*
* this lock ensures we don't half assign or remove an irq from a cpu.
*/
lock_vector_lock();
- __setup_vector_irq(smp_processor_id());
- cpu_set(smp_processor_id(), cpu_online_map);
+ __setup_vector_irq(cpu);
+ cpu_set(cpu, cpu_online_map);
unlock_vector_lock();
init_percpu_time();
return err;
}
+void notify_cpu_starting(unsigned int cpu)
+{
+ void *hcpu = (void *)(long)cpu;
+ int notifier_rc = notifier_call_chain(
+ &cpu_chain, CPU_STARTING, hcpu, NULL);
+ BUG_ON(notifier_rc != NOTIFY_DONE);
+}
+
static cpumask_t frozen_cpus;
int disable_nonboot_cpus(void)
/*
* Possible event sequences for a given CPU:
- * CPU_UP_PREPARE -> CPU_UP_CANCELLED -- failed CPU up
- * CPU_UP_PREPARE -> CPU_ONLINE -- successful CPU up
- * CPU_DOWN_PREPARE -> CPU_DOWN_FAILED -- failed CPU down
- * CPU_DOWN_PREPARE -> CPU_DYING -> CPU_DEAD -- successful CPU down
+ * CPU_UP_PREPARE -> CPU_UP_CANCELLED -- failed CPU up
+ * CPU_UP_PREPARE -> CPU_STARTING -> CPU_ONLINE -- successful CPU up
+ * CPU_DOWN_PREPARE -> CPU_DOWN_FAILED -- failed CPU down
+ * CPU_DOWN_PREPARE -> CPU_DYING -> CPU_DEAD -- successful CPU down
*
* Hence note that only CPU_*_PREPARE handlers are allowed to fail. Also note
* that once CPU_DYING is delivered, an offline action can no longer fail.
* Notifiers are called lowest-priority-first when:
* (a) A CPU is going down; or (b) CPU_UP_CANCELED
*/
-/* CPU_UP_PREPARE: CPU is coming up */
-#define CPU_UP_PREPARE (0x0002 | NOTIFY_FORWARD)
-/* CPU_UP_CANCELED: CPU is no longer coming up. */
-#define CPU_UP_CANCELED (0x0003 | NOTIFY_REVERSE)
+/* CPU_UP_PREPARE: Preparing to bring CPU online. */
+#define CPU_UP_PREPARE (0x0001 | NOTIFY_FORWARD)
+/* CPU_UP_CANCELED: CPU is no longer being brought online. */
+#define CPU_UP_CANCELED (0x0002 | NOTIFY_REVERSE)
+/* CPU_STARTING: CPU nearly online. Runs on new CPU, irqs still disabled. */
+#define CPU_STARTING (0x0003 | NOTIFY_FORWARD)
/* CPU_ONLINE: CPU is up. */
#define CPU_ONLINE (0x0004 | NOTIFY_FORWARD)
/* CPU_DOWN_PREPARE: CPU is going down. */
int cpu_down(unsigned int cpu);
int cpu_up(unsigned int cpu);
+/* From arch code, send CPU_STARTING notification. */
+void notify_cpu_starting(unsigned int cpu);
+
/* Power management. */
int disable_nonboot_cpus(void);
void enable_nonboot_cpus(void);