intel_idle: Adjust state names and descriptions for _LPI states

The value of the _LPI "State Name" field is used as the description of
the given idle state (that is, the value of its "desc" attribute in
sysfs) which is not consistent with idle state descriptions used when
the idle state information comes from an ACPI _CST object.

To rectify that, use the _LPI "State Name" field value as the value of
the "name" sysfs attribute of a given idle state and use the MWAIT hint
value from the _LPI register address value to derive the value of its
"desc" sysfs attribute in analogy with the _CST case.

Fixes: abc5c103c6 ("intel_idle: Add ACPI _LPI support")
Tested-by: Len Brown <len.brown@intel.com>
Cc: 7.3+ <stable@vger.kernel.org> # 7.3+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ rjw: Adjusted scnprintf() format string, tweaked changelog ]
Link: https://patch.msgid.link/6061409.DvuYhMxLoT@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Rafael J. Wysocki 2026-10-21 17:56:08 +02:00
parent 7be4bc52fd
commit 4035247966
2 changed files with 14 additions and 7 deletions

View File

@ -145,11 +145,13 @@ for the other idle state types (C2 and C3) the target residency value is 3 times
the exit latency (again, that is because it reflects the target residency to
exit latency ratio in the majority of cases for the processor models recognized
by ``intel_idle``). The name of the idle state (to be returned by the ``name``
idle state attribute in ``sysfs``) is either "Cx_LPI" (if it comes from ``_LPI``
processing) or "Cx_ACPI", where x is the index of that idle state in the final
list (note that the minimum value of x is 1, because 0 is reserved for the
"polling" state), and its target residency is based on the exit latency value.
All of the idle states in the final list are enabled by default in this case.
idle state attribute in ``sysfs``) either is equal to the state name value that
comes from ``_LPI`` processing (with the possible fallback to "Cx_LPI" if the
state name is not provided) or it is "Cx_ACPI", where x is the index of that
idle state in the final list (note that the minimum value of x is 1, because 0
is reserved for the "polling" state), and its target residency is based on the
exit latency value. All of the idle states in the final list are enabled by
default in this case.
.. _intel-idle-initialization:

View File

@ -1903,8 +1903,13 @@ static void __init intel_idle_init_cstates_acpi_lpi(struct cpuidle_driver *drv)
state = &drv->states[drv->state_count++];
scnprintf(state->name, CPUIDLE_NAME_LEN, "C%d_LPI", index + 1);
strscpy(state->desc, lpi_state->desc);
if (strlen(lpi_state->desc) > 0)
strscpy(state->name, lpi_state->desc);
else
scnprintf(state->name, CPUIDLE_NAME_LEN, "C%d_LPI", index + 1);
scnprintf(state->desc, CPUIDLE_DESC_LEN, "ACPI LPI MWAIT 0x%02llx",
lpi_state->address);
state->exit_latency = lpi_state->wake_latency;
state->target_residency = lpi_state->min_residency;
state->flags = MWAIT2flg(lpi_state->address);