From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: Linux ACPI <linux-acpi@vger.kernel.org>,
Sudeep Holla <Sudeep.Holla@arm.com>
Subject: [PATCH v1 16/17] intel_idle: Prepare for adding ACPI _LPI support
Date: Thu, 09 Jul 2026 14:43:43 +0200 [thread overview]
Message-ID: <1932965.atdPhlSkOF@rafael.j.wysocki> (raw)
In-Reply-To: <4746278.LvFx2qVVIh@rafael.j.wysocki>
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
In preparation for adding ACPI _LPI support to intel_idle, move some
code used for processing ACPI idle states information coming from
_CST objects to separate functions because that code will be also
used for processing idle states information coming from _LPI.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/idle/intel_idle.c | 35 ++++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index d74b478db280..fedaa8142121 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -1837,6 +1837,16 @@ static bool __init intel_idle_acpi_cst_extract(void)
return false;
}
+static void __init intel_idle_complete_state_init(struct cpuidle_state *state)
+{
+ if (intel_idle_state_needs_timer_stop(state))
+ state->flags |= CPUIDLE_FLAG_TIMER_STOP;
+
+ state->enter = intel_idle;
+ state->enter_dead = intel_idle_enter_dead;
+ state->enter_s2idle = intel_idle_s2idle;
+}
+
static void __init intel_idle_init_cstates_acpi(struct cpuidle_driver *drv)
{
int cstate, limit = min_t(int, CPUIDLE_STATE_MAX, acpi_state_table.count);
@@ -1879,18 +1889,23 @@ static void __init intel_idle_init_cstates_acpi(struct cpuidle_driver *drv)
if (disabled_states_mask & BIT(cstate))
state->flags |= CPUIDLE_FLAG_OFF;
- if (intel_idle_state_needs_timer_stop(state))
- state->flags |= CPUIDLE_FLAG_TIMER_STOP;
-
if (cx->type > ACPI_STATE_C1 && !boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
mark_tsc_unstable("TSC halts in idle");
- state->enter = intel_idle;
- state->enter_dead = intel_idle_enter_dead;
- state->enter_s2idle = intel_idle_s2idle;
+ intel_idle_complete_state_init(state);
}
}
+static bool __init intel_idle_acpi_hint_match(unsigned int flags, u32 acpi_hint,
+ u32 table_hint)
+{
+ if (flags & CPUIDLE_FLAG_PARTIAL_HINT_MATCH) {
+ acpi_hint &= ~MWAIT_SUBSTATE_MASK;
+ table_hint &= ~MWAIT_SUBSTATE_MASK;
+ }
+ return acpi_hint == table_hint;
+}
+
static bool __init intel_idle_off_by_default(unsigned int flags, u32 mwait_hint)
{
int cstate, limit;
@@ -1909,14 +1924,8 @@ static bool __init intel_idle_off_by_default(unsigned int flags, u32 mwait_hint)
*/
for (cstate = 1; cstate < limit; cstate++) {
u32 acpi_hint = acpi_state_table.states[cstate].address;
- u32 table_hint = mwait_hint;
-
- if (flags & CPUIDLE_FLAG_PARTIAL_HINT_MATCH) {
- acpi_hint &= ~MWAIT_SUBSTATE_MASK;
- table_hint &= ~MWAIT_SUBSTATE_MASK;
- }
- if (acpi_hint == table_hint)
+ if (intel_idle_acpi_hint_match(flags, acpi_hint, mwait_hint))
return false;
}
return true;
--
2.51.0
next prev parent reply other threads:[~2026-07-09 12:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 12:29 [PATCH v1 00/17] ACPI: processor: idle/intel_idle: Add ACPI _LPI support to intel_idle Rafael J. Wysocki
2026-07-09 12:30 ` [PATCH v1 01/17] ACPI: processor: idle: Expand _LPI package sanity checks Rafael J. Wysocki
2026-07-09 12:31 ` [PATCH v1 02/17] ACPI: processor: idle: Ignore _LPI states with SYSTEMIO entry method Rafael J. Wysocki
2026-07-09 12:32 ` [PATCH v1 03/17] ACPI: processor: idle: Unify debug in acpi_processor_evaluate_lpi() Rafael J. Wysocki
2026-07-09 12:33 ` [PATCH v1 04/17] ACPI: processor: idle: Rearrange acpi_processor_evaluate_lpi() Rafael J. Wysocki
2026-07-09 12:34 ` [PATCH v1 05/17] ACPI: processor: idle: Split acpi_processor_evaluate_lpi() Rafael J. Wysocki
2026-07-09 12:35 ` [PATCH v1 06/17] ACPI: processor: idle: Introduce lpi_state_debug() Rafael J. Wysocki
2026-07-09 12:36 ` [PATCH v1 07/17] ACPI: processor: idle: Rearrange acpi_processor_get_lpi_info() Rafael J. Wysocki
2026-07-09 12:37 ` [PATCH v1 08/17] ACPI: processor: idle: Rework first-level _LPI states processing Rafael J. Wysocki
2026-07-09 12:37 ` [PATCH v1 09/17] ACPI: processor: idle: Drop redundant _LPI presence checks Rafael J. Wysocki
2026-07-09 12:38 ` [PATCH v1 10/17] ACPI: processor: idle: Rearrange loop in acpi_processor_get_lpi_info() Rafael J. Wysocki
2026-07-09 12:39 ` [PATCH v1 11/17] ACPI: processor: idle: Rework flatten_lpi_states() Rafael J. Wysocki
2026-07-09 12:39 ` [PATCH v1 12/17] ACPI: processor: idle: Introduce too_many_states() for _LPI Rafael J. Wysocki
2026-07-09 12:40 ` [PATCH v1 13/17] ACPI: processor: idle: Introduce acpi_processor_extract_lpi_info() Rafael J. Wysocki
2026-07-09 12:41 ` [PATCH v1 14/17] ACPI: processor: idle: Relocate acpi_processor_extract_lpi_info() Rafael J. Wysocki
2026-07-09 12:42 ` [PATCH v1 15/17] ACPI: processor: idle: Add switch for strict _LPI processing Rafael J. Wysocki
2026-07-09 12:43 ` Rafael J. Wysocki [this message]
2026-07-09 12:44 ` [PATCH v1 17/17] intel_idle: Add ACPI _LPI support Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1932965.atdPhlSkOF@rafael.j.wysocki \
--to=rafael@kernel.org \
--cc=Sudeep.Holla@arm.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox