.max_mitigated_freq = UINT_MAX,
.min_freq = 1,
.max_possible_freq = 1,
- .cpu_cycle_max_scale_factor = 1,
.dstate = 0,
.dstate_wakeup_energy = 0,
.dstate_wakeup_latency = 0,
cluster->max_mitigated_freq = UINT_MAX;
cluster->min_freq = 1;
cluster->max_possible_freq = 1;
- cluster->cpu_cycle_max_scale_factor = 1;
cluster->dstate = 0;
cluster->dstate_wakeup_energy = 0;
cluster->dstate_wakeup_latency = 0;
INIT_LIST_HEAD(&cluster_head);
}
-static inline void
-__update_cpu_cycle_max_possible_freq(struct sched_cluster *cluster)
-{
- int cpu = cluster_first_cpu(cluster);
-
- cluster->cpu_cycle_max_scale_factor =
- div64_u64(cluster->max_possible_freq * NSEC_PER_USEC,
- cpu_cycle_counter_cb.get_cpu_cycles_max_per_us(cpu));
-}
-
-static inline void
-update_cpu_cycle_max_possible_freq(struct sched_cluster *cluster)
-{
- if (!use_cycle_counter)
- return;
-
- __update_cpu_cycle_max_possible_freq(cluster);
-}
-
int register_cpu_cycle_counter_cb(struct cpu_cycle_counter_cb *cb)
{
- struct sched_cluster *cluster = NULL;
-
mutex_lock(&cluster_lock);
- if (!cb->get_cpu_cycle_counter || !cb->get_cpu_cycles_max_per_us) {
+ if (!cb->get_cpu_cycle_counter) {
mutex_unlock(&cluster_lock);
return -EINVAL;
}
cpu_cycle_counter_cb = *cb;
- for_each_sched_cluster(cluster)
- __update_cpu_cycle_max_possible_freq(cluster);
use_cycle_counter = true;
mutex_unlock(&cluster_lock);
int cpu = cpu_of(rq);
int sf;
- delta = DIV64_U64_ROUNDUP(delta * cc->cycles *
- cpu_cycle_max_scale_factor(cpu),
+ delta = DIV64_U64_ROUNDUP(delta * cc->cycles,
max_possible_freq * cc->time);
sf = DIV_ROUND_UP(cpu_efficiency(cpu) * 1024, max_possible_efficiency);
cc.cycles = cur_cycles + (U64_MAX - p->cpu_cycles);
else
cc.cycles = cur_cycles - p->cpu_cycles;
+ cc.cycles = cc.cycles * NSEC_PER_MSEC;
cc.time = wallclock - p->ravg.mark_start;
BUG_ON((s64)cc.time < 0);
sort_clusters();
update_all_clusters_stats();
- update_cpu_cycle_max_possible_freq(cluster);
mutex_unlock(&cluster_lock);
continue;
}
*/
unsigned int cur_freq, max_freq, max_mitigated_freq, min_freq;
unsigned int max_possible_freq;
- /*
- * cpu_cycle_max_scale_factor represents number of cycles per NSEC at
- * CPU's fmax.
- */
- u32 cpu_cycle_max_scale_factor;
bool freq_init_done;
int dstate, dstate_wakeup_latency, dstate_wakeup_energy;
unsigned int static_cluster_pwr_cost;
return cpu_rq(cpu)->cluster->max_power_cost;
}
-static inline int cpu_cycle_max_scale_factor(int cpu)
-{
- return cpu_rq(cpu)->cluster->cpu_cycle_max_scale_factor;
-}
-
static inline u32 cpu_cycles_to_freq(int cpu, u64 cycles, u32 period)
{
- return div64_u64(cycles * cpu_cycle_max_scale_factor(cpu), period);
+ return div64_u64(cycles, period);
}
static inline bool hmp_capable(void)