Skip to contentSkip to conversation

ARM: aspeed: Add CPU hotplug callbacks for kexec support

PATCH In review Bruce Mitchell 1 participant 3 messages Mar 22, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: aspeed: Add CPU hotplug callbacks for kexec support

These callbacks are required for kexec to function. The AST2600 does not expose any controls for powering down it's CPU cores, so we borrow the approach taken from socfpga and wait in the idle loop.

Author: Joel Stanley <[email protected]>

---
 arch/arm/mach-aspeed/platsmp.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/arm/mach-aspeed/platsmp.c +20 -0
index 2324becf7991..1ae3ff5a9701 100644
@@ -7,6 +7,8 @@
 #include <linux/of.h>
 #include <linux/smp.h>
 
+#include <asm/proc-fns.h>
+
 #define BOOT_ADDR	0x00
 #define BOOT_SIG	0x04
 
@@ -53,9 +55,27 @@ static void __init aspeed_g6_smp_prepare_cpus(unsigned int max_cpus)
 	iounmap(base);
 }
 
+#ifdef CONFIG_HOTPLUG_CPU
+static void aspeed_g6_cpu_die(unsigned int cpu)
+{
+        /* Do WFI. If we wake up early, go back into WFI */
+        while (1)
+                cpu_do_idle();
+}
+
+static int aspeed_g6_cpu_kill(unsigned int cpu)
+{
+        return 1;
+}
+#endif
+
 static const struct smp_operations aspeed_smp_ops __initconst = {
 	.smp_prepare_cpus	= aspeed_g6_smp_prepare_cpus,
 	.smp_boot_secondary	= aspeed_g6_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+	.cpu_die		= aspeed_g6_cpu_die,
+	.cpu_kill		= aspeed_g6_cpu_kill,
+#endif
 };
 
 CPU_METHOD_OF_DECLARE(aspeed_smp, "aspeed,ast2600-smp", &aspeed_smp_ops);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 43 lines · Bruce Mitchell

These callbacks are required for kexec to function. The AST2600 does not expose any controls for powering down it's CPU cores, so we borrow the approach taken from socfpga and wait in the idle loop.

Author: Joel Stanley <[email protected]>

---
  arch/arm/mach-aspeed/platsmp.c | 20 ++++++++++++++++++++
  1 file changed, 20 insertions(+)
arch/arm/mach-aspeed/platsmp.c +16 -0
index 2324becf7991..1ae3ff5a9701 100644
@@ -7,6 +7,8 @@
  #include <linux/of.h>
  #include <linux/smp.h>
 
+#include <asm/proc-fns.h>
+
  #define BOOT_ADDR	0x00
  #define BOOT_SIG	0x04
 
@@ -53,9 +55,27 @@ static void __init aspeed_g6_smp_prepare_cpus(unsigned int max_cpus)
  	iounmap(base);
  }
 
+#ifdef CONFIG_HOTPLUG_CPU
+static void aspeed_g6_cpu_die(unsigned int cpu)
+{
+        /* Do WFI. If we wake up early, go back into WFI */
+        while (1)
+                cpu_do_idle();
+}
+
+static int aspeed_g6_cpu_kill(unsigned int cpu)
+{
+        return 1;
+}
+#endif
+

arch/arm/mach-aspeed/platsmp.c static void __init aspeed_g6_smp_prepare_cpus(unsigned int max_cpus) · line 81

Quoted 10 lines
arch/arm/mach-aspeed/platsmp.c +4 -0
  static const struct smp_operations aspeed_smp_ops __initconst = {
  	.smp_prepare_cpus	= aspeed_g6_smp_prepare_cpus,
  	.smp_boot_secondary	= aspeed_g6_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+	.cpu_die		= aspeed_g6_cpu_die,
+	.cpu_kill		= aspeed_g6_cpu_kill,
+#endif
  };
 
  CPU_METHOD_OF_DECLARE(aspeed_smp, "aspeed,ast2600-smp", &aspeed_smp_ops);

Adding Andrew Jeffery and Eddie James to the CC list.

Signature · 1 line
Bruce
#2 lore raw
Quoted 53 lines · Bruce Mitchell
Quoted 52 lines · Bruce Mitchell

These callbacks are required for kexec to function. The AST2600 does not expose any controls for powering down it's CPU cores, so we borrow the approach taken from socfpga and wait in the idle loop.

Author: Joel Stanley <[email protected]>

---
  arch/arm/mach-aspeed/platsmp.c | 20 ++++++++++++++++++++

  1 file changed, 20 insertions(+)
arch/arm/mach-aspeed/platsmp.c +20 -0
index 2324becf7991..1ae3ff5a9701 100644
@@ -7,6 +7,8 @@
   #include <linux/of.h>
   #include <linux/smp.h>
 
+#include <asm/proc-fns.h>
+
   #define BOOT_ADDR    0x00
   #define BOOT_SIG    0x04
 
@@ -53,9 +55,27 @@ static void __init 
 aspeed_g6_smp_prepare_cpus(unsigned int max_cpus)
       iounmap(base);
   }
 
+#ifdef CONFIG_HOTPLUG_CPU
+static void aspeed_g6_cpu_die(unsigned int cpu)
+{
+        /* Do WFI. If we wake up early, go back into WFI */
+        while (1)
+                cpu_do_idle();
+}
+
+static int aspeed_g6_cpu_kill(unsigned int cpu)
+{
+        return 1;
+}
+#endif
+
   static const struct smp_operations aspeed_smp_ops __initconst = {
       .smp_prepare_cpus    = aspeed_g6_smp_prepare_cpus,
       .smp_boot_secondary    = aspeed_g6_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+    .cpu_die        = aspeed_g6_cpu_die,
+    .cpu_kill        = aspeed_g6_cpu_kill,
+#endif
   };
 
Quoted 5 lines
Quoted 2 lines

  CPU_METHOD_OF_DECLARE(aspeed_smp, "aspeed,ast2600-smp", &aspeed_smp_ops);

Adding Andrew Jeffery and Eddie James to the CC list.

Adding [email protected] and [email protected] based feedback.