[Skiboot] [PATCH v8 23/24] MPIPL: Prepare architected registers data tag

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


Post MPIPL kernel needs saved CPU register details to create vmcore/opalcore.
This patch prepares CPU register data tag and add tags list.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 core/opal-dump.c | 41 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/core/opal-dump.c b/core/opal-dump.c
index 88b18f857..f034ea0c0 100644
--- a/core/opal-dump.c
+++ b/core/opal-dump.c
@@ -53,6 +53,7 @@ static struct mpipl_metadata    *mpipl_metadata;
 
 /* Dump metadata area */
 static struct mpipl_fadump *mpipl_opal_data;
+static struct mpipl_fadump *mpipl_cpu_data;
 
 /*
  * Number of tags passed by OPAL to kernel after MPIPL boot.
@@ -373,6 +374,42 @@ static uint64_t opal_mpipl_query_tag(uint32_t idx, uint64_t *tag)
 	return OPAL_SUCCESS;
 }
 
+static void post_mpipl_arch_regs_data(void)
+{
+	struct proc_dump_area *proc_dump = (void *)(PROC_DUMP_AREA_BASE);
+
+	if (proc_dump->dest_addr == 0) {
+		prlog(PR_DEBUG, "Invalid CPU registers destination address\n");
+		return;
+	}
+
+	if (proc_dump->act_size == 0) {
+		prlog(PR_DEBUG, "Invalid CPU registers destination size\n");
+		return;
+	}
+
+	mpipl_cpu_data = zalloc(sizeof(struct mpipl_fadump) +
+				sizeof(struct fadump_region));
+	if (!mpipl_cpu_data) {
+		prlog(PR_ERR, "Failed to allocate memory\n");
+		return;
+	}
+
+	/* Fill CPU register details */
+	mpipl_cpu_data->type    = MPIPL_FADUMP_TYPE_CPU;
+	mpipl_cpu_data->version = MPIPL_FADUMP_VERSION;
+	mpipl_cpu_data->cpu_data_version = proc_dump->version;
+	mpipl_cpu_data->cpu_data_size = proc_dump->thread_size;
+	mpipl_cpu_data->fadump_region_cnt = cpu_to_be32(1);
+
+	mpipl_cpu_data->region[0].src  = proc_dump->dest_addr & ~(HRMOR_BIT);
+	mpipl_cpu_data->region[0].dest = proc_dump->dest_addr & ~(HRMOR_BIT);
+	mpipl_cpu_data->region[0].size = proc_dump->act_size;
+
+	/* Update tag */
+	mpipl_tags[max_tags++] = (u64)mpipl_cpu_data;
+}
+
 static void post_mpipl_get_opal_data(void)
 {
 	struct mdrt_table *mdrt = (void *)(MDRT_TABLE_BASE);
@@ -453,8 +490,10 @@ void opal_mpipl_init(void)
 	/* Get metadata area pointer */
 	mpipl_metadata = (void *)(DUMP_METADATA_AREA_BASE);
 
-	if (dt_find_property(dump_node, "mpipl-boot"))
+	if (dt_find_property(dump_node, "mpipl-boot")) {
 		post_mpipl_get_opal_data();
+		post_mpipl_arch_regs_data();
+	}
 
 	/* Clear OPAL metadata area */
 	if (sizeof(struct mpipl_metadata) > DUMP_METADATA_AREA_SIZE) {
-- 
2.14.3



More information about the Skiboot mailing list