From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Rob Herring <robh@kernel.org>,
Saravana Kannan <saravanak@google.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Sasha Levin <sashal@kernel.org>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Chen-Yu Tsai <wenst@chromium.org>,
Conor Dooley <conor@kernel.org>
Subject: Re: [PATCH] of: Add Google Juniper to excluded default cells list
Date: Mon, 25 Nov 2024 12:38:08 +0100 [thread overview]
Message-ID: <c97c05cf-9cf2-40e7-8f50-2f438721c394@linaro.org> (raw)
In-Reply-To: <20241125113151.107812-1-krzysztof.kozlowski@linaro.org>
On 25/11/2024 12:31, Krzysztof Kozlowski wrote:
> Google Juniper platforms have a very old bootloader which populates
> /firmware node without proper address/size-cells leading to warnings:
>
> Missing '#address-cells' in /firmware
> WARNING: CPU: 0 PID: 1 at drivers/of/base.c:106 of_bus_n_addr_cells+0x90/0xf0
> Modules linked in:
> CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.0 #1 933ab9971ff4d5dc58cb378a96f64c7f72e3454d
> Hardware name: Google juniper sku16 board (DT)
> ...
> Missing '#size-cells' in /firmware
> WARNING: CPU: 0 PID: 1 at drivers/of/base.c:133 of_bus_n_size_cells+0x90/0xf0
> Modules linked in:
> CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Tainted: G W 6.12.0 #1 933ab9971ff4d5dc58cb378a96f64c7f72e3454d
> Tainted: [W]=WARN
> Hardware name: Google juniper sku16 board (DT)
>
> The platform won't receive updated bootloader/firmware so add it to
> excluded platform list to silence the warning.
>
> Reported-by: Sasha Levin <sashal@kernel.org>
> Closes: https://lore.kernel.org/all/Z0NUdoG17EwuCigT@sashalap/
> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: Chen-Yu Tsai <wenst@chromium.org>
> Cc: Conor Dooley <conor@kernel.org>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
> drivers/of/base.c | 26 ++++++++++++++++++++++++--
> 1 file changed, 24 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index a8b0c42bdc8e..13f0b2877ee0 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -56,6 +56,16 @@ DEFINE_MUTEX(of_mutex);
> */
> DEFINE_RAW_SPINLOCK(devtree_lock);
>
> +/*
> + * List of machines running old firmware without explicit #address-cells and
> + * #size-cells values for parent nodes, which are most likely not going get any
> + * update.
> + */
> +static const char * const excluded_default_cells_compats[] = {
> + "google,juniper",
> + NULL
> +};
> +
> bool of_node_name_eq(const struct device_node *np, const char *name)
> {
> const char *node_name;
> @@ -91,6 +101,17 @@ static bool __of_node_is_type(const struct device_node *np, const char *type)
> IS_ENABLED(CONFIG_SPARC) \
> )
>
> +static bool excluded_default_cells_machines(void)
> +{
> + /* Do not repeat the machine checks for every bus */
> + static int excluded_machine = -1;
> +
> + if (excluded_machine < 0)
> + excluded_machine = of_machine_compatible_match(excluded_default_cells_compats);
> +
> + return !!excluded_machine;
> +}
> +
> int of_bus_n_addr_cells(struct device_node *np)
> {
> u32 cells;
> @@ -103,7 +124,7 @@ int of_bus_n_addr_cells(struct device_node *np)
> * is deprecated. Any platforms which hit this warning should
> * be added to the excluded list.
> */
> - WARN_ONCE(!EXCLUDED_DEFAULT_CELLS_PLATFORMS,
> + WARN_ONCE(!EXCLUDED_DEFAULT_CELLS_PLATFORMS && !excluded_default_cells_machines(),
> "Missing '#address-cells' in %pOF\n", np);
> }
> return OF_ROOT_NODE_ADDR_CELLS_DEFAULT;
> @@ -125,12 +146,13 @@ int of_bus_n_size_cells(struct device_node *np)
> for (; np; np = np->parent) {
> if (!of_property_read_u32(np, "#size-cells", &cells))
> return cells;
> +
This was not intentional, I'll fix it in v2.
Obviously this code is not really SMP aware, but even with store tearing
I don't think it will be issue. Worst case the
of_machine_compatible_match() will be called more than one, which is not
fatal and might not justify atomics or locks.
Best regards,
Krzysztof
next prev parent reply other threads:[~2024-11-25 11:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-25 11:31 Krzysztof Kozlowski
2024-11-25 11:38 ` Krzysztof Kozlowski [this message]
2024-11-25 12:02 ` AngeloGioacchino Del Regno
2024-11-25 15:46 ` Rob Herring
2024-11-26 3:53 ` Chen-Yu Tsai
2024-11-27 19:28 ` Rob Herring
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=c97c05cf-9cf2-40e7-8f50-2f438721c394@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=conor@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=robh@kernel.org \
--cc=saravanak@google.com \
--cc=sashal@kernel.org \
--cc=wenst@chromium.org \
/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
all inboxes | Powered by JetHome®