Skip to contentSkip to conversation

SCMI performance protocol power scale interface

PATCH Applied Lukasz Luba 3 participants 9 messages Nov 24, 2020 – Dec 8, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover SCMI performance protocol power scale interface

Hi all,

The Energy Model (EM) supports power values expressed in an abstract scale via new API. The SCMI performance protocol provides the information about power scale. This patch set implements the needed interface and updates cpufreq driver to set the right scale in the EM.

It is based on top of patch series adding milli-Watts flag in EM [1] (next-20201124 was used as a base).

Regards,
Lukasz

[1] https://lore.kernel.org/linux-pm/[email protected]/

Lukasz Luba (2):
firmware: arm_scmi: Add power_scale_mw_get() interface
cpufreq: arm_scmi: Discover the power scale in performance protocol

 drivers/cpufreq/scmi-cpufreq.c   | 4 +++-
 drivers/firmware/arm_scmi/perf.c | 8 ++++++++
 include/linux/scmi_protocol.h    | 1 +
 3 files changed, 12 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 firmware: arm_scmi: Add power_scale_mw_get() interface

Add a new interface to the existing perf_ops and export the information about the power values scale.

This would be used by the cpufreq driver and Energy Model framework to set the performance domains scale: milli-Watts or abstract scale.

---
 drivers/firmware/arm_scmi/perf.c | 8 ++++++++
 include/linux/scmi_protocol.h    | 1 +
 2 files changed, 9 insertions(+)
drivers/firmware/arm_scmi/perf.c +8 -0
index 82fb3babff72..e374b1125fca 100644
@@ -750,6 +750,13 @@ static bool scmi_fast_switch_possible(const struct scmi_handle *handle,
 	return dom->fc_info && dom->fc_info->level_set_addr;
 }
 
