[Skiboot] [RFC PATCH v7 12/12] Add obsolete secure-memory-ranges property

Ryan Grimm grimm at linux.ibm.com
Tue Jul 7 02:14:39 AEST 2020


Upstream kernel code looks for this so keep compatibility till it's safe
to remove.

Signed-off-by: Ryan Grimm <grimm at linux.ibm.com>
---
 hdata/spira.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/hdata/spira.c b/hdata/spira.c
index 9d0ea6d6..5ba1ff13 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -1651,6 +1651,34 @@ static void add_npus(void)
 	}
 }
 
+static void add_obsolete_uv_prop(struct dt_node *uv_node)
+{
+	uint64_t secure_start, secure_size;
+	struct dt_node *np;
+	int num_ranges = 0;
+	uint64_t *ranges;
+	int i = 0;
+
+	dt_for_each_compatible(dt_root, np, "ibm,secure-memory")
+		num_ranges++;
+
+	ranges = malloc(num_ranges * sizeof(ranges) * 2);
+	if (!ranges) {
+		prerror("UV: Malloc failed");
+		return;
+	}
+
+	dt_for_each_compatible(dt_root, np, "ibm,secure-memory") {
+		secure_start = dt_get_address(np, 0, &secure_size);
+		ranges[i] = secure_start;
+		ranges[i++] = secure_size;
+	}
+
+	dt_add_property(uv_node, "secure-memory-ranges",
+			ranges, sizeof(ranges));
+	free(ranges);
+}
+
 static void add_uv(void)
 {
 	struct dt_node *uv_node, *secure_mem_node, *uv_fw_node;
@@ -1675,6 +1703,8 @@ static void add_uv(void)
 	uv_fw_node = dt_new_check(uv_node, fw_name);
 	dt_add_property_string(uv_fw_node, "compatible", "ibm,uv-firmware");
 	dt_add_property_u64s(uv_fw_node, "reg", uv_fw_start, UV_LOAD_MAX_SIZE);
+
+	add_obsolete_uv_prop(uv_fw_node);
 }
 
 /*
-- 
2.21.0



More information about the Skiboot mailing list