Skip to content

Commit fc4ca95

Browse files
Patryk Wlazlynhansendc
authored andcommitted
intel_idle: Provide the default enter_dead() handler
Recent Intel platforms require idle driver to provide information about the MWAIT hint used to enter the deepest idle state in the play_dead code. Provide the default enter_dead() handler for all of the platforms and allow overwriting with a custom handler for each platform if needed. Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://lore.kernel.org/all/20250205155211.329780-4-artem.bityutskiy%40linux.intel.com
1 parent 541ddf3 commit fc4ca95

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/idle/intel_idle.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#include <asm/mwait.h>
5858
#include <asm/spec-ctrl.h>
5959
#include <asm/fpu/api.h>
60+
#include <asm/smp.h>
6061

6162
#define INTEL_IDLE_VERSION "0.5.1"
6263

@@ -228,6 +229,15 @@ static __cpuidle int intel_idle_s2idle(struct cpuidle_device *dev,
228229
return 0;
229230
}
230231

232+
static void intel_idle_enter_dead(struct cpuidle_device *dev, int index)
233+
{
234+
struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
235+
struct cpuidle_state *state = &drv->states[index];
236+
unsigned long eax = flg2MWAIT(state->flags);
237+
238+
mwait_play_dead(eax);
239+
}
240+
231241
/*
232242
* States are indexed by the cstate number,
233243
* which is also the index into the MWAIT hint array.
@@ -1800,6 +1810,7 @@ static void __init intel_idle_init_cstates_acpi(struct cpuidle_driver *drv)
18001810
state->flags |= CPUIDLE_FLAG_TIMER_STOP;
18011811

18021812
state->enter = intel_idle;
1813+
state->enter_dead = intel_idle_enter_dead;
18031814
state->enter_s2idle = intel_idle_s2idle;
18041815
}
18051816
}
@@ -2149,6 +2160,9 @@ static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv)
21492160
!cpuidle_state_table[cstate].enter_s2idle)
21502161
break;
21512162

2163+
if (!cpuidle_state_table[cstate].enter_dead)
2164+
cpuidle_state_table[cstate].enter_dead = intel_idle_enter_dead;
2165+
21522166
/* If marked as unusable, skip this state. */
21532167
if (cpuidle_state_table[cstate].flags & CPUIDLE_FLAG_UNUSABLE) {
21542168
pr_debug("state %s is disabled\n",

0 commit comments

Comments
 (0)