[v6,11/22] hdata: Create dump DT node under /ibm, opal DT node

Message ID 20181128110244.17664-12-hegdevasant@linux.vnet.ibm.com
State New
Headers show
Series
  • MPIPL support
Related show

Checks

Context Check Description
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied

Commit Message

Vasant Hegde Nov. 28, 2018, 11:02 a.m.
We use MPIPL system parameter to detect whether MPIPL is supported or not.
If its supported create new device tree node (/ibm,opal/dump) to pass all
dump related information to kernel. This patch creates new node and populates
below properties:
  - compatible   - dump version (ibm,opal-dump)
  - fw-load-area - Memory used by OPAL to load kernel/initrd from PNOR
                   (KERNEL_LOAD_BASE & INITRAMFS_LOAD_BASE)
                   This is the temporary memory used by OPAL during boot.
		   Later Linux kernel is free to use this memory. We will
		   pass this information to Linux. If Linux kernel is using
		   these memory, it will make sure to create destination
		   memory to preserve content during MPIPL.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 hdata/spira.c | 24 ++++++++++++++++++++++++
 hdata/spira.h |  1 +
 2 files changed, 25 insertions(+)

Patch

diff --git a/hdata/spira.c b/hdata/spira.c
index b0e91803f..d1748511c 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -1033,6 +1033,26 @@  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 fadump_add_node(void)
+{
+	u64 fw_load_area[4];
+	struct dt_node *node;
+
+	if (proc_gen < proc_gen_p9)
+		return;
+
+	opal_node = dt_new_check(dt_root, "ibm,opal");
+	node = dt_new(opal_node, "dump");
+	assert(node);
+	dt_add_property_string(node, "compatible", "ibm,opal-dump");
+
+	fw_load_area[0] = (u64)KERNEL_LOAD_BASE;
+	fw_load_area[1] = KERNEL_LOAD_SIZE;
+	fw_load_area[2] = (u64)INITRAMFS_LOAD_BASE;
+	fw_load_area[3] = INITRAMFS_LOAD_SIZE;
+	dt_add_property(node, "fw-load-area", fw_load_area, sizeof(fw_load_area));
+}
+
 static void add_iplparams_sys_params(const void *iplp, struct dt_node *node)
 {
 	const struct iplparams_sysparams *p;
@@ -1120,6 +1140,10 @@  static void add_iplparams_sys_params(const void *iplp, struct dt_node *node)
 	if (sys_attributes & SYS_ATTR_RISK_LEVEL)
 		dt_add_property(node, "elevated-risk-level", NULL, 0);
 
+	/* Populate fadump node */
+	if (sys_attributes & SYS_ATTR_MPIPL_SUPPORTED)
+		fadump_add_node();
+
 	if (version >= 0x60 && proc_gen >= proc_gen_p9)
 		dt_init_secureboot_node(p);
 }
diff --git a/hdata/spira.h b/hdata/spira.h
index 8aa688b62..5c030692e 100644
--- a/hdata/spira.h
+++ b/hdata/spira.h
@@ -364,6 +364,7 @@  struct iplparams_sysparams {
 	__be32		sys_eco_mode;
 #define SYS_ATTR_MULTIPLE_TPM PPC_BIT32(0)
 #define SYS_ATTR_RISK_LEVEL PPC_BIT32(3)
+#define SYS_ATTR_MPIPL_SUPPORTED PPC_BIT32(4)
 	__be32		sys_attributes;
 	__be32		mem_scrubbing;
 	__be16		cur_spl_value;