From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5A41AC4725D for ; Fri, 19 Jan 2024 14:05:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZgkeDG2sU49XmR0KVbabYMXzEIRLViyuGj58fPBq/OE=; b=23ALwAB774a1o9 YGshQnbTsDwoKmNd2nAMUXqDkPyBEGeConcxXMBfjxeUys68Rs362UuvISPBHTNWjaXmxmUOePDER x8Tke9liIcgQZHxW2wdUIG4KIN5AhN3VdZunV9Q4tR7xExv/X0FyI+DxYHs5tHdrOETGnmK8jqWZ5 jrKpwy5Y5izrdKUmJnwfTrxVJBEEeMl+AsZKDmyju9lAjvwcEfw1nK0D/xHdop6z7/fm5EOs2lt80 L70sfWOkQ2GWQ/DWNrkx8W1FgyLMMt4BlgXeMv4X6GRmAAa/M/CCNk2XGB2uNNtSkIPLZtKVDey0g deu7R4F/ifrOS33BBeCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQpUr-005nHh-2p; Fri, 19 Jan 2024 14:05:25 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQpUn-005nGL-0h for linux-arm-kernel@lists.infradead.org; Fri, 19 Jan 2024 14:05:23 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8EDE51042; Fri, 19 Jan 2024 06:06:02 -0800 (PST) Received: from [10.57.48.23] (unknown [10.57.48.23]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B16D53F73F; Fri, 19 Jan 2024 06:05:15 -0800 (PST) Message-ID: <30b94dac-3c49-4bec-9803-2ff058f0fb0a@arm.com> Date: Fri, 19 Jan 2024 15:05:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] firmware: arm_scmi: Warn if domain frequency multiplier is 0 or rounded off To: Sudeep Holla , linux-arm-kernel@lists.infradead.org Cc: Cristian Marussi References: <20240119111033.3011853-1-sudeep.holla@arm.com> Content-Language: en-US From: Pierre Gondois In-Reply-To: <20240119111033.3011853-1-sudeep.holla@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240119_060521_850127_78F9A1E5 X-CRM114-Status: GOOD ( 18.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello Sudeep, Thanks for the patch. Just to add a note, it means that the firmware must have freq and level values such as: - freq = K * level - K >= 1 - K being an integer If K is not an integer, the bigger K is, the lower the imprecision in the available frequencies is. Having imprecise frequency values did not impact the frequency changes when I tried it. Reviewed-by: Pierre Gondois On 1/19/24 12:10, 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. > > Suggested-by: Pierre Gondois > Cc: Cristian Marussi > Signed-off-by: Sudeep Holla > --- > 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); > + } > + if (!dom_info->mult_factor) > + pr_warn("Incorrect sustained perf level or freq kHz\n"); > + > strscpy(dom_info->info.name, attr->name, > SCMI_SHORT_NAME_MAX_SIZE); > } _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel