linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V3 0/9] Add callback to register with energy model
@ 2021-08-12  4:35 Viresh Kumar
  2021-08-12  4:35 ` [PATCH V3 6/9] cpufreq: qcom-cpufreq-hw: Use .register_em() " Viresh Kumar
  2021-08-31  8:54 ` [PATCH V3 0/9] Add callback " Dietmar Eggemann
  0 siblings, 2 replies; 3+ messages in thread
From: Viresh Kumar @ 2021-08-12  4:35 UTC (permalink / raw)
  To: Rafael Wysocki, Vincent Donnefort, lukasz.luba, Quentin Perret,
	Andy Gross, Bjorn Andersson, Cristian Marussi, Fabio Estevam,
	Kevin Hilman, Matthias Brugger, NXP Linux Team,
	Pengutronix Kernel Team, Sascha Hauer, Shawn Guo, Sudeep Holla,
	Viresh Kumar
  Cc: linux-pm, Vincent Guittot, linux-arm-kernel, linux-arm-msm,
	linux-kernel, linux-mediatek, linux-omap

Many cpufreq drivers register with the energy model for each policy and
do exactly the same thing. Follow the footsteps of thermal-cooling, to
get it done from the cpufreq core itself.

Provide a new callback, which will be called, if present, by the cpufreq
core at the right moment (more on that in the code's comment). Also
provide a generic implementation that uses dev_pm_opp_of_register_em().

This also allows us to register with the EM at a later point of time,
compared to ->init(), from where the EM core can access cpufreq policy
directly using cpufreq_cpu_get() type of helpers and perform other work,
like marking few frequencies inefficient, this will be done separately.

This is build/boot tested by the bot for a couple of boards.

https://gitlab.com/vireshk/pmko/-/pipelines/351965580

FWIW, I have queued up the series for linux-next to get more testing, but your
reviews are welcome. Thanks.

V2->V3:
- Drop the auto-register part from all logs, this isn't called auto registration
  anymore.
- Call register_em() only for new policies.
- Update scmi driver to register with EM only when required.
- Add Rby tags.

V1->V2:
- Add a callback instead of flag.
- Register before governor is initialized.
- Update scmi driver as well.
- Don't unregister from the EM core.

--
Viresh

Viresh Kumar (9):
  cpufreq: Add callback to register with energy model
  cpufreq: dt: Use .register_em() to register with energy model
  cpufreq: imx6q: Use .register_em() to register with energy model
  cpufreq: mediatek: Use .register_em() to register with energy model
  cpufreq: omap: Use .register_em() to register with energy model
  cpufreq: qcom-cpufreq-hw: Use .register_em() to register with energy
    model
  cpufreq: scpi: Use .register_em() to register with energy model
  cpufreq: vexpress: Use .register_em() to register with energy model
  cpufreq: scmi: Use .register_em() to register with energy model

 drivers/cpufreq/cpufreq-dt.c           |  3 +-
 drivers/cpufreq/cpufreq.c              | 13 ++++++
 drivers/cpufreq/imx6q-cpufreq.c        |  2 +-
 drivers/cpufreq/mediatek-cpufreq.c     |  3 +-
 drivers/cpufreq/omap-cpufreq.c         |  2 +-
 drivers/cpufreq/qcom-cpufreq-hw.c      |  3 +-
 drivers/cpufreq/scmi-cpufreq.c         | 65 +++++++++++++++++---------
 drivers/cpufreq/scpi-cpufreq.c         |  3 +-
 drivers/cpufreq/vexpress-spc-cpufreq.c |  3 +-
 include/linux/cpufreq.h                | 14 ++++++
 10 files changed, 76 insertions(+), 35 deletions(-)

-- 
2.31.1.272.g89b43f80a514


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH V3 6/9] cpufreq: qcom-cpufreq-hw: Use .register_em() to register with energy model
  2021-08-12  4:35 [PATCH V3 0/9] Add callback to register with energy model Viresh Kumar
@ 2021-08-12  4:35 ` Viresh Kumar
  2021-08-31  8:54 ` [PATCH V3 0/9] Add callback " Dietmar Eggemann
  1 sibling, 0 replies; 3+ messages in thread
