Lines Matching +full:freq +full:- +full:domain

1 /* SPDX-License-Identifier: GPL-2.0 */
14 * struct em_perf_state - Performance state of a performance domain
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
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
129 * @freq : Frequency at the performance state in kHz
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
143 unsigned long *freq);
146 * get_cost() - Provide the cost at the given performance state of
149 * @freq : Frequency at the performance state in kHz
153 * In case of CPUs, the cost is the one of a single CPU in the domain.
159 int (*get_cost)(struct device *dev, unsigned long freq,
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
179 * @freq : Frequency to map with the EM
184 * Return: An efficient performance state, high enough to meet @freq
189 unsigned long freq) in em_pd_get_efficient_state() argument
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.
227 unsigned long freq, ref_freq, scale_cpu; in em_cpu_energy() local
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()
247 freq = map_util_freq(max_util, ref_freq, scale_cpu); in em_cpu_energy()
253 ps = em_pd_get_efficient_state(pd, freq); in em_cpu_energy()
256 * The capacity of a CPU in the domain at the performance state (ps) in em_cpu_energy()
259 * ps->freq * scale_cpu in em_cpu_energy()
260 * ps->cap = -------------------- (1) in em_cpu_energy()
267 * ps->power * cpu_util in em_cpu_energy()
268 * cpu_nrg = -------------------- (2) in em_cpu_energy()
269 * ps->cap in em_cpu_energy()
271 * since 'cpu_util / ps->cap' represents its percentage of busy time. in em_cpu_energy()
278 * By injecting (1) in (2), 'cpu_nrg' can be re-expressed as a product in em_cpu_energy()
281 * ps->power * cpu_max_freq cpu_util in em_cpu_energy()
282 * cpu_nrg = ------------------------ * --------- (3) in em_cpu_energy()
283 * ps->freq scale_cpu in em_cpu_energy()
286 * as 'ps->cost'. in em_cpu_energy()
288 * Since all CPUs of the domain have the same micro-architecture, they in em_cpu_energy()
289 * share the same 'ps->cost', and the same CPU capacity. Hence, the in em_cpu_energy()
290 * total energy of the domain (which is the simple sum of the energy of in em_cpu_energy()
293 * ps->cost * \Sum cpu_util in em_cpu_energy()
294 * pd_nrg = ------------------------ (4) in em_cpu_energy()
297 return em_estimate_energy(ps->cost, sum_util, scale_cpu); in em_cpu_energy()
301 * em_pd_nr_perf_states() - Get the number of performance states of a perf.
302 * domain
303 * @pd : performance domain for which this must be done
305 * Return: the number of performance states in the performance domain table
309 return pd->nr_perf_states; in em_pd_nr_perf_states()
323 return -EINVAL; in em_dev_register_perf_domain()