Lines Matching +full:performance +full:- +full:domains

1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (c) 2018-2020, Arm ltd.
20 * Mutex serializing the registrations of performance domains and letting
27 return (dev->bus == &cpu_subsys); in _is_cpu_device()
38 snprintf(name, sizeof(name), "ps:%lu", ps->frequency); in em_debug_create_ps()
40 /* Create per-ps directory */ in em_debug_create_ps()
42 debugfs_create_ulong("frequency", 0444, d, &ps->frequency); in em_debug_create_ps()
43 debugfs_create_ulong("power", 0444, d, &ps->power); in em_debug_create_ps()
44 debugfs_create_ulong("cost", 0444, d, &ps->cost); in em_debug_create_ps()
49 seq_printf(s, "%*pbl\n", cpumask_pr_args(to_cpumask(s->private))); in em_debug_cpus_show()
57 struct em_perf_domain *pd = s->private; in em_debug_units_show()
58 char *units = pd->milliwatts ? "milliWatts" : "bogoWatts"; in em_debug_units_show()
71 /* Create the directory of the performance domain */ in em_debug_create_pd()
75 debugfs_create_file("cpus", 0444, d, dev->em_pd->cpus, in em_debug_create_pd()
78 debugfs_create_file("units", 0444, d, dev->em_pd, &em_debug_units_fops); in em_debug_create_pd()
80 /* Create a sub-directory for each performance state */ in em_debug_create_pd()
81 for (i = 0; i < dev->em_pd->nr_perf_states; i++) in em_debug_create_pd()
82 em_debug_create_ps(&dev->em_pd->table[i], d); in em_debug_create_pd()
118 return -ENOMEM; in em_create_perf_table()
120 /* Build the list of performance states for this performance domain */ in em_create_perf_table()
124 * lowest performance state of 'dev' above 'freq' and updates in em_create_perf_table()
127 ret = cb->active_power(&power, &freq, dev); in em_create_perf_table()
136 * higher performance states. in em_create_perf_table()
139 dev_err(dev, "EM: non-increasing freq: %lu\n", in em_create_perf_table()
165 …dev_dbg(dev, "EM: hertz/watts ratio non-monotonically decreasing: em_perf_state %d >= em_perf_stat… in em_create_perf_table()
166 i, i - 1); in em_create_perf_table()
170 /* Compute the cost of each performance state. */ in em_create_perf_table()
171 fmax = (u64) table[nr_states - 1].frequency; in em_create_perf_table()
179 pd->table = table; in em_create_perf_table()
180 pd->nr_perf_states = nr_states; in em_create_perf_table()
186 return -EINVAL; in em_create_perf_table()
199 return -ENOMEM; in em_create_pd()
205 return -ENOMEM; in em_create_pd()
217 cpu_dev->em_pd = pd; in em_create_pd()
220 dev->em_pd = pd; in em_create_pd()
226 * em_pd_get() - Return the performance domain for a device
227 * @dev : Device to find the performance domain for
229 * Returns the performance domain to which @dev belongs, or NULL if it doesn't
237 return dev->em_pd; in em_pd_get()
242 * em_cpu_get() - Return the performance domain for a CPU
243 * @cpu : CPU to find the performance domain for
245 * Returns the performance domain to which @cpu belongs, or NULL if it doesn't
261 * em_dev_register_perf_domain() - Register the Energy Model (EM) for a device
263 * @nr_states : Number of performance states to register
266 * obligatory. It can be taken from i.e. 'policy->cpus'. For other
271 * Create Energy Model tables for a performance domain using the callbacks
275 * sub-systems might rely on this flag and check if all devices in the EM are
278 * If multiple clients register the same performance domain, all but the first
291 return -EINVAL; in em_dev_register_perf_domain()
294 * Use a mutex to serialize the registration of performance domains and in em_dev_register_perf_domain()
295 * let the driver-defined callback functions sleep. in em_dev_register_perf_domain()
299 if (dev->em_pd) { in em_dev_register_perf_domain()
300 ret = -EEXIST; in em_dev_register_perf_domain()
307 ret = -EINVAL; in em_dev_register_perf_domain()
314 ret = -EEXIST; in em_dev_register_perf_domain()
319 * micro-architecture since they all share the same in em_dev_register_perf_domain()
327 ret = -EINVAL; in em_dev_register_perf_domain()
338 dev->em_pd->milliwatts = milliwatts; in em_dev_register_perf_domain()
350 * em_dev_unregister_perf_domain() - Unregister Energy Model (EM) for a device
357 if (IS_ERR_OR_NULL(dev) || !dev->em_pd) in em_dev_unregister_perf_domain()
365 * from potential clean-up/setup issues in the debugfs directories. in em_dev_unregister_perf_domain()
371 kfree(dev->em_pd->table); in em_dev_unregister_perf_domain()
372 kfree(dev->em_pd); in em_dev_unregister_perf_domain()
373 dev->em_pd = NULL; in em_dev_unregister_perf_domain()