[Skiboot] [PATCH v8 11/11] Add obsolete secure-memory-ranges property
Oliver O'Halloran
oohall at gmail.com
Fri Aug 28 15:14:37 AEST 2020
On Thu, Aug 27, 2020 at 4:42 AM Ryan Grimm <grimm at linux.ibm.com> wrote:
>
> 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>
> ---
> hw/ultravisor.c | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/hw/ultravisor.c b/hw/ultravisor.c
> index 9b408e40..ebea350d 100644
> --- a/hw/ultravisor.c
> +++ b/hw/ultravisor.c
> @@ -75,6 +75,35 @@ int start_ultravisor(void *fdt)
> return OPAL_SUCCESS;
> }
>
> +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;
> + }
I think you need i++ on both lines.
> +
> + 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;
> @@ -99,6 +128,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_node);
> }
>
> static int uv_decompress_image(void)
> --
> 2.18.4
>
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
More information about the Skiboot
mailing list