Patch 2.6.32.33 to 2.6.32.35
/arch/powerpc/kernel/machine_kexec_64.c
blob:2e4c61c933cc8c0d32ff7213fb1d61f5dfdcfbe9 -> blob:1a8de63489add3d6cf1b1b130d29be59d5d2b6bd
--- arch/powerpc/kernel/machine_kexec_64.c
+++ arch/powerpc/kernel/machine_kexec_64.c
@@ -156,23 +156,16 @@ void kexec_copy_flush(struct kimage *ima
#ifdef CONFIG_SMP
-static int kexec_all_irq_disabled;
-
+/* FIXME: we should schedule this function to be called on all cpus based
+ * on calling the interrupts, but we would like to call it off irq level
+ * so that the interrupt controller is clean.
+ */
static void kexec_smp_down(void *arg)
{
- local_irq_disable();
- mb(); /* make sure our irqs are disabled before we say they are */
- get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF;
- while (kexec_all_irq_disabled == 0)
- cpu_relax();
- mb(); /* make sure all irqs are disabled before this */
- /*
- * Now every CPU has IRQs off, we can clear out any pending
- * IPIs and be sure that no more will come in after this.
- */
if (ppc_md.kexec_cpu_down)
ppc_md.kexec_cpu_down(0, 1);
+ local_irq_disable();
kexec_smp_wait();
/* NOTREACHED */
}
@@ -200,18 +193,20 @@ static void wake_offline_cpus(void)
}
}
-static void kexec_prepare_cpus_wait(int wait_state)
+static void kexec_prepare_cpus(void)
{
int my_cpu, i, notified=-1;
wake_offline_cpus();
+ smp_call_function(kexec_smp_down, NULL, /* wait */0);
my_cpu = get_cpu();
- /* Make sure each CPU has atleast made it to the state we need */
+
+ /* check the others cpus are now down (via paca hw cpu id == -1) */
for (i=0; i < NR_CPUS; i++) {
if (i == my_cpu)
continue;
- while (paca[i].kexec_state < wait_state) {
+ while (paca[i].hw_cpu_id != -1) {
barrier();
if (!cpu_possible(i)) {
printk("kexec: cpu %d hw_cpu_id %d is not"
@@ -231,35 +226,20 @@ static void kexec_prepare_cpus_wait(int
}
if (i != notified) {
printk( "kexec: waiting for cpu %d (physical"
- " %d) to enter %i state\n",
- i, paca[i].hw_cpu_id, wait_state);
+ " %d) to go down\n",
+ i, paca[i].hw_cpu_id);
notified = i;
}
}
}
- mb();
-}
-
-static void kexec_prepare_cpus(void)
-{
-
- smp_call_function(kexec_smp_down, NULL, /* wait */0);
- local_irq_disable();
- mb(); /* make sure IRQs are disabled before we say they are */
- get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF;
-
- kexec_prepare_cpus_wait(KEXEC_STATE_IRQS_OFF);
- /* we are sure every CPU has IRQs off at this point */
- kexec_all_irq_disabled = 1;
/* after we tell the others to go down */
if (ppc_md.kexec_cpu_down)
ppc_md.kexec_cpu_down(0, 0);
-/* Before removing MMU mapings make sure all CPUs have entered real mode */
- kexec_prepare_cpus_wait(KEXEC_STATE_REAL_MODE);
-
put_cpu();
+
+ local_irq_disable();
}
#else /* ! SMP */