[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241125132029.7241-7-patryk.wlazlyn@linux.intel.com>
Date: Mon, 25 Nov 2024 14:20:26 +0100
From: Patryk Wlazlyn <patryk.wlazlyn@...ux.intel.com>
To: x86@...nel.org
Cc: linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org,
rafael.j.wysocki@...el.com,
len.brown@...el.com,
artem.bityutskiy@...ux.intel.com,
dave.hansen@...ux.intel.com,
patryk.wlazlyn@...ux.intel.com,
peterz@...radead.org,
tglx@...utronix.de,
gautham.shenoy@....com
Subject: [RFC PATCH v4 6/8] intel_idle: Provide enter_dead() handler for SRF
Intel's Sierra Forest report two C6 substates in cpuid leaf 5:
C6S (hint 0x22)
C6SP (hint 0x23)
Hints 0x20 and 0x21 are skipped entirely, causing the generic
implementation in mwait_play_dead() to compute the wrong hint, when
looking for the deepest cstate. As a result, package with an offlined
CPU can never reach PC6.
Define the enter_dead() handler for SRF.
Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@...ux.intel.com>
---
drivers/idle/intel_idle.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index ac4d8faa3886..c2ca01e74add 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -56,6 +56,7 @@
#include <asm/mwait.h>
#include <asm/spec-ctrl.h>
#include <asm/fpu/api.h>
+#include <asm/smp.h>
#define INTEL_IDLE_VERSION "0.5.1"
@@ -227,6 +228,16 @@ static __cpuidle int intel_idle_s2idle(struct cpuidle_device *dev,
return 0;
}
+static __cpuidle void intel_idle_enter_dead(struct cpuidle_device *dev,
+ int index)
+{
+ struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
+ struct cpuidle_state *state = &drv->states[index];
+ unsigned long eax = flg2MWAIT(state->flags);
+
+ mwait_play_dead_with_hint(eax);
+}
+
/*
* States are indexed by the cstate number,
* which is also the index into the MWAIT hint array.
@@ -1391,6 +1402,7 @@ static struct cpuidle_state srf_cstates[] __initdata = {
.exit_latency = 1,
.target_residency = 1,
.enter = &intel_idle,
+ .enter_dead = &intel_idle_enter_dead,
.enter_s2idle = intel_idle_s2idle, },
{
.name = "C1E",
@@ -1399,6 +1411,7 @@ static struct cpuidle_state srf_cstates[] __initdata = {
.exit_latency = 2,
.target_residency = 10,
.enter = &intel_idle,
+ .enter_dead = &intel_idle_enter_dead,
.enter_s2idle = intel_idle_s2idle, },
{
.name = "C6S",
@@ -1408,6 +1421,7 @@ static struct cpuidle_state srf_cstates[] __initdata = {
.exit_latency = 270,
.target_residency = 700,
.enter = &intel_idle,
+ .enter_dead = &intel_idle_enter_dead,
.enter_s2idle = intel_idle_s2idle, },
{
.name = "C6SP",
@@ -1417,6 +1431,7 @@ static struct cpuidle_state srf_cstates[] __initdata = {
.exit_latency = 310,
.target_residency = 900,
.enter = &intel_idle,
+ .enter_dead = &intel_idle_enter_dead,
.enter_s2idle = intel_idle_s2idle, },
{
.enter = NULL }
--
2.47.0
Powered by blists - more mailing lists