linux-gbmc(stable/mainline): Fix kexec on npcm7xx
This patch is necessary for the kdump kernel to work as expected.
Change-Id: I81396daf182d4071aa38d9b33a8c12931f3278e1
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/recipes-kernel/linux/files/0001-ARM-npcm-Add-CPU-hotplug-callbacks-for-kexec-support.patch b/recipes-kernel/linux/files/0001-ARM-npcm-Add-CPU-hotplug-callbacks-for-kexec-support.patch
new file mode 100644
index 0000000..4d0efb9
--- /dev/null
+++ b/recipes-kernel/linux/files/0001-ARM-npcm-Add-CPU-hotplug-callbacks-for-kexec-support.patch
@@ -0,0 +1,54 @@
+From bdf82d5c44696399151ef78d64c951cc5034e598 Mon Sep 17 00:00:00 2001
+From: Brian Ma <chma0@nuvoton.com>
+Date: Fri, 28 Apr 2023 10:18:02 +0800
+Subject: [PATCH] ARM: npcm: Add CPU hotplug callbacks for kexec support
+
+Add callbacks required for kexec to function. The NPCM7xx/NPCN8xx does
+not expose controls for powering down CPU cores, so just wait in idle
+loop.
+
+Patch Tracking Bug: b/308861899
+Upstream Info: https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=798292
+Upstream-Status: Pending
+Justification: Required for nuvoton BMCs
+Signed-off-by: Brian Ma <chma0@nuvoton.com>
+Signed-off-by: William A. Kennington III <william@wkennington.com>
+---
+ arch/arm/mach-npcm/platsmp.c | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+diff --git a/arch/arm/mach-npcm/platsmp.c b/arch/arm/mach-npcm/platsmp.c
+index 41891d3aa124..6cc7b5894f08 100644
+--- a/arch/arm/mach-npcm/platsmp.c
++++ b/arch/arm/mach-npcm/platsmp.c
+@@ -69,10 +69,27 @@ static void __init npcm7xx_smp_prepare_cpus(unsigned int max_cpus)
+
+ iounmap(scu_base);
+ }
++#ifdef CONFIG_HOTPLUG_CPU
++static void npcm7xx_cpu_die(unsigned int cpu)
++{
++ while (1)
++ cpu_do_idle();
++}
++
++static int npcm7xx_cpu_kill(unsigned int l_cpu)
++{
++ return 1;
++}
++#endif
++
+
+ static struct smp_operations npcm7xx_smp_ops __initdata = {
+ .smp_prepare_cpus = npcm7xx_smp_prepare_cpus,
+ .smp_boot_secondary = npcm7xx_smp_boot_secondary,
++#ifdef CONFIG_HOTPLUG_CPU
++ .cpu_die = npcm7xx_cpu_die,
++ .cpu_kill = npcm7xx_cpu_kill,
++#endif
+ };
+
+ CPU_METHOD_OF_DECLARE(npcm7xx_smp, "nuvoton,npcm750-smp", &npcm7xx_smp_ops);
+--
+2.42.0.820.g83a721a137-goog
+
diff --git a/recipes-kernel/linux/linux-gbmc_mainline.bb b/recipes-kernel/linux/linux-gbmc_mainline.bb
index 98a7ec3..d99cb38 100644
--- a/recipes-kernel/linux/linux-gbmc_mainline.bb
+++ b/recipes-kernel/linux/linux-gbmc_mainline.bb
@@ -13,6 +13,7 @@
SRC_URI:append = " \
file://0001-jffs2-add-RENAME_EXCHANGE-support.patch \
file://0001-mux-Make-it-possible-to-select-MULTIPLEXER-if-EXPERT.patch \
+ file://0001-ARM-npcm-Add-CPU-hotplug-callbacks-for-kexec-support.patch \
"
do_patch:prepend() {
diff --git a/recipes-kernel/linux/linux-gbmc_stable.bb b/recipes-kernel/linux/linux-gbmc_stable.bb
index 8b207b5..e80a0bc 100644
--- a/recipes-kernel/linux/linux-gbmc_stable.bb
+++ b/recipes-kernel/linux/linux-gbmc_stable.bb
@@ -14,6 +14,7 @@
file://0001-jffs2-add-RENAME_EXCHANGE-support.patch \
file://0001-mux-Make-it-possible-to-select-MULTIPLEXER-if-EXPERT.patch \
file://0001-spi-npcm-fiu-Fix-UMA-reads-when-dummy.nbytes-0.patch \
+ file://0001-ARM-npcm-Add-CPU-hotplug-callbacks-for-kexec-support.patch \
"
do_patch:prepend() {