[OpenWrt-Devel] mt7621: add kexec smp shutdown patch.
diff mbox series

Message ID 20190217123104.11376-1-daniel@dd-wrt.com
State Changes Requested
Delegated to: Petr Štetiar
Headers show
Series
  • [OpenWrt-Devel] mt7621: add kexec smp shutdown patch.
Related show

Commit Message

Daniel Danzberger Feb. 17, 2019, 12:31 p.m. UTC
This patch shuts down all secondary cpus before executing machine_kexec.
This avoids paging errors and random hangups when doing kexec.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
---
 .../120-mt7621-kexec-smp-shutdown.patch       | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 target/linux/ramips/patches-4.14/120-mt7621-kexec-smp-shutdown.patch

Comments

Petr Štetiar May 15, 2019, 2:09 p.m. UTC | #1
Daniel Danzberger <daniel@dd-wrt.com> [2019-02-17 13:31:04]:

Hi,

> This patch shuts down all secondary cpus before executing machine_kexec.
> This avoids paging errors and random hangups when doing kexec.

this looks like a material for upstream submission, so please take it through
upstream and then backport it to OpenWrt. Thanks!

-- ynezz

Patch
diff mbox series

diff --git a/target/linux/ramips/patches-4.14/120-mt7621-kexec-smp-shutdown.patch b/target/linux/ramips/patches-4.14/120-mt7621-kexec-smp-shutdown.patch
new file mode 100644
index 0000000000..a4c0e59521
--- /dev/null
+++ b/target/linux/ramips/patches-4.14/120-mt7621-kexec-smp-shutdown.patch
@@ -0,0 +1,65 @@ 
+From 17288381dfc3e920d81cfd4e63e33e3630d54a58 Mon Sep 17 00:00:00 2001
+From: Daniel Danzberger <daniel@dd-wrt.com>
+Date: Sat, 22 Dec 2018 22:20:37 +0100
+Subject: [PATCH] mt7621: kexec: shutdown secondary cpus
+
+Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
+---
+ arch/mips/ralink/mt7621.c | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/arch/mips/ralink/mt7621.c b/arch/mips/ralink/mt7621.c
+index 801edf9..34dced6 100644
+--- a/arch/mips/ralink/mt7621.c
++++ b/arch/mips/ralink/mt7621.c
+@@ -13,6 +13,7 @@
+ #include <linux/clk.h>
+ #include <linux/clkdev.h>
+ #include <linux/clk-provider.h>
++#include <linux/cpu.h>
+ #include <dt-bindings/clock/mt7621-clk.h>
+
+ #include <asm/mipsregs.h>
+@@ -23,6 +24,7 @@
+ #include <asm/mips-boards/launch.h>
+ #include <asm/delay.h>
+ #include <asm/time.h>
++#include <asm/kexec.h>
+
+ #include <pinmux.h>
+
+@@ -271,6 +273,21 @@ static int udelay_recal(void)
+ }
+ device_initcall(udelay_recal);
+
++#ifdef CONFIG_KEXEC
++static void mt7621_kexec_shutdown(void)
++{
++	int reboot_cpu = 0;
++	int cpu;
++
++	for_each_online_cpu(cpu) {
++		if (cpu != reboot_cpu)
++			cpu_down(cpu);
++	}
++	cpu_hotplug_disable();
++}
++#endif
++
++
+ void prom_soc_init(struct ralink_soc_info *soc_info)
+ {
+ 	void __iomem *sysc = (void __iomem *) KSEG1ADDR(MT7621_SYSC_BASE);
+@@ -325,6 +342,9 @@ void prom_soc_init(struct ralink_soc_info *soc_info)
+
+ 	rt2880_pinmux_data = mt7621_pinmux_data;
+
++#ifdef CONFIG_KEXEC
++	_machine_kexec_shutdown = mt7621_kexec_shutdown;
++#endif
+
+ 	if (!register_cps_smp_ops())
+ 		return;
+--
+2.11.0
+