Loading Documentation/power/energy-model.rst +22 −2 Original line number Diff line number Diff line Loading @@ -123,6 +123,26 @@ allows a platform to register EM power values which are reflecting total power (static + dynamic). These power values might be coming directly from experiments and measurements. Registration of 'artificial' EM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There is an option to provide a custom callback for drivers missing detailed knowledge about power value for each performance state. The callback .get_cost() is optional and provides the 'cost' values used by the EAS. This is useful for platforms that only provide information on relative efficiency between CPU types, where one could use the information to create an abstract power model. But even an abstract power model can sometimes be hard to fit in, given the input power value size restrictions. The .get_cost() allows to provide the 'cost' values which reflect the efficiency of the CPUs. This would allow to provide EAS information which has different relation than what would be forced by the EM internal formulas calculating 'cost' values. To register an EM for such platform, the driver must set the flag 'milliwatts' to 0, provide .get_power() callback and provide .get_cost() callback. The EM framework would handle such platform properly during registration. A flag EM_PERF_DOMAIN_ARTIFICIAL is set for such platform. Special care should be taken by other frameworks which are using EM to test and treat this flag properly. Registration of 'simple' EM ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Loading Loading @@ -181,8 +201,8 @@ EM framework:: -> drivers/cpufreq/foo_cpufreq.c 01 static int est_power(unsigned long *mW, unsigned long *KHz, 02 struct device *dev) 01 static int est_power(struct device *dev, unsigned long *mW, 02 unsigned long *KHz) 03 { 04 long freq, power; 05 Loading drivers/cpufreq/mediatek-cpufreq-hw.c +2 −2 Original line number Diff line number Diff line Loading @@ -51,8 +51,8 @@ static const u16 cpufreq_mtk_offsets[REG_ARRAY_SIZE] = { }; static int __maybe_unused mtk_cpufreq_get_cpu_power(unsigned long *mW, unsigned long *KHz, struct device *cpu_dev) mtk_cpufreq_get_cpu_power(struct device *cpu_dev, unsigned long *mW, unsigned long *KHz) { struct mtk_cpufreq_data *data; struct cpufreq_policy *policy; Loading drivers/cpufreq/scmi-cpufreq.c +2 −2 Original line number Diff line number Diff line Loading @@ -96,8 +96,8 @@ scmi_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask) } static int __maybe_unused scmi_get_cpu_power(unsigned long *power, unsigned long *KHz, struct device *cpu_dev) scmi_get_cpu_power(struct device *cpu_dev, unsigned long *power, unsigned long *KHz) { unsigned long Hz; int ret, domain; Loading drivers/opp/of.c +3 −3 Original line number Diff line number Diff line Loading @@ -1448,7 +1448,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_of_node); * Returns 0 on success or a proper -EINVAL value in case of error. */ static int __maybe_unused _get_dt_power(unsigned long *mW, unsigned long *kHz, struct device *dev) _get_dt_power(struct device *dev, unsigned long *mW, unsigned long *kHz) { struct dev_pm_opp *opp; unsigned long opp_freq, opp_power; Loading Loading @@ -1482,8 +1482,8 @@ _get_dt_power(unsigned long *mW, unsigned long *kHz, struct device *dev) * Returns -EINVAL if the power calculation failed because of missing * parameters, 0 otherwise. */ static int __maybe_unused _get_power(unsigned long *mW, unsigned long *kHz, struct device *dev) static int __maybe_unused _get_power(struct device *dev, unsigned long *mW, unsigned long *kHz) { struct dev_pm_opp *opp; struct device_node *np; Loading drivers/powercap/dtpm_cpu.c +1 −1 Original line number Diff line number Diff line Loading @@ -211,7 +211,7 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *parent) return 0; pd = em_cpu_get(cpu); if (!pd) if (!pd || em_is_artificial(pd)) return -EINVAL; dtpm_cpu = kzalloc(sizeof(*dtpm_cpu), GFP_KERNEL); Loading Loading
Documentation/power/energy-model.rst +22 −2 Original line number Diff line number Diff line Loading @@ -123,6 +123,26 @@ allows a platform to register EM power values which are reflecting total power (static + dynamic). These power values might be coming directly from experiments and measurements. Registration of 'artificial' EM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There is an option to provide a custom callback for drivers missing detailed knowledge about power value for each performance state. The callback .get_cost() is optional and provides the 'cost' values used by the EAS. This is useful for platforms that only provide information on relative efficiency between CPU types, where one could use the information to create an abstract power model. But even an abstract power model can sometimes be hard to fit in, given the input power value size restrictions. The .get_cost() allows to provide the 'cost' values which reflect the efficiency of the CPUs. This would allow to provide EAS information which has different relation than what would be forced by the EM internal formulas calculating 'cost' values. To register an EM for such platform, the driver must set the flag 'milliwatts' to 0, provide .get_power() callback and provide .get_cost() callback. The EM framework would handle such platform properly during registration. A flag EM_PERF_DOMAIN_ARTIFICIAL is set for such platform. Special care should be taken by other frameworks which are using EM to test and treat this flag properly. Registration of 'simple' EM ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Loading Loading @@ -181,8 +201,8 @@ EM framework:: -> drivers/cpufreq/foo_cpufreq.c 01 static int est_power(unsigned long *mW, unsigned long *KHz, 02 struct device *dev) 01 static int est_power(struct device *dev, unsigned long *mW, 02 unsigned long *KHz) 03 { 04 long freq, power; 05 Loading
drivers/cpufreq/mediatek-cpufreq-hw.c +2 −2 Original line number Diff line number Diff line Loading @@ -51,8 +51,8 @@ static const u16 cpufreq_mtk_offsets[REG_ARRAY_SIZE] = { }; static int __maybe_unused mtk_cpufreq_get_cpu_power(unsigned long *mW, unsigned long *KHz, struct device *cpu_dev) mtk_cpufreq_get_cpu_power(struct device *cpu_dev, unsigned long *mW, unsigned long *KHz) { struct mtk_cpufreq_data *data; struct cpufreq_policy *policy; Loading
drivers/cpufreq/scmi-cpufreq.c +2 −2 Original line number Diff line number Diff line Loading @@ -96,8 +96,8 @@ scmi_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask) } static int __maybe_unused scmi_get_cpu_power(unsigned long *power, unsigned long *KHz, struct device *cpu_dev) scmi_get_cpu_power(struct device *cpu_dev, unsigned long *power, unsigned long *KHz) { unsigned long Hz; int ret, domain; Loading
drivers/opp/of.c +3 −3 Original line number Diff line number Diff line Loading @@ -1448,7 +1448,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_of_node); * Returns 0 on success or a proper -EINVAL value in case of error. */ static int __maybe_unused _get_dt_power(unsigned long *mW, unsigned long *kHz, struct device *dev) _get_dt_power(struct device *dev, unsigned long *mW, unsigned long *kHz) { struct dev_pm_opp *opp; unsigned long opp_freq, opp_power; Loading Loading @@ -1482,8 +1482,8 @@ _get_dt_power(unsigned long *mW, unsigned long *kHz, struct device *dev) * Returns -EINVAL if the power calculation failed because of missing * parameters, 0 otherwise. */ static int __maybe_unused _get_power(unsigned long *mW, unsigned long *kHz, struct device *dev) static int __maybe_unused _get_power(struct device *dev, unsigned long *mW, unsigned long *kHz) { struct dev_pm_opp *opp; struct device_node *np; Loading
drivers/powercap/dtpm_cpu.c +1 −1 Original line number Diff line number Diff line Loading @@ -211,7 +211,7 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *parent) return 0; pd = em_cpu_get(cpu); if (!pd) if (!pd || em_is_artificial(pd)) return -EINVAL; dtpm_cpu = kzalloc(sizeof(*dtpm_cpu), GFP_KERNEL); Loading