[Skiboot] [PATCH v6 22/22] fadump: Save crashing cpu data

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Wed Nov 28 22:02:44 AEDT 2018


Crashing CPU detail is required to get proper backtrace from core file.
Save crashing CPU data before triggering MPIPL. During MPIPL boot
pass this detail to Host Linux via device tree.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 core/opal-mpipl.c   | 9 +++++++++
 hdata/spira.c       | 7 +++++++
 hw/sbe-p9.c         | 4 ++++
 include/mem-map.h   | 9 ++++++++-
 include/opal-dump.h | 8 ++++++++
 5 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/core/opal-mpipl.c b/core/opal-mpipl.c
index 9a12395ef..913ef4e0a 100644
--- a/core/opal-mpipl.c
+++ b/core/opal-mpipl.c
@@ -16,6 +16,7 @@
 
 #define pr_fmt(fmt)	"FADUMP: " fmt
 
+#include <cpu.h>
 #include <device.h>
 #include <mem-map.h>
 #include <mem_region.h>
@@ -336,6 +337,14 @@ static void adjust_opal_dump_size(struct dt_node *dump_node)
 	add_fadump_reserve_node(dump_node);
 }
 
+void opal_fadump_save_metadata(void)
+{
+	struct dump_metadata *m = (struct dump_metadata *)(DUMP_METADATA_AREA_BASE);
+
+	m->crashing_cpu = this_cpu()->pir;
+	prlog(PR_NOTICE, "Crashing CPU = 0x%x\n", m->crashing_cpu);
+}
+
 void opal_fadump_init(void)
 {
 	struct dt_node *dump_node;
diff --git a/hdata/spira.c b/hdata/spira.c
index f70f095da..41f72fac1 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -1095,6 +1095,9 @@ static void fadump_add_result_table(const struct iplparams_iplparams *p)
 	struct fadump_section *fadump_section;
 	struct fadump *result_table;
 	struct dt_node *dump_node;
+	struct dump_metadata *m;
+
+	m = (struct dump_metadata *)(DUMP_METADATA_AREA_BASE - SKIBOOT_BASE + FADUMP_DEST_SKIBOOT_BASE);
 
 	dump_node = dt_find_by_path(opal_node, "dump");
 	if (!dump_node)
@@ -1167,6 +1170,10 @@ static void fadump_add_result_table(const struct iplparams_iplparams *p)
 	/* Add architected register data to result-table */
 	fadump_add_arch_regs(dump_node, result_table, &j);
 
+	/* Fill crashing CPU details */
+	result_table->crashing_cpu = m->crashing_cpu;
+	prlog(PR_NOTICE, "Crashed cpu = 0x%x\n", m->crashing_cpu);
+
 	result_table->section_count = j;
 	/* Actual property size */
 	prop_size = sizeof(struct fadump) + (j * sizeof(struct fadump_section));
diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c
index d9bc07fe4..24f78ae9f 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>
@@ -964,6 +965,9 @@ void p9_sbe_terminate(void)
 	if (!dt_find_by_path(opal_node, "dump"))
 		return;
 
+	/* Save crashing CPU details */
+	opal_fadump_save_metadata();
+
 	/* Unregister flash. It will request BMC MBOX reset */
 	flash_unregister();
 
diff --git a/include/mem-map.h b/include/mem-map.h
index 8fcb6de4e..78e37e9fb 100644
--- a/include/mem-map.h
+++ b/include/mem-map.h
@@ -119,7 +119,14 @@
  * memory after moving memory content from source to destination memory.
  */
 #define MDRT_TABLE_BASE		(SKIBOOT_BASE + 0x01c00000)
-#define MDRT_TABLE_SIZE		0x00010000
+#define MDRT_TABLE_SIZE		0x0000f000
+
+/*
+ * This is our dump meta data area. We will use this memory to save
+ * crashing CPU details before triggering MPIPL.
+ */
+#define DUMP_METADATA_AREA_BASE	(SKIBOOT_BASE + 0x01c0f000)
+#define DUMP_METADATA_AREA_SIZE	0x1000
 
 /* Total size of the above area
  *
diff --git a/include/opal-dump.h b/include/opal-dump.h
index a45f34fa2..ccf86d840 100644
--- a/include/opal-dump.h
+++ b/include/opal-dump.h
@@ -124,7 +124,15 @@ struct proc_reg_data {
 }  __packed;
 
 
+/* Meta data to capture before triggering MPIPL */
+struct dump_metadata {
+	uint32_t crashing_cpu;
+};
+
 /* init opal dump */
 extern void opal_fadump_init(void);
 
+/* Save metadata before triggering MPIPL */
+extern void opal_fadump_save_metadata(void);
+
 #endif	/* __OPAL_DUMP_H */
-- 
2.14.3



More information about the Skiboot mailing list