From: Guenter Roeck <groeck@google.com>
To: Douglas Anderson <dianders@chromium.org>
Cc: Kees Cook <keescook@chromium.org>,
Anton Vorontsov <anton@enomsg.org>,
"open list:ARM/Rockchip SoC..."
<linux-rockchip@lists.infradead.org>,
Julius Werner <jwerner@chromium.org>,
Guenter Roeck <groeck@chromium.org>,
Matthias Kaehlcke <mka@chromium.org>,
Brian Norris <briannorris@chromium.org>,
Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks
Date: Fri, 3 May 2019 12:06:05 -0700 [thread overview]
Message-ID: <CABXOdTdPXPc8Uq=08xYv2YTF-fn_ZX4kjCwRjMA7qL+Epu7WcA@mail.gmail.com> (raw)
In-Reply-To: <20190503174730.245762-1-dianders@chromium.org>
On Fri, May 3, 2019 at 10:48 AM Douglas Anderson <dianders@chromium.org> wrote:
>
> When you try to run an upstream kernel on an old ARM-based Chromebook
> you'll find that console-ramoops doesn't work.
>
> Old ARM-based Chromebooks, before <https://crrev.com/c/439792>
> ("ramoops: support upstream {console,pmsg,ftrace}-size properties")
> used to create a "ramoops" node at the top level that looked like:
>
> / {
> ramoops {
> compatible = "ramoops";
> reg = <...>;
> record-size = <...>;
> dump-oops;
> };
> };
>
> ...and these Chromebooks assumed that the downstream kernel would make
> console_size / pmsg_size match the record size. The above ramoops
> node was added by the firmware so it's not easy to make any changes.
>
> Let's match the expected behavior, but only for those using the old
> backward-compatible way of working where ramoops is right under the
> root node.
>
> NOTE: if there are some out-of-tree devices that had ramoops at the
> top level, left everything but the record size as 0, and somehow
> doesn't want this behavior, we can try to add more conditions here.
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
> ---
>
> fs/pstore/ram.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
> index c5c685589e36..8df3bfa2837f 100644
> --- a/fs/pstore/ram.c
> +++ b/fs/pstore/ram.c
> @@ -669,6 +669,7 @@ static int ramoops_parse_dt(struct platform_device *pdev,
> struct ramoops_platform_data *pdata)
> {
> struct device_node *of_node = pdev->dev.of_node;
> + struct device_node *parent_node;
> struct resource *res;
> u32 value;
> int ret;
> @@ -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. Let's
> + * make those old Chromebooks work by detecting this and mimicing the
> + * 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;
> }
>
> --
> 2.21.0.1020.gf2820cf01a-goog
>
next prev parent reply other threads:[~2019-05-03 19:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-03 17:47 [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks Douglas Anderson
2019-05-03 19:06 ` Guenter Roeck [this message]
2019-05-06 21:09 ` Kees Cook
2019-05-06 21:33 ` Rob Herring
2019-05-06 23:58 ` Doug Anderson
2019-05-07 4:51 ` Doug Anderson
2019-05-07 22:17 ` Frank Rowand
2019-05-07 22:19 ` Doug Anderson
2019-05-07 22:23 ` Frank Rowand
2019-05-06 21:40 ` Brian Norris
2019-05-07 16:25 ` Doug Anderson
2019-05-07 16:48 ` Brian Norris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CABXOdTdPXPc8Uq=08xYv2YTF-fn_ZX4kjCwRjMA7qL+Epu7WcA@mail.gmail.com' \
--to=groeck@google.com \
--cc=anton@enomsg.org \
--cc=briannorris@chromium.org \
--cc=ccross@android.com \
--cc=dianders@chromium.org \
--cc=groeck@chromium.org \
--cc=jwerner@chromium.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mka@chromium.org \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).