[Skiboot] [PATCH v8 09/11] Create ibm, ultravisor node after uv image loaded
Ryan Grimm
grimm at linux.ibm.com
Thu Aug 27 04:37:47 AEST 2020
See doc/opal-uv-abi.rst for details.
Signed-off-by: Ryan Grimm <grimm at linux.ibm.com>
---
hw/ultravisor.c | 28 ++++++++++++++++++++++++++++
include/ultravisor.h | 2 ++
2 files changed, 30 insertions(+)
diff --git a/hw/ultravisor.c b/hw/ultravisor.c
index 34c16404..9b408e40 100644
--- a/hw/ultravisor.c
+++ b/hw/ultravisor.c
@@ -75,6 +75,32 @@ int start_ultravisor(void *fdt)
return OPAL_SUCCESS;
}
+static void add_uv(void)
+{
+ struct dt_node *uv_node, *secure_mem_node, *uv_fw_node;
+ uint64_t uv_fw_start;
+ char fw_name[64];
+
+ secure_mem_node = dt_find_compatible_node_on_chip(dt_root, NULL,
+ "ibm,secure-memory", 0);
+ if (!secure_mem_node) {
+ prlog(PR_DEBUG, "HDAT: No ibm,secure-memory found\n");
+ return;
+ }
+
+ uv_node = dt_new_check(dt_root, "ibm,ultravisor");
+ dt_add_property_string(uv_node, "compatible", "ibm,ultravisor");
+ dt_add_property_cells(uv_node, "#address-cells", 2);
+ dt_add_property_cells(uv_node, "#size-cells", 2);
+
+ uv_fw_start = dt_get_address(secure_mem_node, 0, NULL);
+
+ snprintf(fw_name, 64, "firmware@%llx", (unsigned long long)uv_fw_start);
+ 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);
+}
+
static int uv_decompress_image(void)
{
struct xz_decompress uv_xz;
@@ -105,6 +131,8 @@ static int uv_decompress_image(void)
return OPAL_INTERNAL_ERROR;
}
+ add_uv();
+
return OPAL_SUCCESS;
}
diff --git a/include/ultravisor.h b/include/ultravisor.h
index 8048cb76..a2ae1ac5 100644
--- a/include/ultravisor.h
+++ b/include/ultravisor.h
@@ -67,4 +67,6 @@ static inline int uv_xscom_write(u64 partid, u64 pcb_addr, u64 val)
#define MAX_COMPRESSED_UV_IMAGE_SIZE 0x40000 /* 256 Kilobytes */
void uv_preload_image(void);
+#define UV_LOAD_MAX_SIZE 0x200000
+
#endif /* __ULTRAVISOR_H */
--
2.18.4
More information about the Skiboot
mailing list