From: Dietmar Eggemann Date: Tue, 8 Aug 2017 13:22:44 +0000 (+0100) Subject: arm: use cpu scale value derived from energy model X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5e413ac7b4568b1788441782aae772ad33ea7737;p=platform%2Fkernel%2Flinux-exynos.git arm: use cpu scale value derived from energy model To make sure that the capacity value of the last element of the capacity states vector of the energy model (EM) core (MC) level is equal to the cpu scale value, use this capacity value to overwrite the cpu scale value preeviously derived from the Cpu Invariant Engine (CIE). This patch is necessary as long as there is no complete EM support in device tree. Signed-off-by: Dietmar Eggemann Signed-off-by: Lukasz Luba --- diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index 4cbb4e406b7d..226dd6256e7c 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -290,10 +290,26 @@ static void __init parse_dt_topology(void) */ static void update_cpu_capacity(unsigned int cpu) { - if (!cpu_capacity(cpu) || cap_from_dt) - return; + const struct sched_group_energy *sge; + unsigned long capacity; + + sge = cpu_core_energy(cpu); + + if (sge) { + int max_cap_idx; + + max_cap_idx = sge->nr_cap_states - 1; + capacity = sge->cap_states[max_cap_idx].cap; + + printk_deferred("cpu=%d set cpu scale %lu from energy model\n", + cpu, capacity); + } else { + if (!cpu_capacity(cpu) || cap_from_dt) + return; + capacity = cpu_capacity(cpu) / middle_capacity; + } - topology_set_cpu_scale(cpu, cpu_capacity(cpu) / middle_capacity); + topology_set_cpu_scale(cpu, capacity); pr_info("CPU%u: update cpu_capacity %lu\n", cpu, topology_get_cpu_scale(NULL, cpu));