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 C75EFC4345F for ; Wed, 1 May 2024 09:27:11 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Kgp9RVKWx1cdElVrqCKrdgpSXGri4LKvnG2fnn39pPA=; b=E5yFa19ZkgOUsv Q5Cdpafn7fMa3xjiWGD7jrvmKUPfjBO4WIM8QmwYK220hVbiKz4SXvMMoZsrWQcvsANjDQrrxKjSa en5kqzyRRt8V7jXXry7EtjPOkaW0Xi6GvRIP39elAkFGQ15aNUgWUZUVx52Imx2w3unx0LyJ9e3Jx zAUyR8xHaCLFhbjbTVb5kuMeI98FhvXEW2kxgoqBsoUVymIbA/+5FVSWlbhiu40v0J0vrlZ5K4YXX eRa8WMk3gXGJNS0k2kkB1APhK3wqxbfSRxwUsXuuGaXcSkaZS3pJRp0D5IoCt9izuP4HE3a1lLW/6 8BZM5/3+ZIS4+c5SMQ6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s26Eu-00000008yY7-3CEN; Wed, 01 May 2024 09:27:00 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s26Em-00000008yWn-0DOQ for linux-arm-kernel@lists.infradead.org; Wed, 01 May 2024 09:26:59 +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 79F022F4; Wed, 1 May 2024 02:27:13 -0700 (PDT) Received: from pluto (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DC4C73F793; Wed, 1 May 2024 02:26:45 -0700 (PDT) Date: Wed, 1 May 2024 10:26:43 +0100 From: Cristian Marussi To: Lukasz Luba Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dietmar.eggemann@arm.com, linux-arm-kernel@lists.infradead.org, sudeep.holla@arm.com, linux-samsung-soc@vger.kernel.org, rafael@kernel.org, viresh.kumar@linaro.org, quic_sibis@quicinc.com Subject: Re: [PATCH 2/2] cpufreq: scmi: Update Energy Model with allowed performance limits Message-ID: References: <20240403162315.1458337-1-lukasz.luba@arm.com> <20240403162315.1458337-3-lukasz.luba@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240403162315.1458337-3-lukasz.luba@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240501_022652_806025_B078141D X-CRM114-Status: GOOD ( 20.53 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Apr 03, 2024 at 05:23:15PM +0100, Lukasz Luba wrote: > The Energy Model (EM) supports performance limits updates. Use the SCMI > notifications to get information from FW about allowed frequency scope for > the CPUs. > > Signed-off-by: Lukasz Luba > --- > drivers/cpufreq/scmi-cpufreq.c | 19 ++++++++++++++++--- > 1 file changed, 16 insertions(+), 3 deletions(-) > > diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c > index d946b7a082584..90c8448578cb1 100644 > --- a/drivers/cpufreq/scmi-cpufreq.c > +++ b/drivers/cpufreq/scmi-cpufreq.c > @@ -185,12 +185,25 @@ static int scmi_limit_notify_cb(struct notifier_block *nb, unsigned long event, > { > struct scmi_data *priv = container_of(nb, struct scmi_data, limit_notify_nb); > struct scmi_perf_limits_report *limit_notify = data; > + unsigned int limit_freq_max_khz, limit_freq_min_khz; > struct cpufreq_policy *policy = priv->policy; > - unsigned int limit_freq_khz; > + struct em_perf_domain *pd; > + int ret; > + > + limit_freq_max_khz = limit_notify->range_max_freq / HZ_PER_KHZ; > + limit_freq_min_khz = limit_notify->range_min_freq / HZ_PER_KHZ; Note that these values could be zeroed if the notification is good but the range_min/range_max values could NOT be mapped to a frequency equivalent (due to some FW errors). I would probably have to add a warn about this error in the core SCMI notification path (or drop the notif as a whole); if not here you could end-up just setting max/min to 0 if the fw has messed up the notification range_min/range_max. Or is it just that, especially max_feq = 0 is NOT plausible value and you will need anyway to check it here ? > > - limit_freq_khz = limit_notify->range_max_freq / HZ_PER_KHZ; > + pd = em_cpu_get(policy->cpu); > + if (pd) { > + ret = em_update_performance_limits(pd, limit_freq_min_khz, > + limit_freq_max_khz); > + if (ret) > + dev_warn(priv->cpu_dev, > + "EM perf limits update failed\n"); > + } > > - policy->max = clamp(limit_freq_khz, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq); > + policy->max = clamp(limit_freq_max_khz, policy->cpuinfo.min_freq, > + policy->cpuinfo.max_freq); FWIW, regarding the SCMI bits. LGTM. Reviewed-by: Cristian Marussi Thanks, Cristian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel