Skip to contentSkip to conversation

powerpc/xmon: Allow passing an argument to ppc_md.restart()

PATCH In review Oliver O'Halloran 2 participants 3 messages Nov 1, 2019 – Jan 29, 2020 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 powerpc/xmon: Allow passing an argument to ppc_md.restart()

On PowerNV a few different kinds of reboot are supported. We'd like to be able to exercise these from xmon so allow 'zr' to take an argument, and pass that to the ppc_md.restart() function.

---
 arch/powerpc/xmon/xmon.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
arch/powerpc/xmon/xmon.c +7 -4
index d83364e..6a6f675 100644
@@ -1147,16 +1147,19 @@ static int do_step(struct pt_regs *regs)
 
 static void bootcmds(void)
 {
+	char tmp[64];
 	int cmd;
 
 	cmd = inchar();
-	if (cmd == 'r')
-		ppc_md.restart(NULL);
-	else if (cmd == 'h')
+	if (cmd == 'r') {
+		getstring(tmp, 64);
+		ppc_md.restart(tmp);
+	} else if (cmd == 'h') {
 		ppc_md.halt();
-	else if (cmd == 'p')
+	} else if (cmd == 'p') {
 		if (pm_power_off)
 			pm_power_off();
+	}
 }
 
 static int cpu_cmd(void)
Signature · 1 line
2.9.5
#1 lore raw

PATCH 2/2 powerpc/powernv: Allow manually invoking special reboots

OPAL provides several different kinds of reboot for the kernel to use, namely forcing a full reboot, platform error reboot and MPIPL. Right now triggering the alternative resets requires some ad-hoc method such as triggering a kernel crash and hoping the stars align. It's sometimes handy to be able to trigger one of these resets directly, so add a way to do that.

---
 arch/powerpc/platforms/powernv/setup.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/powerpc/platforms/powernv/setup.c +4 -0
index 8349860..11fdae8 100644
@@ -233,6 +233,10 @@ static void  __noreturn pnv_restart(char *cmd)
 			rc = opal_cec_reboot();
 		else if (strcmp(cmd, "full") == 0)
 			rc = opal_cec_reboot2(OPAL_REBOOT_FULL_IPL, NULL);
+		else if (strcmp(cmd, "mpipl") == 0)
+			rc = opal_cec_reboot2(OPAL_REBOOT_MPIPL, NULL);
+		else if (strcmp(cmd, "error") == 0)
+			rc = opal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR, NULL);
 		else
 			rc = OPAL_UNSUPPORTED;
 
Signature · 1 line
2.9.5