Re: [PATCH v3 08/12] ppc64/kexec_file: setup the stack for purgatory

From: Thiago Jung Bauermann
Date: Wed Jul 15 2020 - 21:40:40 EST



Sorry, forgot to send one comment for this patch:

Hari Bathini <hbathini@xxxxxxxxxxxxx> writes:

> @@ -898,10 +900,37 @@ int setup_purgatory_ppc64(struct kimage *image, const void *slave_code,
> goto out;
> }
>
> + /* Setup the stack top */
> + stack_buf = kexec_purgatory_get_symbol_addr(image, "stack_buf");
> + if (!stack_buf)
> + goto out;
> +
> + val = (u64)stack_buf + KEXEC_PURGATORY_STACK_SIZE;
> + ret = kexec_purgatory_get_set_symbol(image, "stack", &val, sizeof(val),
> + false);
> + if (ret)
> + goto out;
> +
> /* Setup the TOC pointer */
> val = get_toc_ptr(&(image->purgatory_info));
> ret = kexec_purgatory_get_set_symbol(image, "my_toc", &val, sizeof(val),
> false);
> + if (ret)
> + goto out;
> +
> + /* Setup OPAL base & entry values */
> + dn = of_find_node_by_path("/ibm,opal");
> + if (dn) {
> + of_property_read_u64(dn, "opal-base-address", &val);
> + ret = kexec_purgatory_get_set_symbol(image, "opal_base", &val,
> + sizeof(val), false);
> + if (ret)
> + goto out;
> +
> + of_property_read_u64(dn, "opal-entry-address", &val);
> + ret = kexec_purgatory_get_set_symbol(image, "opal_entry", &val,
> + sizeof(val), false);

You need to call of_node_put(dn) here and in the if (ret) case above.

> + }
> out:
> if (ret)
> pr_err("Failed to setup purgatory symbols");

--
Thiago Jung Bauermann
IBM Linux Technology Center