Good, lets take it a little further.
I know you are are building on my original "good enuff loop" but lets
go all the way here.
On Aug 9, 2006, at 11:12 PM, Amos Waterland wrote:
diff -r 058f2e27476d xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.cMon Aug 07 17:49:16 2006 -0500
+++ b/xen/arch/powerpc/boot_of.cWed Aug 09 23:08:03 2006 -0400
@@ -42,6 +42,7 @@ static char builtin_cmdline[COMMAND_LINE
__attribute__((section("__builtin_cmdline"))) = CMDLINE;
extern struct ns16550_defaults ns16550;
+extern unsigned long __spin_ack;
There really is no need for this to be a long, the ID is an int so we
could make it an int.
This would also make your assembler 32/64 neutral, tho I'm not too
worried about that, and the barrier (too come) may not be neutral-able.
#undef OF_DEBUG
@@ -956,7 +957,37 @@ static int __init boot_of_cpus(void)
/* FIXME: should not depend on the boot CPU bring the first
child */
That is correct.
so you need something like the following (psuedo code, bad style):
of_getprop(bof_chosen, "cpu", &boot_cpu, sizeof (boot_cpu));
cpu = of_getpeer(cpu);
while (cpu > 0) {
if (cpu == boot_cpu)
continue;
-of_start_cpu(cpu, (ulong)spin_start, 0);
+unsigned int cpuid;
+unsigned long ping, pong, now, then, timeout;
+unsigned long *ack = (unsigned long *)&__spin_ack;
+
+result = of_getprop(cpu, "reg", &cpuid, sizeof(cpuid));
+if (result == OF_FAILURE) of_panic("cpuid lookup failed\n");
+
+of_printf("spinning up secondary processor #%d: ", cpuid);
+
+*ack = 0x0;
Set this to ~0, cpuid 0 will cause you problems later.
+ping = *ack;
+of_printf("ping = %lx: ", ping);
+
+mb();
+of_start_cpu(cpu, (ulong)spin_start, cpuid);
+
+then = mftb();
+timeout = then + 1024;
+do {
+now = mftb();
+if (now >= timeout) {
+of_printf("SKIPPING: ");
+pong = ~0x0;
+break;
+}
+
+mb();
+pong = *ack;
+} while (pong == ping);
+of_printf("pong = %lx\n", pong);
+
cpu = of_getpeer(cpu);
}
return 1;
diff -r 058f2e27476d xen/arch/powerpc/powerpc64/exceptions.S
--- a/xen/arch/powerpc/powerpc64/exceptions.S Mon Aug 07 17:49:16
2006 -0500
+++ b/xen/arch/powerpc/powerpc64/exceptions.S Wed Aug 09 21:41:16
2006 -0400
@@ -178,6 +178,25 @@ zero:
li r0, 0x0 /* exception vector for GDB stub */
bctr
The space at the beginning of text is precious, please but this back
to the end of this file.
Extra credit: As you add more code here for the barrier I would not
discourage a unique file here that is not 64bit specific and may end
up in the __init section so it can be released.
+/* Begin secondary processor spin and ack logic. */
+.globl __spin_ack
+__spin_ack:
+.llong 0x0
'.long' here is plenty.
BTW: I can think of no reason this cannot be allocated in "C" rather
than assembler, it would be easier to find with cscope. :)
+
+.globl spin_start
+spin_start:
I almost tricked myself here, so a comment about how we do _not_ use
_GLOBAL() because we desire a function entry point rather than a
"function descriptor", would be nice.
+/* Our physical cpu number is passed in r3. */
+mr r24, r3
+lis r25, [EMAIL PROTECTED]
+ori r25, r25, [EMAIL PROTECTED]
+rldicr r25, r25, 32, 31
+oris r25, r25, [EMAIL PROTECTED]
+ori r25, r25, [EMAIL PROTECTED]
+stdu r24, 0(r25)
The above assembler can be replaced by:
LOADADDR(r4, __spin_ack)
stw r3, 0(r4)
I use r4 because it really doesn't matter what register you use, so
you have 31 to chose from :)
+sync
+b .
+
+/* Begin exception handlers. */
. = 0x100 # System Reset
ex_reset:
/* XXX thread initialization */
@@ -513,7 +532,3 @@ _GLOBAL(sleep)
isync
mtmsrd r3
blr
-
-.globl spin_start
-spin_start:
-b .
___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel
___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel