Skip to contentSkip to conversation

powerpc/pseries: tell phyp to auto-restart

PATCH New Linas Vepstas 1 participant 1 message Nov 21, 2007 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/pseries: tell phyp to auto-restart

The pseries hypervisor attempts to detect and prevent an infinite loop of kernel crashes and auto-reboots. It does so by refusing to auto-reboot unless we indicate that the current boot was sucessful. So, indicate success late in the boot sequence.

----
Sigh. This is a side-effect of the patch I sent yesterday. Its supposed to simplify the management large numbers of partitions.

 arch/powerpc/platforms/pseries/setup.c |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
arch/powerpc/platforms/pseries/setup.c +31 -0
Index: linux-2.6.24-rc3-git1/arch/powerpc/platforms/pseries/setup.c
===================================================================
@@ -491,6 +491,37 @@ void pSeries_power_off(void)
 	for (;;);
 }
 
+/**
+ * pSeries_auto_restart - tell hypervisor that boot succeeded.
+ *
+ * The pseries hypervisor attempts to detect and prevent an
+ * infinite loop of kernel crashes and auto-reboots. It does
+ * so by refusing to auto-reboot unless we indicate that the
+ * current boot was sucessful.  So, indicate success late in
+ * the boot sequence.
+ */
+static int __init pSeries_auto_restart(void)
+{
+	static char buff[3]; /* static so that its in RMO region */
+	int rc;
+	int token = rtas_token("ibm,set-system-parameter");
+	if (!token)
+		return 0;
+
+	/* partition_auto_restart is 21; set to to 1 to auto-restart the OS. */
+	buff[0] = 0;
+	buff[1] = 1; /* length */
+	buff[2] = 1; /* value */
+	do {
+		rc = rtas_call (token, 2, 1, NULL, 21, buff);
+	} while (rtas_busy_delay(rc));
+	if (rc)
+		printk(KERN_INFO "pSeries_auto_restart(): "
+		       "unable to setup autorestart, rc=%d\n", rc);
+	return 0;
+}
+late_initcall(pSeries_auto_restart);
+
 #ifndef CONFIG_PCI
 void pSeries_final_fixup(void) { }
 #endif