diff options
author | Lukasz Luba <lukasz.luba@arm.com> | 2024-02-08 11:55:56 +0000 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2024-02-08 15:00:32 +0100 |
commit | 22ea02848c07d1cbd15a5f442138ca429866300d (patch) | |
tree | f7a2c3300fa47801d15b3b86ba60244b2bb3dfce /kernel/power | |
parent | 24e9fb635df2790eccb0e95ff65c6dee7a97fcb7 (diff) |
PM: EM: Add em_dev_compute_costs()
The device drivers can modify EM at runtime by providing a new EM table.
The EM is used by the EAS and the em_perf_state::cost stores
pre-calculated value to avoid overhead. This patch provides the API for
device drivers to calculate the cost values properly (and not duplicate
the same code).
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/energy_model.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c index 57838d28af85..7101fa3fa0c0 100644 --- a/kernel/power/energy_model.c +++ b/kernel/power/energy_model.c @@ -277,6 +277,24 @@ static int em_compute_costs(struct device *dev, struct em_perf_state *table, } /** + * em_dev_compute_costs() - Calculate cost values for new runtime EM table + * @dev : Device for which the EM table is to be updated + * @table : The new EM table that is going to get the costs calculated + * + * Calculate the em_perf_state::cost values for new runtime EM table. The + * values are used for EAS during task placement. It also calculates and sets + * the efficiency flag for each performance state. When the function finish + * successfully the EM table is ready to be updated and used by EAS. + * + * Return 0 on success or a proper error in case of failure. + */ +int em_dev_compute_costs(struct device *dev, struct em_perf_state *table, + int nr_states) +{ + return em_compute_costs(dev, table, NULL, nr_states, 0); +} + +/** * em_dev_update_perf_domain() - Update runtime EM table for a device * @dev : Device for which the EM is to be updated * @new_table : The new EM table that is going to be used from now |