Lines Matching +full:domain +full:- +full:idle +full:- +full:state
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
29 * em_perf_domain - Performance domain
32 * @cpus: Cpumask covering the CPUs of the domain. It's here
37 * In case of CPU device, a "performance domain" represents a group of CPUs
38 * whose performance is scaled together. All CPUs of a performance domain
39 * must have the same micro-architecture. Performance domains often have
40 * a 1-to-1 mapping with CPUFreq policies. In case of other devices the @cpus
49 #define em_span_cpus(em) (to_cpumask((em)->cpus))
56 * active_power() - Provide power at the next performance state of
58 * @power : Active power at the performance state in mW
60 * @freq : Frequency at the performance state in kHz
64 * active_power() must find the lowest performance state of 'dev' above
68 * In case of CPUs, the power is the one of a single CPU in the domain,
69 * expressed in milli-watts. It is expected to fit in the
86 * em_cpu_energy() - Estimates the energy consumed by the CPUs of a
87 performance domain
88 * @pd : performance domain for which energy has to be estimated
89 * @max_util : highest utilization among CPUs of the domain
90 * @sum_util : sum of the utilization of all CPUs in the domain
96 * Return: the sum of the energy consumed by the CPUs of the domain assuming
97 * a capacity state satisfying the max utilization of the domain.
107 * In order to predict the performance state, map the utilization of in em_cpu_energy()
108 * the most utilized CPU of the performance domain to a requested in em_cpu_energy()
111 cpu = cpumask_first(to_cpumask(pd->cpus)); in em_cpu_energy()
113 ps = &pd->table[pd->nr_perf_states - 1]; in em_cpu_energy()
114 freq = map_util_freq(max_util, ps->frequency, scale_cpu); in em_cpu_energy()
117 * Find the lowest performance state of the Energy Model above the in em_cpu_energy()
120 for (i = 0; i < pd->nr_perf_states; i++) { in em_cpu_energy()
121 ps = &pd->table[i]; in em_cpu_energy()
122 if (ps->frequency >= freq) in em_cpu_energy()
127 * The capacity of a CPU in the domain at the performance state (ps) in em_cpu_energy()
130 * ps->freq * scale_cpu in em_cpu_energy()
131 * ps->cap = -------------------- (1) in em_cpu_energy()
134 * So, ignoring the costs of idle states (which are not available in in em_cpu_energy()
135 * the EM), the energy consumed by this CPU at that performance state in em_cpu_energy()
138 * ps->power * cpu_util in em_cpu_energy()
139 * cpu_nrg = -------------------- (2) in em_cpu_energy()
140 * ps->cap in em_cpu_energy()
142 * since 'cpu_util / ps->cap' represents its percentage of busy time. in em_cpu_energy()
149 * By injecting (1) in (2), 'cpu_nrg' can be re-expressed as a product in em_cpu_energy()
152 * ps->power * cpu_max_freq cpu_util in em_cpu_energy()
153 * cpu_nrg = ------------------------ * --------- (3) in em_cpu_energy()
154 * ps->freq scale_cpu in em_cpu_energy()
157 * as 'ps->cost'. in em_cpu_energy()
159 * Since all CPUs of the domain have the same micro-architecture, they in em_cpu_energy()
160 * share the same 'ps->cost', and the same CPU capacity. Hence, the in em_cpu_energy()
161 * total energy of the domain (which is the simple sum of the energy of in em_cpu_energy()
164 * ps->cost * \Sum cpu_util in em_cpu_energy()
165 * pd_nrg = ------------------------ (4) in em_cpu_energy()
168 return ps->cost * sum_util / scale_cpu; in em_cpu_energy()
172 * em_pd_nr_perf_states() - Get the number of performance states of a perf.
173 * domain
174 * @pd : performance domain for which this must be done
176 * Return: the number of performance states in the performance domain table
180 return pd->nr_perf_states; in em_pd_nr_perf_states()
191 return -EINVAL; in em_dev_register_perf_domain()