Commit fc3a9a98 authored by Pierre Gondois's avatar Pierre Gondois Committed by Rafael J. Wysocki
Browse files

PM: EM: Add artificial EM flag



The Energy Model (EM) can be used on platforms which are missing real
power information. Those platforms would implement .get_cost() which
populates needed values for the Energy Aware Scheduler (EAS). The EAS
doesn't use 'power' fields from EM, but other frameworks might use them.
Thus, to avoid miss-usage of this specific type of EM, introduce a new
flags which can be checked by other frameworks.

Signed-off-by: default avatarPierre Gondois <Pierre.Gondois@arm.com>
Signed-off-by: default avatarLukasz Luba <lukasz.luba@arm.com>
Reviewed-by: default avatarIonela Voinescu <ionela.voinescu@arm.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent bdc21a4d
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -67,11 +67,16 @@ struct em_perf_domain {
 *
 *  EM_PERF_DOMAIN_SKIP_INEFFICIENCIES: Skip inefficient states when estimating
 *  energy consumption.
 *
 *  EM_PERF_DOMAIN_ARTIFICIAL: The power values are artificial and might be
 *  created by platform missing real power information
 */
#define EM_PERF_DOMAIN_MILLIWATTS BIT(0)
#define EM_PERF_DOMAIN_SKIP_INEFFICIENCIES BIT(1)
#define EM_PERF_DOMAIN_ARTIFICIAL BIT(2)

#define em_span_cpus(em) (to_cpumask((em)->cpus))
#define em_is_artificial(em) ((em)->flags & EM_PERF_DOMAIN_ARTIFICIAL)

#ifdef CONFIG_ENERGY_MODEL
#define EM_MAX_POWER 0xFFFF
+2 −0
Original line number Diff line number Diff line
@@ -384,6 +384,8 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,

	if (milliwatts)
		dev->em_pd->flags |= EM_PERF_DOMAIN_MILLIWATTS;
	else if (cb->get_cost)
		dev->em_pd->flags |= EM_PERF_DOMAIN_ARTIFICIAL;

	em_cpufreq_update_efficiencies(dev);