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

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Sat Apr 13 19:15:46 AEST 2019


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-dump.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-dump.c b/core/opal-dump.c
index 8e042083c..f06739937 100644
--- a/core/opal-dump.c
+++ b/core/opal-dump.c
@@ -261,6 +261,10 @@ static void add_dump_reserve_node(struct dt_node *dump_node)
 
 	mem_reserve_fw("ibm,firmware-dump", (u64)OPAL_DUMP_DEST_BASE,
 		       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 fa6149322..856126844 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),
@@ -242,6 +247,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 01b8945b6..0cb4d5da4 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 OPAL_DUMP_DEST_BASE	(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 OPAL_DUMP_DEST_BASE	(ARCH_REGS_STATE_BASE + ARCH_REGS_STATE_SIZE)
 
 #define DUMP_DEST_CON_BASE	(OPAL_DUMP_DEST_BASE)
 #define DUMP_DEST_CON_SIZE	(INMEM_CON_LEN)
@@ -145,7 +165,7 @@
 
 #define DUMP_DEST_SKIBOOT_BASE	(DUMP_DEST_HBRT_BASE + DUMP_DEST_HBRT_SIZE)
 /* Collect OPAL core including max possible CPU stack data */
-#define DUMP_DEST_SKIBOOT_SIZE	(OPAL_DUMP_DEST_BASE - SKIBOOT_BASE)
+#define DUMP_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 7eb28fc49..41b43258c 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