mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
Merge tag 'pm-7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management and ACPI fixes from Rafael Wysocki:
"These fix two recent regressions related to power management, one in
the ACPI CPPC library (affects the CPPC interface in sysfs and the
intel_pstate driver), and one in the ACPI device PM core code (affects
platforms with shared ACPI power resources assigned to devices
reported as "not present" by firmware), another ACPI CPPC library
issue and two cpufreq issues, one in the core and one in the CPPC
cpufreq driver:
- Avoid initializing power management for absent devices in the core
ACPI PM code to unbreak power management on platforms where an ACPI
shared power resource is assigned to a device reported by the
platform firmware as absent (Rafael Wysocki)
- 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)"
* tag 'pm-7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
ACPI: PM: Avoid initializing power management for absent devices
ACPI: CPPC: Drop compliance checks involving nominal performance
ACPI: CPPC: Reject EPP registers narrower than 8 bits
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;
|
||||
}
|
||||
|
||||
@@ -365,14 +365,25 @@ int acpi_bus_init_power(struct acpi_device *device)
|
||||
* fails, ACPI power management will not be used for the device going
|
||||
* forward.
|
||||
*/
|
||||
result = acpi_device_init_power(device);
|
||||
if (result) {
|
||||
device->flags.power_manageable = 0;
|
||||
device->power.state = ACPI_D_STATE_INVALID;
|
||||
acpi_handle_info(device->handle,
|
||||
"Initial power state undetermined, ACPI PM disabled\n");
|
||||
if (!acpi_device_is_present(device)) {
|
||||
acpi_handle_debug(device->handle,
|
||||
"Device not present, ACPI PM disabled\n");
|
||||
result = -ENXIO;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
result = acpi_device_init_power(device);
|
||||
if (result) {
|
||||
acpi_handle_info(device->handle,
|
||||
"Initial power state undetermined, ACPI PM disabled\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
device->flags.power_manageable = 0;
|
||||
device->power.state = ACPI_D_STATE_INVALID;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
+2
-6
@@ -108,14 +108,10 @@ static bool acpi_dev_has_children(struct acpi_device *adev)
|
||||
|
||||
static int find_child_checks(struct acpi_device *adev, bool check_children)
|
||||
{
|
||||
unsigned long long sta;
|
||||
acpi_status status;
|
||||
|
||||
if (check_children && !acpi_dev_has_children(adev))
|
||||
return -ENODEV;
|
||||
|
||||
status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta);
|
||||
if (status == AE_NOT_FOUND) {
|
||||
if (!acpi_has_method(adev->handle, METHOD_NAME__STA)) {
|
||||
/*
|
||||
* Special case: backlight device objects without _STA are
|
||||
* preferred to other objects with the same _ADR value, because
|
||||
@@ -127,7 +123,7 @@ static int find_child_checks(struct acpi_device *adev, bool check_children)
|
||||
return FIND_CHILD_MIN_SCORE;
|
||||
}
|
||||
|
||||
if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED))
|
||||
if (!acpi_device_is_present(adev))
|
||||
return -ENODEV;
|
||||
|
||||
/*
|
||||
|
||||
@@ -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