[v9,16/25] MPIPL: Save crashing PIR
diff mbox series

Message ID 20190712111802.23560-17-hegdevasant@linux.vnet.ibm.com
State Accepted
Headers show
Series
  • MPIPL support
Related show

Checks

Context Check Description
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (4db38a36b31045f0a116d388ddeac850b38c8680)

Commit Message

Vasant Hegde July 12, 2019, 11:17 a.m. UTC
Crashing CPU PIR is required to get proper backtrace from core file.
Save crashing CPU PIR before triggering MPIPL. Post MPIPL OPAL will
pass saved PIR to kernel and kernel will use that to create OPAL dump.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 core/opal-dump.c    | 7 +++++++
 hw/sbe-p9.c         | 4 ++++
 include/opal-dump.h | 3 +++
 3 files changed, 14 insertions(+)

Patch
diff mbox series

diff --git a/core/opal-dump.c b/core/opal-dump.c
index 9ca01e5e2..bb90c45d0 100644
--- a/core/opal-dump.c
+++ b/core/opal-dump.c
@@ -16,6 +16,7 @@ 
 
 #define pr_fmt(fmt)	"DUMP: " fmt
 
+#include <cpu.h>
 #include <device.h>
 #include <mem-map.h>
 #include <mem_region.h>
@@ -328,6 +329,12 @@  static int64_t opal_mpipl_register_tag(enum opal_mpipl_tags tag,
 	return rc;
 }
 
+void opal_mpipl_save_crashing_pir(void)
+{
+	mpipl_metadata->crashing_pir = this_cpu()->pir;
+	prlog(PR_NOTICE, "Crashing PIR = 0x%x\n", this_cpu()->pir);
+}
+
 void opal_mpipl_init(void)
 {
 	void *mdst_base = (void *)MDST_TABLE_BASE;
diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c
index 58a296c00..01f41e8cb 100644
--- a/hw/sbe-p9.c
+++ b/hw/sbe-p9.c
@@ -50,6 +50,7 @@ 
 #include <errorlog.h>
 #include <lock.h>
 #include <opal.h>
+#include <opal-dump.h>
 #include <sbe-p9.h>
 #include <skiboot.h>
 #include <timebase.h>
@@ -961,6 +962,9 @@  void p9_sbe_terminate(void)
 	if (!dt_find_by_path(opal_node, "dump"))
 		return;
 
+	/* Save crashing CPU details */
+	opal_mpipl_save_crashing_pir();
+
 	/*
 	 * Send S0 interrupt to all SBE. Sequence:
 	 *   - S0 interrupt on secondary chip SBE
diff --git a/include/opal-dump.h b/include/opal-dump.h
index 3699ddc32..813fbd761 100644
--- a/include/opal-dump.h
+++ b/include/opal-dump.h
@@ -135,4 +135,7 @@  struct mpipl_metadata {
 /* init opal dump */
 extern void opal_mpipl_init(void);
 
+/* Save metadata before triggering MPIPL */
+void opal_mpipl_save_crashing_pir(void);
+
 #endif	/* __OPAL_DUMP_H */