Skip to content

Commit

Permalink
tools/power/x86/intel-speed-select: Set higher of cpuinfo_max_freq or…
Browse files Browse the repository at this point in the history
… base_frequency

In some case when BIOS disabled turbo, cpufreq cpuinfo_max_freq can be
lower than base_frequency at higher config level. So, in that case set
scaling_min_freq to base_frequency.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20201221071859.2783957-3-srinivas.pandruvada@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  • Loading branch information
Srinivas Pandruvada authored and Hans de Goede committed Jan 4, 2021
1 parent f981dc1 commit bbaa2e9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tools/power/x86/intel-speed-select/isst-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1461,6 +1461,16 @@ static void adjust_scaling_max_from_base_freq(int cpu)
set_cpufreq_scaling_min_max(cpu, 1, base_freq);
}

static void adjust_scaling_min_from_base_freq(int cpu)
{
int base_freq, scaling_min_freq;

scaling_min_freq = parse_int_file(0, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_min_freq", cpu);
base_freq = get_cpufreq_base_freq(cpu);
if (scaling_min_freq < base_freq)
set_cpufreq_scaling_min_max(cpu, 0, base_freq);
}

static int set_clx_pbf_cpufreq_scaling_min_max(int cpu)
{
struct isst_pkg_ctdp_level_info *ctdp_level;
Expand Down Expand Up @@ -1558,6 +1568,7 @@ static void set_scaling_min_to_cpuinfo_max(int cpu)
continue;

set_cpufreq_scaling_min_max_from_cpuinfo(i, 1, 0);
adjust_scaling_min_from_base_freq(i);
}
}

Expand Down

0 comments on commit bbaa2e9

Please sign in to comment.