public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Cristian Marussi <cristian.marussi@arm.com>
To: Sudeep Holla <sudeep.holla@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Pierre Gondois <Pierre.Gondois@arm.com>
Subject: Re: [PATCH] firmware: arm_scmi: Warn if domain frequency multiplier is 0 or rounded off
Date: Fri, 19 Jan 2024 14:06:56 +0000	[thread overview]
Message-ID: <ZaqB7r7br0XlMsXU@pluto> (raw)
In-Reply-To: <20240119111033.3011853-1-sudeep.holla@arm.com>

On Fri, Jan 19, 2024 at 11:10:33AM +0000, Sudeep Holla wrote:
> When (sustained_freq_khz * 1000) is less than sustained_perf_level, the
> multiplier will be less than 1 and hence rounded down as 0. Similarly if
> it is not multiple of sustained_perf_level the dom_info->mult_factor will
> contain rounded down value and will end up impacting all the frequency
> calculations done using it.
> 
> Add warning if and when the domain frequency multiplier is 0 or rounded
> down so that it gives a clue to get the firmware tables fixed.
> 

Hi,

just one small nitpick down below...

> Suggested-by: Pierre Gondois <Pierre.Gondois@arm.com>
> Cc: Cristian Marussi <cristian.marussi@arm.com>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/firmware/arm_scmi/perf.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
> index 8ea2a7b3d35d..5a7358e89d6f 100644
> --- a/drivers/firmware/arm_scmi/perf.c
> +++ b/drivers/firmware/arm_scmi/perf.c
> @@ -272,13 +272,21 @@ scmi_perf_domain_attributes_get(const struct scmi_protocol_handle *ph,
>  					le32_to_cpu(attr->sustained_perf_level);
>  		if (!dom_info->sustained_freq_khz ||
>  		    !dom_info->sustained_perf_level ||
> -		    dom_info->level_indexing_mode)
> +		    dom_info->level_indexing_mode) {
>  			/* CPUFreq converts to kHz, hence default 1000 */
>  			dom_info->mult_factor =	1000;
> -		else
> +		} else {
>  			dom_info->mult_factor =
>  					(dom_info->sustained_freq_khz * 1000UL)
>  					/ dom_info->sustained_perf_level;
> +			if ((dom_info->sustained_freq_khz * 1000UL) %
> +			    dom_info->sustained_perf_level)
> +				pr_warn("mult_factor of domain %d is rounded\n",
> +					dom_info->id);

...here you can use dev_warn(ph->dev, ...) if you want.

Other than that, LGTM.

Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>

Thanks,
Cristian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2024-01-19 14:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19 11:10 [PATCH] firmware: arm_scmi: Warn if domain frequency multiplier is 0 or rounded off Sudeep Holla
2024-01-19 14:05 ` Pierre Gondois
2024-01-19 14:43   ` Sudeep Holla
2024-01-19 14:06 ` Cristian Marussi [this message]
2024-01-19 14:45   ` Sudeep Holla
2024-01-19 15:23 ` [PATCH v2] " Sudeep Holla
2024-01-19 15:26   ` Cristian Marussi
2024-02-22  7:50   ` Sudeep Holla

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=ZaqB7r7br0XlMsXU@pluto \
    --to=cristian.marussi@arm.com \
    --cc=Pierre.Gondois@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=sudeep.holla@arm.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