mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
Merge branches 'acpi-cppc-fixes' and 'pm-cpufreq-fixes'
Merge ACPI CPPC library fixes and cpufreq fixes for 7.4-rc1: - Drop compliance checks involving nominal performance from the ACPI CPPC library to unbreak the CPPC sysfs interface and the intel_pstate driver on some Intel platforms after a recent change that added those checks (Rafael Wysocki) - Make the ACPI CPPC library reject EPP registers that are too small to store all of the possible EPP values (Christian Loehle) - Make cpufreq_driver_target() skip inactive policies to avoid a NULL pointer dereference on a frequency table access attempt (Zhongqiu Han) - Set the CPPC Enable register in cpu_init() in the CPPC cpufreq driver to enable CPPC on platforms that wait for the OS to enable it (Sumit Gupta) * acpi-cppc-fixes: ACPI: CPPC: Drop compliance checks involving nominal performance ACPI: CPPC: Reject EPP registers narrower than 8 bits * pm-cpufreq-fixes: cpufreq: Skip inactive policies in cpufreq_driver_target() cpufreq: CPPC: Set CPPC Enable register in cpu_init()
This commit is contained in:
@@ -2081,6 +2081,15 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
|
||||
cpc_apply_platform_quirks(gas_t, i - 2,
|
||||
platform_quirks);
|
||||
|
||||
/* EPP interfaces require the full 0-255 preference range. */
|
||||
if (i - 2 == ENERGY_PERF && gas_t->bit_width < 8 &&
|
||||
!IS_NULL_REG(gas_t)) {
|
||||
pr_debug("CPU%d: EPP register width %u is not supported\n",
|
||||
pr->id, gas_t->bit_width);
|
||||
ret = -EOPNOTSUPP;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
/*
|
||||
* The PCC Subspace index is encoded inside
|
||||
* the CPC table entries. The same PCC index
|
||||
@@ -2940,9 +2949,9 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_caps *perf_caps)
|
||||
if (!high || !low || !nom || !ref || !min_nonlinear ||
|
||||
high > U32_MAX || low > U32_MAX || guaranteed > U32_MAX ||
|
||||
nom > U32_MAX || ref > U32_MAX || min_nonlinear > U32_MAX ||
|
||||
high < nom || nom < min_nonlinear || min_nonlinear < low ||
|
||||
high < min_nonlinear || min_nonlinear < low ||
|
||||
(CPC_SUPPORTED(guaranteed_reg) &&
|
||||
(guaranteed < low || guaranteed > nom))) {
|
||||
(guaranteed < low || guaranteed > high))) {
|
||||
ret = -EFAULT;
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
@@ -714,7 +714,17 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
||||
pr_debug("Unsupported CPU co-ord type: %d\n",
|
||||
policy->shared_type);
|
||||
ret = -EFAULT;
|
||||
goto out;
|
||||
goto out_put;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable CPPC. The Enable register is optional - some platforms
|
||||
* may not support it.
|
||||
*/
|
||||
ret = cppc_set_enable(cpu, true);
|
||||
if (ret && ret != -EOPNOTSUPP) {
|
||||
pr_err("Failed to enable CPPC for CPU%u (%d)\n", cpu, ret);
|
||||
goto out_put;
|
||||
}
|
||||
|
||||
policy->fast_switch_possible = cppc_allow_fast_switch(policy->cpus);
|
||||
@@ -742,6 +752,8 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
||||
return 0;
|
||||
|
||||
out:
|
||||
cppc_set_enable(cpu, false);
|
||||
out_put:
|
||||
cppc_cpufreq_put_cpu_data(policy);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2452,6 +2452,14 @@ int cpufreq_driver_target(struct cpufreq_policy *policy,
|
||||
{
|
||||
guard(cpufreq_policy_write)(policy);
|
||||
|
||||
/*
|
||||
* The last CPU in the policy may have gone offline after the caller
|
||||
* obtained it, in which case the policy is inactive and must not be
|
||||
* used for changing the frequency.
|
||||
*/
|
||||
if (unlikely(policy_is_inactive(policy)))
|
||||
return -EBUSY;
|
||||
|
||||
return __cpufreq_driver_target(policy, target_freq, relation);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cpufreq_driver_target);
|
||||
|
||||
Reference in New Issue
Block a user