[Skiboot] [PATCH v2 2/2] mpipl: Move opal_mpipl_save_crashing_pir() call to platform specific code

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Wed Jun 17 17:16:10 AEST 2020


Commit 34664746 moved opal_mpipl_save_crashing_pir() function call from
platform specific code to generic assert() path. I completely missed
to take care of all terminate path :-(

This resulted in breaking `opalcore` on Linux kernel initiated MPIPL. As :
 - Linux initiated MPIPL calls platform termination function directly
 - ELF core format needs crashing CPU details to generate proper code

Hence I think it makes sense to move this back to platform specific
terminate handler code.

Today we have two ways to trigger MPIPL based on service processor.
  - On BMC system we call SBE S0 interrupt
  - On FSP system we call `attn` instruction
In future if we add new ways to trigger MPIPL then we have to add platform
specific support code anyway. That way its fine to move this to platform
sepcific code.

One alternative is to make this call in all code path before making
platform.terminate call... which makes it more complicated than above approach.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 core/opal-dump.c  | 8 +-------
 core/utils.c      | 4 ----
 hw/fsp/fsp-attn.c | 4 ++++
 hw/sbe-p9.c       | 3 +++
 4 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/core/opal-dump.c b/core/opal-dump.c
index ca6bf0648..4f54a3ef1 100644
--- a/core/opal-dump.c
+++ b/core/opal-dump.c
@@ -489,13 +489,7 @@ static void post_mpipl_get_opal_data(void)
 
 void opal_mpipl_save_crashing_pir(void)
 {
-	struct dt_node *opal_node;
-
-	opal_node = dt_find_by_path(dt_root, "ibm,opal");
-	if (!opal_node)
-		return;
-
-	if (!dt_find_by_path(opal_node, "dump"))
+	if (!is_mpipl_enabled())
 		return;
 
 	mpipl_metadata->crashing_pir = this_cpu()->pir;
diff --git a/core/utils.c b/core/utils.c
index d778fcdff..0d2f5e894 100644
--- a/core/utils.c
+++ b/core/utils.c
@@ -12,7 +12,6 @@
 #include <processor.h>
 #include <cpu.h>
 #include <stack.h>
-#include <opal-dump.h>
 
 void __noreturn assert_fail(const char *msg, const char *file,
 				unsigned int line, const char *function)
@@ -34,9 +33,6 @@ void __noreturn assert_fail(const char *msg, const char *file,
 	prlog(PR_EMERG, "assert failed at %s:%u: %s\n", file, line, msg);
 	backtrace();
 
-	/* Save crashing CPU details */
-	opal_mpipl_save_crashing_pir();
-
 	if (platform.terminate)
 		platform.terminate(msg);
 
diff --git a/hw/fsp/fsp-attn.c b/hw/fsp/fsp-attn.c
index 9d032d18d..6e358e0d4 100644
--- a/hw/fsp/fsp-attn.c
+++ b/hw/fsp/fsp-attn.c
@@ -14,6 +14,7 @@
 #include <hdata/spira.h>
 #include <stack.h>
 #include <processor.h>
+#include <opal-dump.h>
 
 #define TI_CMD_VALID	0x1	/* Command valid */
 #define TI_CMD		0xA1	/* Terminate Immediate command */
@@ -118,6 +119,9 @@ void __attribute__((noreturn)) ibm_fsp_terminate(const char *msg)
 	/* Update op panel op_display */
 	op_display(OP_FATAL, OP_MOD_CORE, 0x6666);
 
+	/* Save crashing CPU details */
+	opal_mpipl_save_crashing_pir();
+
 	/* XXX FIXME: We should fsp_poll for a while to ensure any pending
 	 * console writes have made it out, but until we have decent PSI
 	 * link handling we must not do it forever. Polling can prevent the
diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c
index 24ed91b93..ae5aacb12 100644
--- a/hw/sbe-p9.c
+++ b/hw/sbe-p9.c
@@ -952,6 +952,9 @@ void p9_sbe_terminate(void)
 	if (!is_mpipl_enabled())
 		return;
 
+	/* Save crashing CPU details */
+	opal_mpipl_save_crashing_pir();
+
 	/* Unregister flash. It will request BMC MBOX reset */
 	if (!flash_unregister()) {
 		prlog(PR_DEBUG, "Failed to reset BMC MBOX\n");
-- 
2.26.2



More information about the Skiboot mailing list