Lines Matching +full:power +full:- +full:domain +full:-
1 /* SPDX-License-Identifier: GPL-2.0 */
14 * struct em_perf_state - Performance state of a performance domain
16 * @power: The power consumed at this level (by 1 CPU or by a registered
17 * device). It can be a total power: static and dynamic.
19 * energy calculation. Equal to: power * max_frequency / frequency
23 unsigned long power; member
28 * struct em_perf_domain - Performance domain
31 * @milliwatts: Flag indicating the power values are in milli-Watts
33 * @cpus: Cpumask covering the CPUs of the domain. It's here
38 * In case of CPU device, a "performance domain" represents a group of CPUs
39 * whose performance is scaled together. All CPUs of a performance domain
40 * must have the same micro-architecture. Performance domains often have
41 * a 1-to-1 mapping with CPUFreq policies. In case of other devices the @cpus
51 #define em_span_cpus(em) (to_cpumask((em)->cpus))
57 * Increase resolution of energy estimation calculations for 64-bit
63 * resolution (i.e. 64-bit). The costs for increasing resolution when 32-bit
74 * active_power() - Provide power at the next performance state of
76 * @power : Active power at the performance state
83 * 'freq' and update 'power' and 'freq' to the matching active power
86 * In case of CPUs, the power is the one of a single CPU in the domain,
87 * expressed in milli-Watts or an abstract scale. It is expected to
92 int (*active_power)(unsigned long *power, unsigned long *freq,
105 * em_cpu_energy() - Estimates the energy consumed by the CPUs of a
106 * performance domain
107 * @pd : performance domain for which energy has to be estimated
108 * @max_util : highest utilization among CPUs of the domain
109 * @sum_util : sum of the utilization of all CPUs in the domain
117 * Return: the sum of the energy consumed by the CPUs of the domain assuming
118 * a capacity state satisfying the max utilization of the domain.
133 * the most utilized CPU of the performance domain to a requested in em_cpu_energy()
139 cpu = cpumask_first(to_cpumask(pd->cpus)); in em_cpu_energy()
141 ps = &pd->table[pd->nr_perf_states - 1]; in em_cpu_energy()
145 freq = map_util_freq(max_util, ps->frequency, scale_cpu); in em_cpu_energy()
151 for (i = 0; i < pd->nr_perf_states; i++) { in em_cpu_energy()
152 ps = &pd->table[i]; in em_cpu_energy()
153 if (ps->frequency >= freq) in em_cpu_energy()
158 * The capacity of a CPU in the domain at the performance state (ps) in em_cpu_energy()
161 * ps->freq * scale_cpu in em_cpu_energy()
162 * ps->cap = -------------------- (1) in em_cpu_energy()
169 * ps->power * cpu_util in em_cpu_energy()
170 * cpu_nrg = -------------------- (2) in em_cpu_energy()
171 * ps->cap in em_cpu_energy()
173 * since 'cpu_util / ps->cap' represents its percentage of busy time. in em_cpu_energy()
176 * units of power, it can be manipulated as an energy value in em_cpu_energy()
180 * By injecting (1) in (2), 'cpu_nrg' can be re-expressed as a product in em_cpu_energy()
183 * ps->power * cpu_max_freq cpu_util in em_cpu_energy()
184 * cpu_nrg = ------------------------ * --------- (3) in em_cpu_energy()
185 * ps->freq scale_cpu in em_cpu_energy()
188 * as 'ps->cost'. in em_cpu_energy()
190 * Since all CPUs of the domain have the same micro-architecture, they in em_cpu_energy()
191 * share the same 'ps->cost', and the same CPU capacity. Hence, the in em_cpu_energy()
192 * total energy of the domain (which is the simple sum of the energy of in em_cpu_energy()
195 * ps->cost * \Sum cpu_util in em_cpu_energy()
196 * pd_nrg = ------------------------ (4) in em_cpu_energy()
199 return ps->cost * sum_util / scale_cpu; in em_cpu_energy()
203 * em_pd_nr_perf_states() - Get the number of performance states of a perf.
204 * domain
205 * @pd : performance domain for which this must be done
207 * Return: the number of performance states in the performance domain table
211 return pd->nr_perf_states; in em_pd_nr_perf_states()
223 return -EINVAL; in em_dev_register_perf_domain()