]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
powerpc/powernv: Avoid waiting for secondary hold spinloop with OPAL
authorNicholas Piggin <npiggin@gmail.com>
Mon, 23 Oct 2017 08:05:07 +0000 (18:05 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 10 Nov 2017 11:00:54 +0000 (22:00 +1100)
OPAL boot does not insert secondaries at 0x60 to wait at the secondary
hold spinloop. Instead they are started later, and inserted at
generic_secondary_smp_init(), which is after the secondary hold
spinloop.

Avoid waiting on this spinloop when booting with OPAL firmware. This
wait always times out that case.

This saves 100ms boot time on powernv, and 10s of seconds of real time
when booting on the simulator in SMP.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/head_64.S
arch/powerpc/kernel/setup_64.c

index ff8511d6d8eadbd03e48ce9c0b639c8d3c80e8aa..aa71a90f5222e6842686d4be40016d3927d737c6 100644 (file)
  *
  *  For pSeries or server processors:
  *   1. The MMU is off & open firmware is running in real mode.
- *   2. The kernel is entered at __start
+ *   2. The primary CPU enters at __start.
+ *   3. If the RTAS supports "query-cpu-stopped-state", then secondary
+ *      CPUs will enter as directed by "start-cpu" RTAS call, which is
+ *      generic_secondary_smp_init, with PIR in r3.
+ *   4. Else the secondary CPUs will enter at secondary_hold (0x60) as
+ *      directed by the "start-cpu" RTS call, with PIR in r3.
  * -or- For OPAL entry:
- *   1. The MMU is off, processor in HV mode, primary CPU enters at 0
- *      with device-tree in gpr3. We also get OPAL base in r8 and
- *     entry in r9 for debugging purposes
- *   2. Secondary processors enter at 0x60 with PIR in gpr3
+ *   1. The MMU is off, processor in HV mode.
+ *   2. The primary CPU enters at 0 with device-tree in r3, OPAL base
+ *      in r8, and entry in r9 for debugging purposes.
+ *   3. Secondary CPUs enter as directed by OPAL_START_CPU call, which
+ *      is at generic_secondary_smp_init, with PIR in r3.
  *
  *  For Book3E processors:
  *   1. The MMU is on running in AS0 in a state defined in ePAPR
index b89c6aac48c9bc2d199b36e759d49c814e34c45c..87b4fe75fd4543a2a795f5f513cfbdfe08e014ca 100644 (file)
@@ -360,8 +360,16 @@ void early_setup_secondary(void)
 #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC_CORE)
 static bool use_spinloop(void)
 {
-       if (!IS_ENABLED(CONFIG_PPC_BOOK3E))
+       if (IS_ENABLED(CONFIG_PPC_BOOK3S)) {
+               /*
+                * See comments in head_64.S -- not all platforms insert
+                * secondaries at __secondary_hold and wait at the spin
+                * loop.
+                */
+               if (firmware_has_feature(FW_FEATURE_OPAL))
+                       return false;
                return true;
+       }
 
        /*
         * When book3e boots from kexec, the ePAPR spin table does