* @pd         : performance domain for which energy has to be estimated
  * @max_util   : highest utilization among CPUs of the domain
  * @sum_util   : sum of the utilization of all CPUs in the domain
+ * @allowed_cpu_cap    : maximum allowed CPU capacity for the @pd, which
+                         might reflect reduced frequency (due to thermal)
  *
  * This function must be used only for CPU devices. There is no validation,
  * i.e. if the EM is a CPU type and has cpumask allocated. It is called from
  * a capacity state satisfying the max utilization of the domain.
  */
 static inline unsigned long em_cpu_energy(struct em_perf_domain *pd,
-                               unsigned long max_util, unsigned long sum_util)
+                               unsigned long max_util, unsigned long sum_util,
+                               unsigned long allowed_cpu_cap)
 {
        unsigned long freq, scale_cpu;
        struct em_perf_state *ps;
        /*
         * In order to predict the performance state, map the utilization of
         * the most utilized CPU of the performance domain to a requested
-        * frequency, like schedutil.
+        * frequency, like schedutil. Take also into account that the real
+        * frequency might be set lower (due to thermal capping). Thus, clamp
+        * max utilization to the allowed CPU capacity before calculating
+        * effective frequency.
         */
        cpu = cpumask_first(to_cpumask(pd->cpus));
        scale_cpu = arch_scale_cpu_capacity(cpu);
        ps = &pd->table[pd->nr_perf_states - 1];
+
+       max_util = map_util_perf(max_util);
+       max_util = min(max_util, allowed_cpu_cap);
        freq = map_util_freq(max_util, ps->frequency, scale_cpu);
 
        /*
        return NULL;
 }
 static inline unsigned long em_cpu_energy(struct em_perf_domain *pd,
-                       unsigned long max_util, unsigned long sum_util)
+                       unsigned long max_util, unsigned long sum_util,
+                       unsigned long allowed_cpu_cap)
 {
        return 0;
 }