public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Paul Kocialkowski <paulk@sys-base.io>
To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: Russell King <linux@armlinux.org.uk>,
	Ingo Molnar <mingo@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Maxime Ripard <mripard@kernel.org>,
	Paul Kocialkowski <contact@paulk.fr>
Subject: Re: [PATCH] ARM: topology: Allow missing CPU clock-frequency device-tree property
Date: Fri, 1 Nov 2024 12:07:41 +0100	[thread overview]
Message-ID: <ZyS2fZeIuK2Zuu2l@collins> (raw)
In-Reply-To: <20240929181936.644910-1-paulk@sys-base.io>

[-- Attachment #1: Type: text/plain, Size: 2388 bytes --]

Hi!

Le Sun 29 Sep 24, 20:19, Paul Kocialkowski a écrit :
> Allow the fallback mechanism to continue by assuming the same nominal
> frequency for all CPU cores, while still benefiting from the static
> coefficient provided by the compatible-driven table entries.
> This is similar to what is done in the common arch topology code when
> it fails to find a clock to get the frequency from.

Any thoughts about this patch?

Thanks!

Paul

> The ranging mechanism (using the middle capacity) is unaffected by
> the use of a unit frequency and still returns values in the requested
> range.
> 
> Also add a comment to clarify what is going on.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> ---
>  arch/arm/kernel/topology.c | 22 ++++++++++++++++------
>  1 file changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
> index 2336ee2aa44a..0eb743c65166 100644
> --- a/arch/arm/kernel/topology.c
> +++ b/arch/arm/kernel/topology.c
> @@ -119,13 +119,23 @@ static void __init parse_dt_topology(void)
>  		if (cpu_eff->compatible == NULL)
>  			continue;
>  
> +		/*
> +		 * Use the legacy clock-frequency property (representing the
> +		 * maximum achievable clock frequency) as an efficiency
> +		 * coefficient (divided by 2^20, roughly 1 MHz) to the table
> +		 * value. If no such property is available, use the table value
> +		 * directly and assume all CPUs are running at the same
> +		 * nominal frequency.
> +		 *
> +		 * It is assumed that clock-frequency is either provided for all
> +		 * CPUs or for none of them.
> +		 */
>  		rate = of_get_property(cn, "clock-frequency", &len);
> -		if (!rate || len != 4) {
> -			pr_err("%pOF missing clock-frequency property\n", cn);
> -			continue;
> -		}
> -
> -		capacity = ((be32_to_cpup(rate)) >> 20) * cpu_eff->efficiency;
> +		if (rate && len == 4)
> +			capacity = ((be32_to_cpup(rate)) >> 20) *
> +				   cpu_eff->efficiency;
> +		else
> +			capacity = cpu_eff->efficiency;
>  
>  		/* Save min capacity of the system */
>  		if (capacity < min_capacity)
> -- 
> 2.46.2
> 
> 

-- 
Paul Kocialkowski,

Independent contractor - sys-base - https://www.sys-base.io/
Free software developer - https://www.paulk.fr/

Specialist in multimedia, graphics and embedded hardware support with Linux.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2024-11-01 11:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-29 18:19 [PATCH] ARM: topology: Allow missing CPU clock-frequency device-tree property Paul Kocialkowski
2024-11-01 11:07 ` Paul Kocialkowski [this message]

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=ZyS2fZeIuK2Zuu2l@collins \
    --to=paulk@sys-base.io \
    --cc=arnd@arndb.de \
    --cc=contact@paulk.fr \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mingo@kernel.org \
    --cc=mripard@kernel.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