浏览代码

[POWERPC] Fix secondary CPU startup on old "powersurge" SMP powermacs

On the old "powersurge" SMP powermacs, the second CPU is started up
by sending it an IPI, which has the side effect of stopping the
timebase clock (so the secondary CPU's timebase can be synchronized
with the primary's).  The routine that did this used udelay, which
will hang forever when the timebase is stopped, since udelay now spins
until the timebase reaches a certain value.

The end result is that the kernel would hang when bringing up the
second CPU.  This fixes it by using a simple loop which just does a
fixed number of iterations to generate the delay.  These old systems
were all clocked at around 200 MHz or so, so a fixed number of
iterations is acceptable.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Paul Mackerras 18 年之前
父节点
当前提交
d6a29252ad
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      arch/powerpc/platforms/powermac/smp.c

+ 6 - 1
arch/powerpc/platforms/powermac/smp.c

@@ -328,6 +328,7 @@ static void __init smp_psurge_kick_cpu(int nr)
 {
 {
 	unsigned long start = __pa(__secondary_start_pmac_0) + nr * 8;
 	unsigned long start = __pa(__secondary_start_pmac_0) + nr * 8;
 	unsigned long a;
 	unsigned long a;
+	int i;
 
 
 	/* may need to flush here if secondary bats aren't setup */
 	/* may need to flush here if secondary bats aren't setup */
 	for (a = KERNELBASE; a < KERNELBASE + 0x800000; a += 32)
 	for (a = KERNELBASE; a < KERNELBASE + 0x800000; a += 32)
@@ -340,7 +341,11 @@ static void __init smp_psurge_kick_cpu(int nr)
 	mb();
 	mb();
 
 
 	psurge_set_ipi(nr);
 	psurge_set_ipi(nr);
-	udelay(10);
+	/*
+	 * We can't use udelay here because the timebase is now frozen.
+	 */
+	for (i = 0; i < 2000; ++i)
+		barrier();
 	psurge_clr_ipi(nr);
 	psurge_clr_ipi(nr);
 
 
 	if (ppc_md.progress) ppc_md.progress("smp_psurge_kick_cpu - done", 0x354);
 	if (ppc_md.progress) ppc_md.progress("smp_psurge_kick_cpu - done", 0x354);