[Skiboot] [PATCH v6 20/22] fadump: Hardcode architected register destination memory

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


Hardcode architected register destination memory address. So that we can
capture early OPAL crashes.

Note that this patch splits SPIRAH memory into two parts to accommodate
architected register ntuple. Today we have 1K memory for SPIRAH and it uses
288 bytes. After this split we have 244 bytes left for SPIRAH expansion. I
think this is good enough (at least for P9 generation).

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 core/opal-mpipl.c |  4 ++++
 hdata/spira.c     | 12 ++++++++++++
 include/mem-map.h | 26 +++++++++++++++++++++++---
 skiboot.lds.S     |  5 +++++
 4 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/core/opal-mpipl.c b/core/opal-mpipl.c
index f9287c713..9a12395ef 100644
--- a/core/opal-mpipl.c
+++ b/core/opal-mpipl.c
@@ -250,6 +250,10 @@ static void add_fadump_reserve_node(struct dt_node *dump_node)
 
 	mem_reserve_fw("ibm,firmware-dump", (u64)FADUMP_DEST_CON_LOG,
 		       new_size > cur_size ? new_size : cur_size);
+
+	/* Reserved memory used to capture architected register state */
+	mem_reserve_fw("ibm,firmware-arch-registers",
+		       (u64)ARCH_REGS_STATE_BASE, ARCH_REGS_STATE_SIZE);
 }
 
 /* Pass OPAL dump reservation details to payload via device tree. */
diff --git a/hdata/spira.c b/hdata/spira.c
index d52df3f05..01f77f9b2 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -131,6 +131,11 @@ __section(".mddt.data") struct mddt_table init_mddt_table[3] = {
 	},
 };
 
+__section(".procdump.data") struct proc_dump_area proc_dump_area = {
+	.alloc_addr = CPU_TO_BE64(ARCH_REGS_STATE_BASE | HRMOR_BIT),
+	.alloc_size = CPU_TO_BE32(ARCH_REGS_STATE_SIZE),
+};
+
 /* SP Interface Root Array, aka SPIRA */
 __section(".spira.data") struct spira spira = {
 	.hdr = HDIF_SIMPLE_HDR("SPIRA ", SPIRA_VERSION, struct spira),
@@ -241,6 +246,13 @@ __section(".spirah.data") struct spirah spirah = {
 			.alloc_len	= CPU_TO_BE32(sizeof(struct mdrt_table)),
 			.act_len	= CPU_TO_BE32(sizeof(struct mdrt_table)),
 		},
+		.proc_dump_area = {
+			.addr		= CPU_TO_BE64(PROC_DUMP_AREA_OFF),
+			.alloc_cnt	= CPU_TO_BE16(1),
+			.act_cnt	= CPU_TO_BE16(1),
+			.alloc_len	= CPU_TO_BE32(sizeof(struct proc_dump_area)),
+			.act_len	= CPU_TO_BE32(sizeof(struct proc_dump_area)),
+		},
 	},
 };
 
diff --git a/include/mem-map.h b/include/mem-map.h
index 00d045fc5..8fcb6de4e 100644
--- a/include/mem-map.h
+++ b/include/mem-map.h
@@ -38,10 +38,22 @@
  * give it 64k before placing the SPIRA and related data.
  */
 #define SPIRA_OFF		0x00010000
+#define SPIRA_SIZE		0x400
 #define SPIRAH_OFF		0x00010400
+#define SPIRAH_SIZE		0x200
+
+#define PROC_DUMP_AREA_OFF	(SPIRAH_OFF + SPIRAH_SIZE)
+#define PROC_DUMP_AREA_SIZE	0x200
 
 /* Actual SPIRA size is lesser than 1K (presently 0x340 bytes).
- * Use 1K for legacy SPIRA and 1K for SPIRA-H.
+ * Use 1K for legacy SPIRA.
+ *
+ * SPIRA-H is lesser than 512 bytes (presently we use 288 bytes)
+ * Use 512 bytes for SPIRAH.
+ *
+ * Use 512 bytes for processor dump area. (presently we use
+ * sizeof(proc_dump_area) = 0x30 bytes).
+ *
  * Then follow with for proc_init_data (aka PROCIN).
  * These need to be at fixed addresses in case we're ever little
  * endian: linker can't endian reverse a pointer for us.  Text, data
@@ -133,9 +145,17 @@
  * XXX: Use continuguous memory for OPAL destination memory so that we can
  *      create single reserve node entry in device tree for OPAL destination
  *      memory.
+ *
+ *      Note that we allocate maximum memory required to capture architected
+ *      registers on P9 two socket system. If we ever support bigger system
+ *      then we have to adjust this size.
  */
-#define FADUMP_DEST_CON_LOG		(CPU_STACKS_BASE + \
+#define ARCH_REGS_STATE_BASE		(CPU_STACKS_BASE + \
 					 ((SPR_PIR_P9_MASK + 1) * STACK_SIZE))
+#define ARCH_REGS_STATE_SIZE		0x200000
+
+/* Destination memory to capture OPAL dump */
+#define FADUMP_DEST_CON_LOG		(ARCH_REGS_STATE_BASE + ARCH_REGS_STATE_SIZE)
 #define FADUMP_DEST_CON_SIZE		(INMEM_CON_LEN)
 
 #define FADUMP_DEST_HBRT_LOG		(FADUMP_DEST_CON_LOG + FADUMP_DEST_CON_SIZE)
@@ -143,7 +163,7 @@
 
 #define FADUMP_DEST_SKIBOOT_BASE	(FADUMP_DEST_HBRT_LOG + FADUMP_DEST_HBRT_SIZE)
 /* Collect OPAL core including max possible CPU stack data */
-#define FADUMP_DEST_SKIBOOT_SIZE	(FADUMP_DEST_CON_LOG - SKIBOOT_BASE)
+#define FADUMP_DEST_SKIBOOT_SIZE	(ARCH_REGS_STATE_BASE - SKIBOOT_BASE)
 
 /*
  * Address at which we load the kernel LID. This is also where
diff --git a/skiboot.lds.S b/skiboot.lds.S
index 31cc5faa2..37dbd34a7 100644
--- a/skiboot.lds.S
+++ b/skiboot.lds.S
@@ -37,6 +37,11 @@ SECTIONS
 		KEEP(*(.spirah.data))
 	}
 
+	. = PROC_DUMP_AREA_OFF;
+	.procdump : {
+		KEEP(*(.procdump.data))
+	}
+
 	. = PROCIN_OFF;
 	.procin.data : {
 		KEEP(*(.procin.data))
-- 
2.14.3



More information about the Skiboot mailing list