[Skiboot] [PATCH v8 20/24] MPIPL: Add OPAL API to query saved tags

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


Pre-MPIPL kernel saves various information required to create vmcore in
metadata area and passes metadata area pointer to OPAL. OPAL will preserve
this pointer across MPIPL. Post MPIPL kernel will request for saved tags
via this API. Kernel also needs below tags:
  - Saved CPU registers data to access CPU registers
  - OPAL metadata area to create opalcore

Format:
  opal_mpipl_query_tag(uint32_t idx, uint64_t *tag)

  idx : tag index (0..n)
  tag : OPAL will pass saved tag

  Kernel will make this call with increased `index` until OPAL returns
  OPAL_EMPTY.

Return values:
  OPAL_SUCCESS   : Operation success
  OPAL_PARAMETER : Invalid parameter
  OPAL_EMPTY	 : OPAL completed sending all tags to kernel

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 core/opal-dump.c   | 32 ++++++++++++++++++++++++++++++++
 include/opal-api.h |  3 ++-
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/core/opal-dump.c b/core/opal-dump.c
index 7b8823d84..e53991784 100644
--- a/core/opal-dump.c
+++ b/core/opal-dump.c
@@ -44,6 +44,17 @@ static struct mpipl_metadata    *mpipl_metadata;
 /* Dump metadata area */
 static struct mpipl_fadump *mpipl_opal_data;
 
+/*
+ * Number of tags passed by OPAL to kernel after MPIPL boot.
+ * Currently it supports below tags:
+ *   - Kernel passed tag during MPIPL registration
+ *   - OPAL metadata area address
+ *   - CPU register data area
+ */
+#define MAX_MPIPL_TAGS		0x03
+static u64 mpipl_tags[MAX_MPIPL_TAGS];
+static int max_tags;
+
 
 static int opal_mpipl_add_entry(u8 region, u64 src, u64 dest, u64 size)
 {
@@ -308,6 +319,20 @@ static int64_t opal_mpipl_update(enum mpipl_ops ops,
 	return rc;
 }
 
+static uint64_t opal_mpipl_query_tag(uint32_t idx, uint64_t *tag)
+{
+	if (!opal_addr_valid(tag)) {
+		prlog(PR_DEBUG, "Invalid tag address\n");
+		return OPAL_PARAMETER;
+	}
+
+	if (idx >= max_tags)
+		return OPAL_EMPTY;
+
+	*tag = mpipl_tags[idx];
+	return OPAL_SUCCESS;
+}
+
 static void post_mpipl_get_opal_data(void)
 {
 	struct mdrt_table *mdrt = (void *)(MDRT_TABLE_BASE);
@@ -356,6 +381,12 @@ static void post_mpipl_get_opal_data(void)
 		if (j == count)
 			break;
 	}
+
+	/* Update tags */
+	if (mpipl_metadata->kernel_tag)
+		mpipl_tags[max_tags++] = mpipl_metadata->kernel_tag;
+
+	mpipl_tags[max_tags++] = (u64)mpipl_opal_data;
 }
 
 void opal_mpipl_save_crashing_pir(void)
@@ -406,4 +437,5 @@ void opal_mpipl_init(void)
 
 	/* OPAL API for MPIPL update */
 	opal_register(OPAL_MPIPL_UPDATE, opal_mpipl_update, 4);
+	opal_register(OPAL_MPIPL_QUERY_TAG, opal_mpipl_query_tag, 2);
 }
diff --git a/include/opal-api.h b/include/opal-api.h
index 5af1a6d0f..6f6656557 100644
--- a/include/opal-api.h
+++ b/include/opal-api.h
@@ -233,7 +233,8 @@
 #define OPAL_NPU_MEM_ALLOC			171
 #define OPAL_NPU_MEM_RELEASE			172
 #define OPAL_MPIPL_UPDATE			173
-#define OPAL_LAST				173
+#define OPAL_MPIPL_QUERY_TAG			174
+#define OPAL_LAST				174
 
 #define QUIESCE_HOLD			1 /* Spin all calls at entry */
 #define QUIESCE_REJECT			2 /* Fail all calls with OPAL_BUSY */
-- 
2.14.3



More information about the Skiboot mailing list