+static bool scmi_power_scale_mw_get(const struct scmi_handle *handle)
+{
+	struct scmi_perf_info *pi = handle->perf_priv;
+
+	return pi->power_scale_mw;
+}
+
 static const struct scmi_perf_ops perf_ops = {
 	.limits_set = scmi_perf_limits_set,
 	.limits_get = scmi_perf_limits_get,
@@ -762,6 +769,7 @@ static const struct scmi_perf_ops perf_ops = {
 	.freq_get = scmi_dvfs_freq_get,
 	.est_power_get = scmi_dvfs_est_power_get,
 	.fast_switch_possible = scmi_fast_switch_possible,
+	.power_scale_mw_get = scmi_power_scale_mw_get,
 };
 
 static int scmi_perf_set_notify_enabled(const struct scmi_handle *handle,
include/linux/scmi_protocol.h +1 -0
index dd9e94849fc1..ecb3aad1a964 100644
@@ -122,6 +122,7 @@ struct scmi_perf_ops {
 			     unsigned long *rate, unsigned long *power);
 	bool (*fast_switch_possible)(const struct scmi_handle *handle,
 				     struct device *dev);
+	bool (*power_scale_mw_get)(const struct scmi_handle *handle);
 };
 
 /**
Signature · 1 line
2.17.1
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] firmware: arm_scmi: Add power_scale_mw_get() interface

Quoted 6 lines · Lukasz Luba

Add a new interface to the existing perf_ops and export the information about the power values scale.

This would be used by the cpufreq driver and Energy Model framework to set the performance domains scale: milli-Watts or abstract scale.

Looks good to me. I saw this after I sent pull request this afternoon. In case you want to take it via PM tree:

Signature · 7 lines
Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#3 lore raw

Re: [PATCH 1/2] firmware: arm_scmi: Add power_scale_mw_get() interface

Quoted 4 lines · Sudeep Holla
Quoted 3 lines · Lukasz Luba

Add a new interface to the existing perf_ops and export the information about the power values scale.

Quoted 9 lines
Quoted 3 lines

This would be used by the cpufreq driver and Energy Model framework to set the performance domains scale: milli-Watts or abstract scale.

Looks good to me. I saw this after I sent pull request this afternoon. In case you want to take it via PM tree:

Thank you Sudeep!

Regards,
Lukasz

#4 lore raw

PATCH 2/2 cpufreq: arm_scmi: Discover the power scale in performance protocol

In reply to Lukasz Luba

Add mechanism to discover the power scale present in the performance protocol for all domains. Provide this information to Energy Model, which then can be checked in other frameworks, e.g. thermal.

---
 drivers/cpufreq/scmi-cpufreq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/cpufreq/scmi-cpufreq.c +3 -1
index dfd87752f054..491a0a24fb1e 100644
@@ -126,6 +126,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy)
 	struct scmi_data *priv;
 	struct cpufreq_frequency_table *freq_table;
 	struct em_data_callback em_cb = EM_DATA_CB(scmi_get_cpu_power);
+	bool power_scale_mw;
 
 	cpu_dev = get_cpu_device(policy->cpu);
 	if (!cpu_dev) {
@@ -189,8 +190,9 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy)
 	policy->fast_switch_possible =
 		handle->perf_ops->fast_switch_possible(handle, cpu_dev);
 
+	power_scale_mw = handle->perf_ops->power_scale_mw_get(handle);
 	em_dev_register_perf_domain(cpu_dev, nr_opp, &em_cb, policy->cpus,
-				    false);
+				    power_scale_mw);
 
 	return 0;
 
Signature · 1 line
2.17.1
#5 lore raw
In reply to Lukasz Luba

Hi Rafael,

Quoted 15 lines · Lukasz Luba

Hi all,

The Energy Model (EM) supports power values expressed in an abstract scale via new API. The SCMI performance protocol provides the information about power scale. This patch set implements the needed interface and updates cpufreq driver to set the right scale in the EM.

It is based on top of patch series adding milli-Watts flag in EM [1] (next-20201124 was used as a base).

Regards,
Lukasz

[1] https://lore.kernel.org/linux-pm/[email protected]/

Quoted 9 lines

Lukasz Luba (2):
firmware: arm_scmi: Add power_scale_mw_get() interface
cpufreq: arm_scmi: Discover the power scale in performance protocol

  drivers/cpufreq/scmi-cpufreq.c   | 4 +++-
  drivers/firmware/arm_scmi/perf.c | 8 ++++++++
  include/linux/scmi_protocol.h    | 1 +
  3 files changed, 12 insertions(+), 1 deletion(-)

Could you take this patch set, please?

Patch 1/2, which is ARM firmware protocol change, got ACK from Sudeep in case it would go via your PM tree.

The patch series is a follow up to the EM changes, which you have taken recently into your PM tree (link in the cover letter above).

Regards,
Lukasz

maintainer Acked-by on the v1 series
#6 lore raw
In reply to Lukasz Luba
Quoted 15 lines · Lukasz Luba

Hi all,

The Energy Model (EM) supports power values expressed in an abstract scale via new API. The SCMI performance protocol provides the information about power scale. This patch set implements the needed interface and updates cpufreq driver to set the right scale in the EM.

It is based on top of patch series adding milli-Watts flag in EM [1] (next-20201124 was used as a base).

Regards,
Lukasz

[1] https://lore.kernel.org/linux-pm/[email protected]/

Quoted 8 lines

Lukasz Luba (2):
firmware: arm_scmi: Add power_scale_mw_get() interface
cpufreq: arm_scmi: Discover the power scale in performance protocol

 drivers/cpufreq/scmi-cpufreq.c   | 4 +++-
 drivers/firmware/arm_scmi/perf.c | 8 ++++++++
 include/linux/scmi_protocol.h    | 1 +
 3 files changed, 12 insertions(+), 1 deletion(-)
Signature · 1 line
viresh
maintainer Applied
#7 lore raw
Quoted 20 lines · Viresh Kumar
Quoted 19 lines · Lukasz Luba

Hi all,

The Energy Model (EM) supports power values expressed in an abstract scale via new API. The SCMI performance protocol provides the information about power scale. This patch set implements the needed interface and updates cpufreq driver to set the right scale in the EM.

It is based on top of patch series adding milli-Watts flag in EM [1] (next-20201124 was used as a base).

Regards,
Lukasz

[1] https://lore.kernel.org/linux-pm/[email protected]/

Lukasz Luba (2):
firmware: arm_scmi: Add power_scale_mw_get() interface
cpufreq: arm_scmi: Discover the power scale in performance protocol

Quoted 6 lines
Quoted 4 lines
 drivers/cpufreq/scmi-cpufreq.c   | 4 +++-
 drivers/firmware/arm_scmi/perf.c | 8 ++++++++
 include/linux/scmi_protocol.h    | 1 +
 3 files changed, 12 insertions(+), 1 deletion(-)

More scmi stuff came in which I had to apply and so I applied this to the ARM tree.

Rafael: I had to rebase this over one of the patches from your tree, which was based on rc3:

commit c250d50fe2ce ("PM: EM: Add a flag indicating units of power values in Energy Model")

I hope you won't rebase it any further.

Applied. Thanks.

Signature · 1 line
viresh
#8 lore raw
Quoted 31 lines · Viresh Kumar
Quoted 20 lines · Viresh Kumar
Quoted 19 lines · Lukasz Luba

Hi all,

The Energy Model (EM) supports power values expressed in an abstract scale via new API. The SCMI performance protocol provides the information about power scale. This patch set implements the needed interface and updates cpufreq driver to set the right scale in the EM.

It is based on top of patch series adding milli-Watts flag in EM [1] (next-20201124 was used as a base).

Regards,
Lukasz

[1] https://lore.kernel.org/linux-pm/[email protected]/

Lukasz Luba (2):
firmware: arm_scmi: Add power_scale_mw_get() interface
cpufreq: arm_scmi: Discover the power scale in performance protocol

Quoted 6 lines
Quoted 4 lines
  drivers/cpufreq/scmi-cpufreq.c   | 4 +++-
  drivers/firmware/arm_scmi/perf.c | 8 ++++++++
  include/linux/scmi_protocol.h    | 1 +
  3 files changed, 12 insertions(+), 1 deletion(-)

More scmi stuff came in which I had to apply and so I applied this to the ARM tree.

Quoted 9 lines

Rafael: I had to rebase this over one of the patches from your tree, which was based on rc3:

commit c250d50fe2ce ("PM: EM: Add a flag indicating units of power values in Energy Model")

I hope you won't rebase it any further.

Applied. Thanks.

Thank you Viresh!

Regards,
Lukasz