From: Viresh Kumar @ 2021-08-12  4:35 UTC (permalink / raw)
  To: Rafael Wysocki, Vincent Donnefort, lukasz.luba, Quentin Perret,
	Andy Gross, Bjorn Andersson, Viresh Kumar
  Cc: linux-pm, Vincent Guittot, linux-arm-msm, linux-kernel

Set the newly added .register_em() callback with
cpufreq_register_em_with_opp() to register with the EM core.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/qcom-cpufreq-hw.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
index f86859bf76f1..c2e71c430fbf 100644
--- a/drivers/cpufreq/qcom-cpufreq-hw.c
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -362,8 +362,6 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
 		goto error;
 	}
 
-	dev_pm_opp_of_register_em(cpu_dev, policy->cpus);
-
 	if (policy_has_boost_freq(policy)) {
 		ret = cpufreq_enable_boost_support();
 		if (ret)
@@ -412,6 +410,7 @@ static struct cpufreq_driver cpufreq_qcom_hw_driver = {
 	.get		= qcom_cpufreq_hw_get,
 	.init		= qcom_cpufreq_hw_cpu_init,
 	.exit		= qcom_cpufreq_hw_cpu_exit,
+	.register_em	= cpufreq_register_em_with_opp,
 	.fast_switch    = qcom_cpufreq_hw_fast_switch,
 	.name		= "qcom-cpufreq-hw",
 	.attr		= qcom_cpufreq_hw_attr,
-- 
2.31.1.272.g89b43f80a514


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V3 0/9] Add callback to register with energy model
  2021-08-12  4:35 [PATCH V3 0/9] Add callback to register with energy model Viresh Kumar
  2021-08-12  4:35 ` [PATCH V3 6/9] cpufreq: qcom-cpufreq-hw: Use .register_em() " Viresh Kumar
@ 2021-08-31  8:54 ` Dietmar Eggemann
  1 sibling, 0 replies; 3+ messages in thread
From: Dietmar Eggemann @ 2021-08-31  8:54 UTC (permalink / raw)
  To: Viresh Kumar, Rafael Wysocki, Vincent Donnefort, lukasz.luba,
	Quentin Perret, Andy Gross, Bjorn Andersson, Cristian Marussi,
	Fabio Estevam, Kevin Hilman, Matthias Brugger, NXP Linux Team,
	Pengutronix Kernel Team, Sascha Hauer, Shawn Guo, Sudeep Holla
  Cc: linux-pm, Vincent Guittot, linux-arm-kernel, linux-arm-msm,
	linux-kernel, linux-mediatek, linux-omap

On 12/08/2021 06:35, Viresh Kumar wrote:
> Many cpufreq drivers register with the energy model for each policy and
> do exactly the same thing. Follow the footsteps of thermal-cooling, to
> get it done from the cpufreq core itself.
> 
> Provide a new callback, which will be called, if present, by the cpufreq
> core at the right moment (more on that in the code's comment). Also
> provide a generic implementation that uses dev_pm_opp_of_register_em().
> 
> This also allows us to register with the EM at a later point of time,
> compared to ->init(), from where the EM core can access cpufreq policy
> directly using cpufreq_cpu_get() type of helpers and perform other work,
> like marking few frequencies inefficient, this will be done separately.
> 
> This is build/boot tested by the bot for a couple of boards.
> 
> https://gitlab.com/vireshk/pmko/-/pipelines/351965580
> 
> FWIW, I have queued up the series for linux-next to get more testing, but your
> reviews are welcome. Thanks.
> 
> V2->V3:
> - Drop the auto-register part from all logs, this isn't called auto registration
>   anymore.
> - Call register_em() only for new policies.
> - Update scmi driver to register with EM only when required.
> - Add Rby tags.

LGTM. Tested on TC2 (vexpress-spc), Juno-r0 (scpi-cpufreq and scmi).

Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-31  8:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12  4:35 [PATCH V3 0/9] Add callback to register with energy model Viresh Kumar
2021-08-12  4:35 ` [PATCH V3 6/9] cpufreq: qcom-cpufreq-hw: Use .register_em() " Viresh Kumar
2021-08-31  8:54 ` [PATCH V3 0/9] Add callback " Dietmar Eggemann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).