[Skiboot] [PATCH v8 22/24] MPIPL: Reserve memory to capture architected registers data

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Mon Jun 17 03:10:22 AEST 2019


- Split SPIRAH memory to accommodate architected register ntuple.
  Today we have 1K memory for SPIRAH and it uses 288 bytes. Lets split
  this into two parts :
    SPIRAH (756 bytes)
    architected register memory (256 bytes)

- Update SPIRAH architected register ntuple

- Calculate memory required to capture architected registers data
  Ideally we should use HDAT provided data (proc_dump_area->thread_size).
  But we are not getting this data during boot. Hence lets reserve fixed
  memory for architected registers data collection. This is sufficient
  for 2 socket system. In future, if we support bigger system then we
  have to adjust this size.

- Add architected registers destination memory to reserve-memory DT node.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 core/opal-dump.c  | 30 ++++++++++++++++++++++++++++++
 hdata/spira.c     |  7 +++++++
 include/mem-map.h | 14 +++++++++++++-
 skiboot.lds.S     |  5 +++++
 4 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/core/opal-dump.c b/core/opal-dump.c
index 555908114..88b18f857 100644
--- a/core/opal-dump.c
+++ b/core/opal-dump.c
@@ -16,6 +16,7 @@
 
 #define pr_fmt(fmt)	"DUMP: " fmt
 
+#include <chip.h>
 #include <cpu.h>
 #include <device.h>
 #include <mem-map.h>
@@ -31,9 +32,18 @@
 
 #include "hdata/spira.h"
 
+/* XXX Ideally we should use HDAT provided data (proc_dump_area->thread_size).
+ *     But we are not getting this data durig boot. Hence lets reserve fixed
+ *     memory for architected registers data collection. This is sufficient
+ *     for 2 socket system. In future, if we support bigger system then we
+ *     have to adjust this size.
+ */
+#define ARCH_REGS_DATA_SIZE		0x100000
+
 /* Actual address of MDST and MDDT table */
 #define MDST_TABLE_BASE		(SKIBOOT_BASE + MDST_TABLE_OFF)
 #define MDDT_TABLE_BASE		(SKIBOOT_BASE + MDDT_TABLE_OFF)
+#define PROC_DUMP_AREA_BASE	(SKIBOOT_BASE + PROC_DUMP_AREA_OFF)
 
 static struct spira_ntuple *ntuple_mdst;
 static struct spira_ntuple *ntuple_mddt;
@@ -213,6 +223,8 @@ static int opal_mpipl_remove_entry_mddt(bool remove_all, u8 region, u64 dest)
 static void opal_mpipl_register(void)
 {
 	u64 opal_dest, opal_size;
+	u64 arch_regs_dest, arch_regs_size;
+	struct proc_dump_area *proc_dump = (void *)(PROC_DUMP_AREA_BASE);
 
 	/* Get OPAL runtime size */
 	if (!dt_find_property(opal_node, "opal-runtime-size")) {
@@ -229,6 +241,24 @@ static void opal_mpipl_register(void)
 	opal_dest = SKIBOOT_BASE + opal_size;
 	mem_reserve_fw("ibm,firmware-dump", opal_dest, opal_size);
 
+	/* Calculate memory to capture CPU register data */
+	arch_regs_dest = opal_dest + opal_size;
+	arch_regs_size = ARCH_REGS_DATA_SIZE;
+
+	if (nr_chips() > 2 ) {
+		prlog(PR_ERR, "NOT SUPPORTED ON > 2 SOCKET SYSTEM\n");
+		prlog(PR_ERR, "INCREASE ARCHITECTED REGISTERS RESERVED MEMORY SIZE\n");
+		assert(false);
+	}
+
+	/* Reserve memory used to capture architected register state */
+	mem_reserve_fw("ibm,firmware-arch-registers",
+		       arch_regs_dest, arch_regs_size);
+	proc_dump->alloc_addr = arch_regs_dest | HRMOR_BIT;
+	proc_dump->alloc_size = arch_regs_size;
+	prlog(PR_NOTICE, "Architected register dest addr : 0x%llx, "
+	      "size : 0x%llx\n", arch_regs_dest, arch_regs_size);
+
 	opal_mpipl_add_entry(DUMP_REGION_OPAL_MEMORY,
 			     SKIBOOT_BASE, opal_dest, opal_size);
 }
diff --git a/hdata/spira.c b/hdata/spira.c
index 3616922ee..42bb25f67 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -213,6 +213,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 a29b8fb3e..859fef75c 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		0x300
+
+#define PROC_DUMP_AREA_OFF	(SPIRAH_OFF + SPIRAH_SIZE)
+#define PROC_DUMP_AREA_SIZE	0x100
 
 /* 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 768 bytes (presently we use 288 bytes)
+ * Use 768 bytes for SPIRAH.
+ *
+ * Use 256 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
diff --git a/skiboot.lds.S b/skiboot.lds.S
index 5fb32c866..81fa6eaa1 100644
--- a/skiboot.lds.S
+++ b/skiboot.lds.S
@@ -80,6 +80,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