summaryrefslogtreecommitdiff
path: root/drivers/cpufreq/cppc_cpufreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/cppc_cpufreq.c')
-rw-r--r--drivers/cpufreq/cppc_cpufreq.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index 7e7f9dfb7a24..f6cea0c54dd9 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -660,8 +660,6 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
* Section 8.4.7.1.1.5 of ACPI 6.1 spec)
*/
policy->min = cppc_perf_to_khz(caps, caps->lowest_nonlinear_perf);
- policy->max = cppc_perf_to_khz(caps, policy->boost_enabled ?
- caps->highest_perf : caps->nominal_perf);
/*
* Set cpuinfo.min_freq to Lowest to make the full range of performance
@@ -669,7 +667,8 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
* nonlinear perf
*/
policy->cpuinfo.min_freq = cppc_perf_to_khz(caps, caps->lowest_perf);
- policy->cpuinfo.max_freq = policy->max;
+ policy->cpuinfo.max_freq = cppc_perf_to_khz(caps, policy->boost_enabled ?
+ caps->highest_perf : caps->nominal_perf);
policy->transition_delay_us = cppc_cpufreq_get_transition_delay_us(cpu);
policy->shared_type = cpu_data->shared_type;
@@ -982,7 +981,34 @@ store_energy_performance_preference_val(struct cpufreq_policy *policy,
return count;
}
-CPPC_CPUFREQ_ATTR_RW_U64(perf_limited, cppc_get_perf_limited,
+static int cppc_get_perf_limited_filtered(int cpu, u64 *perf_limited)
+{
+ struct cpufreq_policy *policy;
+ struct cppc_cpudata *cpu_data;
+ int ret;
+
+ ret = cppc_get_perf_limited(cpu, perf_limited);
+ if (ret)
+ return ret;
+
+ policy = cpufreq_cpu_get_raw(cpu);
+ if (!policy)
+ return -EINVAL;
+
+ cpu_data = policy->driver_data;
+
+ /*
+ * Desired Excursion is ignored when autonomous selection is
+ * enabled. Clear the bit to avoid exposing meaningless state
+ * to userspace.
+ */
+ if (cpu_data && cpu_data->perf_ctrls.auto_sel)
+ *perf_limited &= ~CPPC_PERF_LIMITED_DESIRED_EXCURSION;
+
+ return 0;
+}
+
+CPPC_CPUFREQ_ATTR_RW_U64(perf_limited, cppc_get_perf_limited_filtered,
cppc_set_perf_limited)
cpufreq_freq_attr_ro(freqdomain_cpus);