On octeon, the single-processor kernel does not work quite right when
booted with multiple cores. Each core begins to boot the system
independently, as if there were no other CPUs, leading to a totally
mixed-up state. The following patch alters the MP init core selection
logic a little and enables it for the SP kernel.

With the patch, there is no need to touch bootloader settings when
switching from a multi-processor kernel to a single-processor one.
A side benefit is that the init core can be any of the CPUs, at least
in terms of the early-stage boot code.


Index: arch/octeon/octeon/locore.S
===================================================================
RCS file: src/sys/arch/octeon/octeon/locore.S,v
retrieving revision 1.6
diff -u -p -r1.6 locore.S
--- arch/octeon/octeon/locore.S 13 Mar 2014 02:17:13 -0000      1.6
+++ arch/octeon/octeon/locore.S 10 Jul 2015 15:55:37 -0000
@@ -73,10 +73,11 @@ start:
 
        LA      gp, _gp
 
-#if defined(MULTIPROCESSOR)
-       rdhwr   t2, $0
-       beqz    t2, 2f
+       /* Let the init core continue. The others have to wait. */
+       bne     a2, zero, 2f
        nop
+#if defined(MULTIPROCESSOR)
+       rdhwr   t2, $0
 1:     ll      t0, cpu_spinup_mask
        bne     t2, t0, 1b
        nop
@@ -86,8 +87,13 @@ start:
        nop
        j       hw_cpu_spinup_trampoline
        nop
-2:
+#else
+       /* Halt extra cores on single-processor kernel. */
+1:     wait
+       j       1b
+       nop
 #endif
+2:
        /*
         * Initialize stack and call machine startup.
         */

Reply via email to