Re: [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks

From: Brian Norris
Date: Mon May 06 2019 - 17:41:43 EST


On Fri, May 3, 2019 at 10:48 AM Douglas Anderson <dianders@xxxxxxxxxxxx> wrote:
> When you try to run an upstream kernel on an old ARM-based Chromebook
> you'll find that console-ramoops doesn't work.

Ooh, nice! I still get annoyed by old depthcharge firmware. It's
almost as if we should have gotten an upstream binding approved before
baking it into firmware...

> --- a/fs/pstore/ram.c
> +++ b/fs/pstore/ram.c

> @@ -703,6 +704,23 @@ static int ramoops_parse_dt(struct platform_device *pdev,
>
> #undef parse_size
>
> + /*
> + * Some old Chromebooks relied on the kernel setting the console_size
> + * and pmsg_size to the record size since that's what the downstream
> + * kernel did. These same Chromebooks had "ramoops" straight under
> + * the root node which isn't according to the upstream bindings.

The last part of the sentence technically isn't true -- the original
bindings (notably, with no DT maintainer Reviewed-by) didn't specify
where such a node should be found:

35da60941e44 pstore/ram: add Device Tree bindings

so child-of-root used to be a valid location. But anyway, this code is
just part of a heuristic for "old DT" (where later bindings clarified
this), so it still seems valid.

> Let's
> + * make those old Chromebooks work by detecting this and mimicing the

s/mimicing/mimicking/

> + * expected behavior.
> + */
> + parent_node = of_get_parent(of_node);
> + if (of_node_is_root(parent_node) &&
> + !pdata->console_size && !pdata->ftrace_size &&
> + !pdata->pmsg_size && !pdata->ecc_info.ecc_size) {
> + pdata->console_size = pdata->record_size;
> + pdata->pmsg_size = pdata->record_size;
> + }
> + of_node_put(parent_node);
> +
> return 0;
> }
>

Otherwise, looks good to me:

Reviewed-by: Brian Norris <briannorris@xxxxxxxxxxxx>