[OpenWrt-Devel] [PATCH] mt7621: add kexec smp shutdown patch.

Daniel Danzberger daniel at dd-wrt.com
Sun Feb 17 07:31:04 EST 2019


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 at 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

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 at 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 at 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
+
-- 
2.20.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list