Thread (4 messages) flat view 4 messages, 3 authors, 2018-09-05

Re: [PATCH v2] powerpc/powernv: Make possible for user to force a full ipl cec reboot

From: Andrew Donnellan <hidden>
Date: 2018-09-04 01:59:55

On 03/09/18 20:26, Vaibhav Jain wrote:
quoted hunk ↗ jump to hunk
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index adddde023622..650484e0940b 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -224,7 +224,22 @@ static void  __noreturn pnv_restart(char *cmd)
  	pnv_prepare_going_down();
  
  	while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
-		rc = opal_cec_reboot();
+		/* See if we need to do a full IPL reboot */
+		if (cmd && strcmp(cmd, "full") == 0)
+			rc = opal_cec_reboot2(OPAL_REBOOT_FULL_IPL, NULL);
+		else
+			rc = OPAL_UNSUPPORTED;
+
+		if (!(rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT)) {
+			if (cmd) {
+				pr_warn("Couldn't do a '%s' reboot. Err=%ld\n",
+					cmd, rc);
+				/* reset cmd to force a cec_reboot now */
+				cmd = NULL;
+			}
+			rc = opal_cec_reboot();
+		}
+
The logic here is a bit hard to follow, relying on if (cmd && strcmp...) 
failing then setting rc = OPAL_UNSUPPORTED in order to handle the normal 
case seems a bit backwards.

I think I would slightly prefer it if the !cmd case were handled first 
to make it clear that opal_cec_reboot() is the normal case.

But either way:

Acked-by: Andrew Donnellan <redacted>


-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com  IBM Australia Limited
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help