Lines Matching +full:power +full:- +full:domain
1 /* SPDX-License-Identifier: GPL-2.0 */
14 * em_perf_state - Performance state of a performance domain
16 * @power: The power consumed at this level, in milli-watts (by 1 CPU or
17 by a registered device). It can be a total power: static and
20 * energy calculation. Equal to: power * max_frequency / frequency
24 unsigned long power; member
29 * em_perf_domain - Performance domain
32 * @milliwatts: Flag indicating the power values are in milli-Watts
34 * @cpus: Cpumask covering the CPUs of the domain. It's here
39 * In case of CPU device, a "performance domain" represents a group of CPUs
40 * whose performance is scaled together. All CPUs of a performance domain
41 * must have the same micro-architecture. Performance domains often have
42 * a 1-to-1 mapping with CPUFreq policies. In case of other devices the @cpus
52 #define em_span_cpus(em) (to_cpumask((em)->cpus))
58 * Increase resolution of energy estimation calculations for 64-bit
64 * resolution (i.e. 64-bit). The costs for increasing resolution when 32-bit
75 * active_power() - Provide power at the next performance state of
77 * @power : Active power at the performance state in mW
84 * 'freq' and update 'power' and 'freq' to the matching active power
87 * In case of CPUs, the power is the one of a single CPU in the domain,
88 * expressed in milli-watts. It is expected to fit in the
93 int (*active_power)(unsigned long *power, unsigned long *freq,
106 * em_cpu_energy() - Estimates the energy consumed by the CPUs of a
107 performance domain
108 * @pd : performance domain for which energy has to be estimated
109 * @max_util : highest utilization among CPUs of the domain
110 * @sum_util : sum of the utilization of all CPUs in the domain
116 * Return: the sum of the energy consumed by the CPUs of the domain assuming
117 * a capacity state satisfying the max utilization of the domain.
131 * the most utilized CPU of the performance domain to a requested in em_cpu_energy()
134 cpu = cpumask_first(to_cpumask(pd->cpus)); in em_cpu_energy()
136 ps = &pd->table[pd->nr_perf_states - 1]; in em_cpu_energy()
137 freq = map_util_freq(max_util, ps->frequency, scale_cpu); in em_cpu_energy()
143 for (i = 0; i < pd->nr_perf_states; i++) { in em_cpu_energy()
144 ps = &pd->table[i]; in em_cpu_energy()
145 if (ps->frequency >= freq) in em_cpu_energy()
150 * The capacity of a CPU in the domain at the performance state (ps) in em_cpu_energy()
153 * ps->freq * scale_cpu in em_cpu_energy()
154 * ps->cap = -------------------- (1) in em_cpu_energy()
161 * ps->power * cpu_util in em_cpu_energy()
162 * cpu_nrg = -------------------- (2) in em_cpu_energy()
163 * ps->cap in em_cpu_energy()
165 * since 'cpu_util / ps->cap' represents its percentage of busy time. in em_cpu_energy()
168 * units of power, it can be manipulated as an energy value in em_cpu_energy()
172 * By injecting (1) in (2), 'cpu_nrg' can be re-expressed as a product in em_cpu_energy()
175 * ps->power * cpu_max_freq cpu_util in em_cpu_energy()
176 * cpu_nrg = ------------------------ * --------- (3) in em_cpu_energy()
177 * ps->freq scale_cpu in em_cpu_energy()
180 * as 'ps->cost'. in em_cpu_energy()
182 * Since all CPUs of the domain have the same micro-architecture, they in em_cpu_energy()
183 * share the same 'ps->cost', and the same CPU capacity. Hence, the in em_cpu_energy()
184 * total energy of the domain (which is the simple sum of the energy of in em_cpu_energy()
187 * ps->cost * \Sum cpu_util in em_cpu_energy()
188 * pd_nrg = ------------------------ (4) in em_cpu_energy()
191 return ps->cost * sum_util / scale_cpu; in em_cpu_energy()
195 * em_pd_nr_perf_states() - Get the number of performance states of a perf.
196 * domain
197 * @pd : performance domain for which this must be done
199 * Return: the number of performance states in the performance domain table
203 return pd->nr_perf_states; in em_pd_nr_perf_states()
215 return -EINVAL; in em_dev_register_perf_domain()