powerpc/book3e-64/kexec: Enable SMP release
authorScott Wood <scottwood@freescale.com>
Wed, 7 Oct 2015 03:48:19 +0000 (22:48 -0500)
committerScott Wood <scottwood@freescale.com>
Tue, 27 Oct 2015 23:13:29 +0000 (18:13 -0500)
The SMP release mechanism for FSL book3e is different from when booting
with normal hardware.  In theory we could simulate the normal spin
table mechanism, but not at the addresses U-Boot put in the device tree
-- so there'd need to be even more communication between the kernel and
kexec to set that up.  Instead, kexec-tools will set a boolean property
linux,booted-from-kexec in the /chosen node.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: devicetree@vger.kernel.org
Documentation/devicetree/bindings/chosen.txt
arch/powerpc/kernel/setup_64.c

index ed838f453f7aef58446be0e5ae93f1b2d9d534e7..6ae9d82d4c378844505c4b8184b60d429ba95a9e 100644 (file)
@@ -44,3 +44,11 @@ Implementation note: Linux will look for the property "linux,stdout-path" or
 on PowerPC "stdout" if "stdout-path" is not found.  However, the
 "linux,stdout-path" and "stdout" properties are deprecated. New platforms
 should only use the "stdout-path" property.
+
+linux,booted-from-kexec
+-----------------------
+
+This property is set (currently only on PowerPC, and only needed on
+book3e) by some versions of kexec-tools to tell the new kernel that it
+is being booted by kexec, as the booting environment may differ (e.g.
+a different secondary CPU release mechanism)
index 505ec2c698e06a24ee34237d76f4fa14c1cad1b5..5c03a6a9b0542fac3d042f2481f367aae9178d38 100644 (file)
@@ -340,11 +340,26 @@ void early_setup_secondary(void)
 #endif /* CONFIG_SMP */
 
 #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC)
+static bool use_spinloop(void)
+{
+       if (!IS_ENABLED(CONFIG_PPC_BOOK3E))
+               return true;
+
+       /*
+        * When book3e boots from kexec, the ePAPR spin table does
+        * not get used.
+        */
+       return of_property_read_bool(of_chosen, "linux,booted-from-kexec");
+}
+
 void smp_release_cpus(void)
 {
        unsigned long *ptr;
        int i;
 
+       if (!use_spinloop())
+               return;
+
        DBG(" -> smp_release_cpus()\n");
 
        /* All secondary cpus are spinning on a common spinloop, release them
@@ -524,7 +539,7 @@ void __init setup_system(void)
         * Freescale Book3e parts spin in a loop provided by firmware,
         * so smp_release_cpus() does nothing for them
         */
-#if defined(CONFIG_SMP) && !defined(CONFIG_PPC_FSL_BOOK3E)
+#if defined(CONFIG_SMP)
        /* Release secondary cpus out of their spinloops at 0x60 now that
         * we can map physical -> logical CPU ids
         */