Skip to content

Commit

Permalink
powerpc/kexec: Fix build failure on 32-bit SMP
Browse files Browse the repository at this point in the history
Commit b987812 left
crash_kexec_wait_realmode() undefined for UP.

Commit 7c7a81b defined it for UP but
left it undefined for 32-bit SMP.

Seems like people are getting confused by nested #ifdef's, so move the
definitions of crash_kexec_wait_realmode() after the #ifdef CONFIG_SMP
section.

Compile-tested with 32-bit UP, 32-bit SMP and 64-bit SMP configurations.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Tested-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Ben Hutchings authored and Benjamin Herrenschmidt committed May 19, 2011
1 parent 69e3cea commit 35d215f
Showing 1 changed file with 30 additions and 29 deletions.
59 changes: 30 additions & 29 deletions arch/powerpc/kernel/crash.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,34 +162,6 @@ static void crash_kexec_prepare_cpus(int cpu)
/* Leave the IPI callback set */
}

/* wait for all the CPUs to hit real mode but timeout if they don't come in */
#ifdef CONFIG_PPC_STD_MMU_64
static void crash_kexec_wait_realmode(int cpu)
{
unsigned int msecs;
int i;

msecs = 10000;
for (i=0; i < NR_CPUS && msecs > 0; i++) {
if (i == cpu)
continue;

while (paca[i].kexec_state < KEXEC_STATE_REAL_MODE) {
barrier();
if (!cpu_possible(i)) {
break;
}
if (!cpu_online(i)) {
break;
}
msecs--;
mdelay(1);
}
}
mb();
}
#endif /* CONFIG_PPC_STD_MMU_64 */

/*
* This function will be called by secondary cpus or by kexec cpu
* if soft-reset is activated to stop some CPUs.
Expand Down Expand Up @@ -234,7 +206,6 @@ void crash_kexec_secondary(struct pt_regs *regs)
}

#else /* ! CONFIG_SMP */
static inline void crash_kexec_wait_realmode(int cpu) {}

static void crash_kexec_prepare_cpus(int cpu)
{
Expand All @@ -257,6 +228,36 @@ void crash_kexec_secondary(struct pt_regs *regs)
}
#endif /* CONFIG_SMP */

/* wait for all the CPUs to hit real mode but timeout if they don't come in */
#if defined(CONFIG_SMP) && defined(CONFIG_PPC_STD_MMU_64)
static void crash_kexec_wait_realmode(int cpu)
{
unsigned int msecs;
int i;

msecs = 10000;
for (i=0; i < NR_CPUS && msecs > 0; i++) {
if (i == cpu)
continue;

while (paca[i].kexec_state < KEXEC_STATE_REAL_MODE) {
barrier();
if (!cpu_possible(i)) {
break;
}
if (!cpu_online(i)) {
break;
}
msecs--;
mdelay(1);
}
}
mb();
}
#else
static inline void crash_kexec_wait_realmode(int cpu) {}
#endif /* CONFIG_SMP && CONFIG_PPC_STD_MMU_64 */

/*
* Register a function to be called on shutdown. Only use this if you
* can't reset your device in the second kernel.
Expand Down

0 comments on commit 35d215f

Please sign in to comment.