From: Stefan Wiehler <stefan.wiehler@nokia.com>
To: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Stefan Wiehler <stefan.wiehler@nokia.com>
Subject: [PATCH RESEND] arm: topology: Fix missing clock-frequency property warning
Date: Thu, 1 Feb 2024 13:36:06 +0100 [thread overview]
Message-ID: <20240201123605.3037829-2-stefan.wiehler@nokia.com> (raw)
If the clock-frequency property is not set in the cpu node but in the
parent /cpus node, the following warning is emitted:
/cpus/cpu@X missing clock-frequency property
The devicetree specification in section 3.8 however specifies that
"properties that have identical values across cpu nodes may be placed in
the /cpus node instead. A client program must first examine a specific cpu
node, but if an expected property is not found then it should look at the
parent /cpus node."
Signed-off-by: Stefan Wiehler <stefan.wiehler@nokia.com>
---
arch/arm/kernel/topology.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index ef0058de432b..32fc1c8d9d11 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -85,15 +85,24 @@ static bool cap_from_dt = true;
static void __init parse_dt_topology(void)
{
const struct cpu_efficiency *cpu_eff;
- struct device_node *cn = NULL;
+ struct device_node *pcn = NULL, *cn = NULL;
unsigned long min_capacity = ULONG_MAX;
unsigned long max_capacity = 0;
unsigned long capacity = 0;
int cpu = 0;
+ const __be32 *common_rate;
+ int common_rate_len;
__cpu_capacity = kcalloc(nr_cpu_ids, sizeof(*__cpu_capacity),
GFP_NOWAIT);
+ pcn = of_find_node_by_path("/cpus");
+ if (!pcn) {
+ pr_err("missing CPU root device node\n");
+ return;
+ }
+ common_rate = of_get_property(pcn, "clock-frequency", &common_rate_len);
+
for_each_possible_cpu(cpu) {
const __be32 *rate;
int len;
@@ -121,8 +130,12 @@ static void __init parse_dt_topology(void)
rate = of_get_property(cn, "clock-frequency", &len);
if (!rate || len != 4) {
- pr_err("%pOF missing clock-frequency property\n", cn);
- continue;
+ if (common_rate && common_rate_len == 4) {
+ rate = common_rate;
+ } else {
+ pr_err("%pOF missing clock-frequency property\n", cn);
+ continue;
+ }
}
capacity = ((be32_to_cpup(rate)) >> 20) * cpu_eff->efficiency;
@@ -154,6 +167,8 @@ static void __init parse_dt_topology(void)
if (cap_from_dt)
topology_normalize_cpu_scale();
+
+ of_node_put(pcn);
}
/*
--
2.42.0
next reply other threads:[~2024-02-01 12:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 12:36 Stefan Wiehler [this message]
2024-02-01 13:16 ` Russell King (Oracle)
2024-02-01 13:16 ` Krzysztof Kozlowski
2024-02-01 15:03 ` Stefan Wiehler
2024-02-01 18:04 ` Russell King (Oracle)
2024-02-02 10:58 ` Krzysztof Kozlowski
-- strict thread matches above, loose matches on Subject: below --
2024-01-05 13:00 Stefan Wiehler
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=20240201123605.3037829-2-stefan.wiehler@nokia.com \
--to=stefan.wiehler@nokia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
/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®