mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 13:14:02 +02:00
intel_idle: Prepare for adding ACPI _LPI support
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> Link: https://patch.msgid.link/1932965.atdPhlSkOF@rafael.j.wysocki
This commit is contained in:
parent
67fcf679c8
commit
4d7821961f
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user