Message ID | 20240222135702.2005635-4-pierre.gondois@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-76650-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp266415dyb; Thu, 22 Feb 2024 05:58:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUXBNsmGWCRqXzRUAFVTxRz5eyEqln0VxQn0vjqJlpd9YBXOfgfUTSma6EJcMZAuakAkCQUWNMMC62hibrtqmiC9LDs6A== X-Google-Smtp-Source: AGHT+IErr1g3yC9Q/4bR74JAtdXIBoAamwUH7U6Er4PJgtA3fGu+ZnH6Y4RN8N5YWsunLIRk8Fpm X-Received: by 2002:a17:906:e1b:b0:a3f:3aac:7c33 with SMTP id l27-20020a1709060e1b00b00a3f3aac7c33mr3406141eji.4.1708610291110; Thu, 22 Feb 2024 05:58:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708610291; cv=pass; d=google.com; s=arc-20160816; b=SdZIgC82RVKSBOYIyeDs6MMr+BiDHyVIwxEivEyGtU3gHF9BpeOukaq1vE+aL9xOHO YSHLh6EUfqzgO19qkQd2Fmfr5ViuQ/w+CY7bG4Sh34QCK03pxC+UQ6VthtjtjeUJqPBt 3rRAnyYqz2fj4CsJGnFTKpiPEg1FN5XsFBCAD6TxHnTkOF/xrzKakLLW+9Vt+5ZQPJ8a NACXDOXnEfOl9P/f0s05cLjNSlPeG34xovY047h4gUKxS1bH/iQHjycYdXNXgJ6pM4wf 4WoIHgcuDyG9AzfZguH5A/0/0V7WjdKhH1RSG5WH0sLWPCo7/civvuetT1SmL6Z1z4JP vZHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=ScCu82NGV5x0H263ooRTiEiKta95SsWcogkCtv68fMU=; fh=ZBLo0Bh4LFitYpS/+DmoADsEZVbUpedYHilAKTvSVoY=; b=Z+3BnOZGihn/W/NiRdKFrh+ZipprudCOkLWKhchgUglNlW+3s09tRf+R9CIh+iTom6 NYFOZaIr/vZQx01s8giSy1bD9pu3M+vjoQAXurVvJpQ8oYvsUdosL/kRbC7skUjOxJSv kUReN+BCyoUTP/16cBZehjNiJFn/bGgI17MoWMmtoG6ye4rBIRvfjeFvuxa7qR9slR8o AjXoGHItn/iGo5WyyGYDEpuLRoCPJajv94bYVJsihiZCyCzo2CgRjiX7oxRIxnK76ipD MudPfZ0c0Qya6pF08bBnAGtcMuGH514plzTkEGwxLwUZR7KY98ftn6njBuvr9CutALnK aHNg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-76650-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76650-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a20-20020a170906685400b00a3f795290f7si719166ejs.645.2024.02.22.05.58.10 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 05:58:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76650-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-76650-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76650-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B5BD11F2510F for <ouuuleilei@gmail.com>; Thu, 22 Feb 2024 13:58:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 206771487E1; Thu, 22 Feb 2024 13:57:24 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F35A1474C1; Thu, 22 Feb 2024 13:57:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708610242; cv=none; b=KYJzgxKiO2MBQ1aAAeTSzukZ8Q1OpNVpkzNALYAhLnRM0t6YEYxWkLFXtE56x3qbwKGhUZnQyY8JROm0ue26pTzF9xz3hR7eUQeZHkFezgeqzlM5KxWwEnYiRVvXuuH+VQsAe5Jr93QyWgCNj9UtRWVysmMaQmepUMnw6atKdu0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708610242; c=relaxed/simple; bh=+gm91ZtyDofHjM2c3cnsnbGIdaQIAtNdEWIE4qR/lL4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TSlJEyo3bWGclTIMNMLE8SMll0EAk/cP4wF0ZZ+d+RvbClSCxy6lRKn9fW1t9SaXwrrr/0BDe7GkbBnYj7tRfRtTynJKapn6enbR8gh6r6P3NVU4vsVVteYJslHtPW+wailNrZ4+V9XwUc7dar+HwtYS/aOkfgxdf77SYZg/ZvA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 4934B1007; Thu, 22 Feb 2024 05:57:59 -0800 (PST) Received: from e126645.arm.com (unknown [10.57.50.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 946493F762; Thu, 22 Feb 2024 05:57:18 -0800 (PST) From: Pierre Gondois <pierre.gondois@arm.com> To: linux-kernel@vger.kernel.org Cc: Cristian Marussi <cristian.marussi@arm.com>, Christian Loehle <christian.loehle@arm.com>, Ionela Voinescu <ionela.voinescu@arm.com>, Sudeep Holla <sudeep.holla@arm.com>, Dietmar Eggemann <dietmar.eggemann@arm.com>, Pierre Gondois <pierre.gondois@arm.com>, "Rafael J. Wysocki" <rafael@kernel.org>, Viresh Kumar <viresh.kumar@linaro.org>, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH 3/3] cpufreq: scmi: Set transition_delay_us Date: Thu, 22 Feb 2024 14:57:01 +0100 Message-Id: <20240222135702.2005635-4-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240222135702.2005635-1-pierre.gondois@arm.com> References: <20240222135702.2005635-1-pierre.gondois@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791607744485111106 X-GMAIL-MSGID: 1791607744485111106 |
Series |
[1/3] firmware: arm_scmi: Populate perf commands rate_limit
|
|
Commit Message
Pierre Gondois
Feb. 22, 2024, 1:57 p.m. UTC
Make use of the newly added callbacks:
- rate_limit_get()
- fast_switch_rate_limit()
to populate policies's `transition_delay_us`, defined as the
'Preferred average time interval between consecutive
invocations of the driver to set the frequency for this policy.'
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
---
drivers/cpufreq/scmi-cpufreq.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
Comments
On Thu, Feb 22, 2024 at 02:57:01PM +0100, Pierre Gondois wrote: > Make use of the newly added callbacks: > - rate_limit_get() > - fast_switch_rate_limit() > to populate policies's `transition_delay_us`, defined as the > 'Preferred average time interval between consecutive > invocations of the driver to set the frequency for this policy.' > > Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> > --- > drivers/cpufreq/scmi-cpufreq.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > Hi, > diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c > index 4ee23f4ebf4a..0b483bd0d3ca 100644 > --- a/drivers/cpufreq/scmi-cpufreq.c > +++ b/drivers/cpufreq/scmi-cpufreq.c > @@ -144,6 +144,29 @@ scmi_get_cpu_power(struct device *cpu_dev, unsigned long *power, > return 0; > } > > +static int > +scmi_get_rate_limit(u32 domain, bool has_fast_switch) > +{ > + int ret, rate_limit; > + > + if (has_fast_switch) { > + /* > + * Fast channels are used whenever available, > + * so use their rate_limit value if populated. > + */ > + ret = perf_ops->fast_switch_rate_limit(ph, domain, > + &rate_limit); > + if (!ret && rate_limit) > + return rate_limit; > + } > + > + ret = perf_ops->rate_limit_get(ph, domain, &rate_limit); > + if (ret) > + return 0; > + > + return rate_limit; > +} > + > static int scmi_cpufreq_init(struct cpufreq_policy *policy) > { > int ret, nr_opp, domain; > @@ -250,6 +273,9 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy) > policy->fast_switch_possible = > perf_ops->fast_switch_possible(ph, domain); > > + policy->transition_delay_us = > + scmi_get_rate_limit(domain, policy->fast_switch_possible); > + > return 0; > As a second thought, I have just realized that now we have 2 ops to get the rate_limit for a domain, one used in case of FCs and another in case of std messaging w/out FCs, BUT given that we always use FCs when available, AND we do not indeed have any way from perf_ops to explicitly request a set/get ops NOT to use FCs when available, does it even make sense to expose such 2 functions ? Do we need such flexibility ? Shouldn't we just expose one single rate_limit perf_ops and let the SCMI core decide what to return depending on the presence or not of the FCs for that domain ? Maybe @Sudeep thinks differently. Thanks, Cristian
diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 4ee23f4ebf4a..0b483bd0d3ca 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -144,6 +144,29 @@ scmi_get_cpu_power(struct device *cpu_dev, unsigned long *power, return 0; } +static int +scmi_get_rate_limit(u32 domain, bool has_fast_switch) +{ + int ret, rate_limit; + + if (has_fast_switch) { + /* + * Fast channels are used whenever available, + * so use their rate_limit value if populated. + */ + ret = perf_ops->fast_switch_rate_limit(ph, domain, + &rate_limit); + if (!ret && rate_limit) + return rate_limit; + } + + ret = perf_ops->rate_limit_get(ph, domain, &rate_limit); + if (ret) + return 0; + + return rate_limit; +} + static int scmi_cpufreq_init(struct cpufreq_policy *policy) { int ret, nr_opp, domain; @@ -250,6 +273,9 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy) policy->fast_switch_possible = perf_ops->fast_switch_possible(ph, domain); + policy->transition_delay_us = + scmi_get_rate_limit(domain, policy->fast_switch_possible); + return 0; out_free_opp: