Lines Matching +full:power +full:- +full:domain

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
24 unsigned long power; member
34 * but a lower or equal power cost. Such inefficient states are ignored when
40 * struct em_perf_domain - Performance domain
44 * @cpus: Cpumask covering the CPUs of the domain. It's here
49 * In case of CPU device, a "performance domain" represents a group of CPUs
50 * whose performance is scaled together. All CPUs of a performance domain
51 * must have the same micro-architecture. Performance domains often have
52 * a 1-to-1 mapping with CPUFreq policies. In case of other devices the @cpus
65 * EM_PERF_DOMAIN_MICROWATTS: The power values are in micro-Watts or some
71 * EM_PERF_DOMAIN_ARTIFICIAL: The power values are artificial and might be
72 * created by platform missing real power information
78 #define em_span_cpus(em) (to_cpumask((em)->cpus))
79 #define em_is_artificial(em) ((em)->flags & EM_PERF_DOMAIN_ARTIFICIAL)
83 * The max power value in micro-Watts. The limit of 64 Watts is set as
85 * 32bit value limit for total Perf Domain power implies a limit of
86 * maximum CPUs in such domain to 64.
92 * limits to number of CPUs in the Perf. Domain.
106 * e.g. power ~1.3 Watt at max freq, so the 'cost' value > 1mln micro-Watts.
107 * In such scenario, where there are 4 CPUs in the Perf. Domain the 'sum_util'
124 * active_power() - Provide power at the next performance state of
127 * @power : Active power at the performance state
133 * 'freq' and update 'power' and 'freq' to the matching active power
136 * In case of CPUs, the power is the one of a single CPU in the domain,
137 * expressed in micro-Watts or an abstract scale. It is expected to
142 int (*active_power)(struct device *dev, unsigned long *power,
146 * get_cost() - Provide the cost at the given performance state of
153 * In case of CPUs, the cost is the one of a single CPU in the domain.
177 * em_pd_get_efficient_state() - Get an efficient performance state from the EM
178 * @pd : Performance domain for which we want an efficient frequency
194 for (i = 0; i < pd->nr_perf_states; i++) { in em_pd_get_efficient_state()
195 ps = &pd->table[i]; in em_pd_get_efficient_state()
196 if (ps->frequency >= freq) { in em_pd_get_efficient_state()
197 if (pd->flags & EM_PERF_DOMAIN_SKIP_INEFFICIENCIES && in em_pd_get_efficient_state()
198 ps->flags & EM_PERF_STATE_INEFFICIENT) in em_pd_get_efficient_state()
208 * em_cpu_energy() - Estimates the energy consumed by the CPUs of a
209 * performance domain
210 * @pd : performance domain for which energy has to be estimated
211 * @max_util : highest utilization among CPUs of the domain
212 * @sum_util : sum of the utilization of all CPUs in the domain
220 * Return: the sum of the energy consumed by the CPUs of the domain assuming
221 * a capacity state satisfying the max utilization of the domain.
236 * the most utilized CPU of the performance domain to a requested in em_cpu_energy()
242 cpu = cpumask_first(to_cpumask(pd->cpus)); in em_cpu_energy()
244 ps = &pd->table[pd->nr_perf_states - 1]; in em_cpu_energy()
248 freq = map_util_freq(max_util, ps->frequency, scale_cpu); in em_cpu_energy()
257 * The capacity of a CPU in the domain at the performance state (ps) in em_cpu_energy()
260 * ps->freq * scale_cpu in em_cpu_energy()
261 * ps->cap = -------------------- (1) in em_cpu_energy()
268 * ps->power * cpu_util in em_cpu_energy()
269 * cpu_nrg = -------------------- (2) in em_cpu_energy()
270 * ps->cap in em_cpu_energy()
272 * since 'cpu_util / ps->cap' represents its percentage of busy time. in em_cpu_energy()
275 * units of power, it can be manipulated as an energy value in em_cpu_energy()
279 * By injecting (1) in (2), 'cpu_nrg' can be re-expressed as a product in em_cpu_energy()
282 * ps->power * cpu_max_freq cpu_util in em_cpu_energy()
283 * cpu_nrg = ------------------------ * --------- (3) in em_cpu_energy()
284 * ps->freq scale_cpu in em_cpu_energy()
287 * as 'ps->cost'. in em_cpu_energy()
289 * Since all CPUs of the domain have the same micro-architecture, they in em_cpu_energy()
290 * share the same 'ps->cost', and the same CPU capacity. Hence, the in em_cpu_energy()
291 * total energy of the domain (which is the simple sum of the energy of in em_cpu_energy()
294 * ps->cost * \Sum cpu_util in em_cpu_energy()
295 * pd_nrg = ------------------------ (4) in em_cpu_energy()
298 return em_estimate_energy(ps->cost, sum_util, scale_cpu); in em_cpu_energy()
302 * em_pd_nr_perf_states() - Get the number of performance states of a perf.
303 * domain
304 * @pd : performance domain for which this must be done
306 * Return: the number of performance states in the performance domain table
310 return pd->nr_perf_states; in em_pd_nr_perf_states()
324 return -EINVAL; in em_dev_register_perf_domain()