ARM: 8338/1: kexec: Relax SMP validation to improve DT compatibility
authorGeert Uytterhoeven <geert@linux-m68k.org>
Wed, 1 Apr 2015 12:36:57 +0000 (13:36 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 2 Apr 2015 08:59:43 +0000 (09:59 +0100)
When trying to kexec into a new kernel on a platform where multiple CPU
cores are present, but no SMP bringup code is available yet, the
kexec_load system call fails with:

    kexec_load failed: Invalid argument

The SMP test added to machine_kexec_prepare() in commit 2103f6cba61a8b8b
("ARM: 7807/1: kexec: validate CPU hotplug support") wants to prohibit
kexec on SMP platforms where it cannot disable secondary CPUs.
However, this test is too strict: if the secondary CPUs couldn't be
enabled in the first place, there's no need to disable them later at
kexec time.  Hence skip the test in the absence of SMP bringup code.

This allows to add all CPU cores to the DTS from the beginning, without
having to implement SMP bringup first, improving DT compatibility.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/include/asm/smp_plat.h
arch/arm/kernel/machine_kexec.c
arch/arm/kernel/smp.c

index 0ad7d490ee6f2657b1504359d362ad8d886bee91..993e5224d8f7eeeb09f4c2a5358a97073c67c3a6 100644 (file)
@@ -104,6 +104,7 @@ static inline u32 mpidr_hash_size(void)
        return 1 << mpidr_hash.bits;
 }
 
+extern int platform_can_secondary_boot(void);
 extern int platform_can_cpu_hotplug(void);
 
 #endif
index de2b085ad7535da771a173ed855bcfdee4926c99..8bf3b7c098881b951df038575c6baf14e84df7b9 100644 (file)
@@ -46,7 +46,8 @@ int machine_kexec_prepare(struct kimage *image)
         * and implements CPU hotplug for the current HW. If not, we won't be
         * able to kexec reliably, so fail the prepare operation.
         */
-       if (num_possible_cpus() > 1 && !platform_can_cpu_hotplug())
+       if (num_possible_cpus() > 1 && platform_can_secondary_boot() &&
+           !platform_can_cpu_hotplug())
                return -EINVAL;
 
        /*
index 86ef244c5a24b4fa80b20da26c5d522832a61d59..cca5b87581855244deba92fc78f2f0ae02b2ad07 100644 (file)
@@ -145,6 +145,11 @@ void __init smp_init_cpus(void)
                smp_ops.smp_init_cpus();
 }
 
+int platform_can_secondary_boot(void)
+{
+       return !!smp_ops.smp_boot_secondary;
+}
+
 int platform_can_cpu_hotplug(void)
 {
 #ifdef CONFIG_HOTPLUG_CPU