Skip to content

Commit b56a352

Browse files
lukaszluba-armrafaeljw
authored andcommitted
PM: EM: Update Energy Model with new flag indicating power scale
Update description and meaning of a new flag, which indicates the type of power scale used for a registered Energy Model (EM) device. Reviewed-by: Quentin Perret <qperret@google.com> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent f2c90b1 commit b56a352

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

Documentation/power/energy-model.rst

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ These subsystems are more interested in estimation of power used in the past,
3030
thus the real milli-Watts might be needed. An example of these requirements can
3131
be found in the Intelligent Power Allocation in
3232
Documentation/driver-api/thermal/power_allocator.rst.
33+
Kernel subsystems might implement automatic detection to check whether EM
34+
registered devices have inconsistent scale (based on EM internal flag).
3335
Important thing to keep in mind is that when the power values are expressed in
3436
an 'abstract scale' deriving real energy in milli-Joules would not be possible.
3537

@@ -86,14 +88,18 @@ Drivers are expected to register performance domains into the EM framework by
8688
calling the following API::
8789

8890
int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
89-
struct em_data_callback *cb, cpumask_t *cpus);
91+
struct em_data_callback *cb, cpumask_t *cpus, bool milliwatts);
9092

9193
Drivers must provide a callback function returning <frequency, power> tuples
9294
for each performance state. The callback function provided by the driver is free
9395
to fetch data from any relevant location (DT, firmware, ...), and by any mean
9496
deemed necessary. Only for CPU devices, drivers must specify the CPUs of the
9597
performance domains using cpumask. For other devices than CPUs the last
9698
argument must be set to NULL.
99+
The last argument 'milliwatts' is important to set with correct value. Kernel
100+
subsystems which use EM might rely on this flag to check if all EM devices use
101+
the same scale. If there are different scales, these subsystems might decide
102+
to: return warning/error, stop working or panic.
97103
See Section 3. for an example of driver implementing this
98104
callback, and kernel/power/energy_model.c for further documentation on this
99105
API.
@@ -169,7 +175,8 @@ EM framework::
169175
37 nr_opp = foo_get_nr_opp(policy);
170176
38
171177
39 /* And register the new performance domain */
172-
40 em_dev_register_perf_domain(cpu_dev, nr_opp, &em_cb, policy->cpus);
173-
41
174-
42 return 0;
175-
43 }
178+
40 em_dev_register_perf_domain(cpu_dev, nr_opp, &em_cb, policy->cpus,
179+
41 true);
180+
42
181+
43 return 0;
182+
44 }

0 commit comments

Comments
 (0)