[Skiboot] [PATCH v3] fast-reboot: disable on FSP code update or unrecoverable HMI

Stewart Smith stewart at linux.vnet.ibm.com
Tue Oct 25 19:31:50 AEDT 2016


Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>
[stewart at linux.vnet.ibm.com: unlock before return (suggested by Mahesh/Andrew),
disable only on non-cancelling fsp codeupdate call (suggested by Vasant)]
Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 core/fast-reboot.c      | 19 +++++++++++++++++++
 core/hmi.c              |  2 ++
 hw/fsp/fsp-codeupdate.c |  3 +++
 include/skiboot.h       |  1 +
 4 files changed, 25 insertions(+)

Changes in V3: actually include the FSP code update change

diff --git a/core/fast-reboot.c b/core/fast-reboot.c
index 66b31824c9eb..12ebf5b65f0a 100644
--- a/core/fast-reboot.c
+++ b/core/fast-reboot.c
@@ -281,6 +281,16 @@ static bool fast_reset_p8(void)
 extern void *fdt;
 extern struct lock capi_lock;
 
+static const char *fast_reboot_disabled = NULL;
+static struct lock fast_reboot_disabled_lock = LOCK_UNLOCKED;
+
+void disable_fast_reboot(const char *reason)
+{
+	lock(&fast_reboot_disabled_lock);
+	fast_reboot_disabled = reason;
+	unlock(&fast_reboot_disabled_lock);
+}
+
 void fast_reboot(void)
 {
 	bool success;
@@ -298,6 +308,15 @@ void fast_reboot(void)
 		return;
 	}
 
+	lock(&fast_reboot_disabled_lock);
+	if (fast_reboot_disabled) {
+		prlog(PR_DEBUG, "RESET: Fast reboot disabled because %s\n",
+		      fast_reboot_disabled);
+		unlock(&fast_reboot_disabled_lock);
+		return;
+	}
+	unlock(&fast_reboot_disabled_lock);
+
 	lock(&capi_lock);
 	for_each_chip(chip) {
 		if (chip->capp_phb3_attached_mask) {
diff --git a/core/hmi.c b/core/hmi.c
index 69403c6db350..6fe060dc7c56 100644
--- a/core/hmi.c
+++ b/core/hmi.c
@@ -836,6 +836,8 @@ int handle_hmi_exception(uint64_t hmer, struct OpalHMIEvent *hmi_evt)
 		}
 	}
 
+	if (recover == 0)
+		disable_fast_reboot("Unrecoverable HMI");
 	/*
 	 * HMER bits are sticky, once set to 1 they remain set to 1 until
 	 * they are set to 0. Reset the error source bit to 0, otherwise
diff --git a/hw/fsp/fsp-codeupdate.c b/hw/fsp/fsp-codeupdate.c
index 2263bf36dcc8..f17703a7261e 100644
--- a/hw/fsp/fsp-codeupdate.c
+++ b/hw/fsp/fsp-codeupdate.c
@@ -1141,6 +1141,9 @@ static int64_t fsp_opal_update_flash(struct opal_sg_list *list)
 		rc = OPAL_SUCCESS;
 		goto out;
 	}
+
+	disable_fast_reboot("FSP Code Update");
+
 	length = (be64_to_cpu(list->length) & ~(SG_LIST_VERSION << 56)) - 16;
 	num_entries = length / sizeof(struct opal_sg_entry);
 	if (num_entries <= 0)
diff --git a/include/skiboot.h b/include/skiboot.h
index 75c5207f9c1f..97bdce784eaf 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -190,6 +190,7 @@ extern unsigned long get_symbol(unsigned long addr,
 				char **sym, char **sym_end);
 
 /* Fast reboot support */
+extern void disable_fast_reboot(const char *reason);
 extern void fast_reboot(void);
 extern void __noreturn __secondary_cpu_entry(void);
 extern void __noreturn load_and_boot_kernel(bool is_reboot);
-- 
2.1.4



More information about the Skiboot mailing list