[v9,11/25] MPIPL: Define OPAL metadata area
diff mbox series

Message ID 20190712111802.23560-12-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
We want to save some information (like crashing CPU PIR, kernel tags,
etc) before triggering MPIPL. Post MPIPL we will use this information
to retrieve dump metadata and create dump.

MDRT table doesn't need 64K. Hence split MDRT table to accommodate
metadata area.

Finally define metadata structure.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 core/opal-dump.c    | 13 +++++++++++++
 include/mem-map.h   |  8 +++++++-
 include/opal-dump.h | 10 ++++++++++
 3 files changed, 30 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/core/opal-dump.c b/core/opal-dump.c
index 3d61f5092..56d6ba32e 100644
--- a/core/opal-dump.c
+++ b/core/opal-dump.c
@@ -37,6 +37,8 @@  static struct spira_ntuple *ntuple_mdst;
 static struct spira_ntuple *ntuple_mddt;
 static struct spira_ntuple *ntuple_mdrt;
 
+static struct mpipl_metadata    *mpipl_metadata;
+
 static int opal_mpipl_add_entry(u8 region, u64 src, u64 dest, u64 size)
 {
 	int i, max_cnt;
@@ -134,6 +136,17 @@  void opal_mpipl_init(void)
 	ntuple_mddt = &(spirah.ntuples.mdump_dst);
 	ntuple_mdrt = &(spirah.ntuples.mdump_res);
 
+	/* Get metadata area pointer */
+	mpipl_metadata = (void *)(DUMP_METADATA_AREA_BASE);
+
+	/* Clear OPAL metadata area */
+	if (sizeof(struct mpipl_metadata) > DUMP_METADATA_AREA_SIZE) {
+		prlog(PR_ERR, "INSUFFICIENT OPAL METADATA AREA\n");
+		prlog(PR_ERR, "INCREASE OPAL MEDTADATA AREA SIZE\n");
+		assert(false);
+	}
+	memset(mpipl_metadata, 0, sizeof(struct mpipl_metadata));
+
 	/* Clear MDST and MDDT table */
 	memset(mdst_base, 0, MDST_TABLE_SIZE);
 	ntuple_mdst->act_cnt = 0;
diff --git a/include/mem-map.h b/include/mem-map.h
index 0e03932a1..a29b8fb3e 100644
--- a/include/mem-map.h
+++ b/include/mem-map.h
@@ -106,7 +106,13 @@ 
  * 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		0x00008000
+
+/* This is our dump metadata area. We will use this memory to save metadata
+ * (like crashing CPU details, payload tags) before triggering MPIPL.
+ */
+#define DUMP_METADATA_AREA_BASE	(SKIBOOT_BASE + 0x01c08000)
+#define DUMP_METADATA_AREA_SIZE	0x8000
 
 /* Total size of the above area
  *
diff --git a/include/opal-dump.h b/include/opal-dump.h
index 0a86dcb1b..10a8df6ac 100644
--- a/include/opal-dump.h
+++ b/include/opal-dump.h
@@ -121,6 +121,16 @@  struct proc_reg_data {
 	uint64_t reg_val;
 } __packed;
 
+/* Metadata to capture before triggering MPIPL */
+struct mpipl_metadata {
+	/* Crashing PIR is required to create OPAL dump */
+	uint32_t	crashing_pir;
+	/* Kernel expects OPAL to presrve tag and pass it back via OPAL API */
+	uint64_t	kernel_tag;
+	/* Post MPIPL kernel boot memory size */
+	uint64_t	boot_mem_size;
+} __packed;
+
 /* init opal dump */
 extern void opal_mpipl_init(void);