[Skiboot] [PATCH v9 19/25] hdata: Add "mpipl-boot" property to "dump" node

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Fri Jul 12 21:17:56 AEST 2019


During MPIPL boot, hostboot updates HDAT to indicate its MPIPL boot. Lets
add "mpipl-boot" property to device tree. So that kernel can detect its
MPIPL boot and create dump.

Device tree property:
  /ibm,opal/dump/mpipl-boot - Indicate kernel that its MPIPL boot

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 hdata/spira.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 hdata/spira.h |  4 ++++
 2 files changed, 47 insertions(+)

diff --git a/hdata/spira.c b/hdata/spira.c
index 58aee742f..9d487b8b2 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -934,6 +934,46 @@ static void dt_init_secureboot_node(const struct iplparams_sysparams *sysparams)
 	dt_add_property_cells(node, "hw-key-hash-size", hw_key_hash_size);
 }
 
+static void opal_dump_add_mpipl_boot(const struct iplparams_iplparams *p)
+{
+	u32 mdrt_cnt = spira.ntuples.mdump_res.act_cnt;
+	u32 mdrt_max_cnt = MDRT_TABLE_SIZE / sizeof(struct mdrt_table);
+	struct dt_node *dump_node;
+
+	dump_node = dt_find_by_path(opal_node, "dump");
+	if (!dump_node)
+		return;
+
+	/* Check boot params to detect MPIPL boot or not */
+	if (p->cec_ipl_maj_type != IPLPARAMS_MAJ_TYPE_REIPL)
+		return;
+
+	/*
+	 * On FSP system we get minor type as post dump IPL and on BMC system
+	 * we get platform reboot. Hence lets check for both values.
+	 */
+	if (p->cec_ipl_min_type != IPLPARAMS_MIN_TYPE_POST_DUMP &&
+	    p->cec_ipl_min_type != IPLPARAMS_MIN_TYPE_PLAT_REBOOT) {
+		prlog(PR_NOTICE, "DUMP: Non MPIPL reboot "
+		      "[minor type = 0x%x]\n", p->cec_ipl_min_type);
+		return;
+	}
+
+	if (p->cec_ipl_attrib != IPLPARAMS_ATTRIB_MEM_PRESERVE) {
+		prlog(PR_DEBUG, "DUMP: Memory not preserved\n");
+		return;
+	}
+
+	if (mdrt_cnt == 0 || mdrt_cnt >= mdrt_max_cnt) {
+		prlog(PR_DEBUG, "DUMP: Invalid MDRT count : %x\n", mdrt_cnt);
+		return;
+	}
+
+	prlog(PR_NOTICE, "DUMP: Dump found, MDRT count = 0x%x\n", mdrt_cnt);
+
+	dt_add_property(dump_node, "mpipl-boot", NULL, 0);
+}
+
 static void add_opal_dump_node(void)
 {
 	u64 fw_load_area[4];
@@ -1094,6 +1134,9 @@ static void add_iplparams_ipl_params(const void *iplp, struct dt_node *node)
 	else
 		dt_add_property_strings(led_node, DT_PROPERTY_LED_MODE,
 					LED_MODE_GUIDING_LIGHT);
+
+	/* Populate opal dump result table */
+	opal_dump_add_mpipl_boot(p);
 }
 
 static void add_iplparams_serials(const void *iplp, struct dt_node *node)
diff --git a/hdata/spira.h b/hdata/spira.h
index d29632821..3d8f46ff2 100644
--- a/hdata/spira.h
+++ b/hdata/spira.h
@@ -401,8 +401,12 @@ struct iplparams_iplparams {
 #define IPLPARAMS_FSP_FW_IPL_SIDE_TEMP	0x01
 	uint8_t		ipl_speed;
 	__be16		cec_ipl_attrib;
+#define IPLPARAMS_ATTRIB_MEM_PRESERVE	PPC_BIT16(2)
 	uint8_t		cec_ipl_maj_type;
+#define IPLPARAMS_MAJ_TYPE_REIPL	0x1
 	uint8_t		cec_ipl_min_type;
+#define IPLPARAMS_MIN_TYPE_POST_DUMP	0xc
+#define IPLPARAMS_MIN_TYPE_PLAT_REBOOT	0xd
 	uint8_t		os_ipl_mode;
 	uint8_t		keylock_pos;
 	uint8_t		lmb_size;
-- 
2.14.3



More information about the Skiboot mailing list