[PATCH v3] cpuidle: psci: Skip Gaokun3 cluster power-down in s2idle
From: YoungJoon Lee
Date: Sun Nov 29 2026 - 07:27:05 EST
On a Huawei MateBook E Go (Gaokun3, GK-W7X, firmware 2.18), s2idle
does not resume successfully when the SC8280XP cluster idle state
with PSCI suspend parameter 0x4100c344 is used.
Match the board compatible and the parsed PSCI idle state parameter.
Let the default system governor select a state first, then reject
power-down if it selects the affected state during s2idle. Keep the
DT state and runtime governor so runtime idle and the RPMh
next-wakeup lookup retain their configuration.
On the same GK-W7X, a power-button test without an RTC alarm
resumed in the same boot after about 122 seconds. The cluster idle
counter advanced from 130 to 1014 across the observation window,
while its s2idle count stayed at zero. This test kernel also
contained the separate RPMh KTIME_MAX guard.
Link: https://lore.kernel.org/r/CA+m4KrB1p2u_y92phm-xpn3up=kebi1OmiVc3X4CCdFzHT9-5Q@xxxxxxxxxxxxxx
Signed-off-by: Lee Youngjoon <getfeus@xxxxxxxxx>
---
Changes in v3:
- Replace the DT node-name check with the parsed PSCI suspend parameter.
- Check the selected state after the default governor runs.
--- a/drivers/cpuidle/cpuidle-psci-domain.c
+++ b/drivers/cpuidle/cpuidle-psci-domain.c
@@ -18,6 +18,7 @@
#include <linux/psci.h>
#include <linux/slab.h>
#include <linux/string.h>
+#include <linux/suspend.h>
#include "cpuidle-psci.h"
#include "dt_idle_genpd.h"
@@ -44,6 +45,40 @@
return 0;
}
+#define GAOKUN3_CLUSTER_SUSPEND_PARAM 0x4100c344
+
+static bool gaokun3_cluster_idle_state(const struct genpd_power_state *state)
+{
+ const u32 *param = state->data;
+
+ return param && *param == GAOKUN3_CLUSTER_SUSPEND_PARAM;
+}
+
+static bool gaokun3_has_cluster_idle_state(const struct generic_pm_domain *pd)
+{
+ unsigned int i;
+
+ for (i = 0; i < pd->state_count; i++)
+ if (gaokun3_cluster_idle_state(&pd->states[i]))
+ return true;
+
+ return false;
+}
+
+static bool gaokun3_cluster_system_power_down_ok(struct dev_pm_domain *pd)
+{
+ struct generic_pm_domain *genpd = pd_to_genpd(pd);
+
+ if (!pm_domain_cpu_gov.system_power_down_ok(pd))
+ return false;
+
+ /* The firmware fails to resume from this state during s2idle. */
+ return pm_suspend_target_state != PM_SUSPEND_TO_IDLE ||
+ !gaokun3_cluster_idle_state(&genpd->states[genpd->state_idx]);
+}
+
+static struct dev_power_governor gaokun3_cluster_gov;
+
static int psci_pd_init(struct device_node *np, bool use_osi)
{
struct generic_pm_domain *pd;
@@ -76,6 +111,13 @@
/* Use governor for CPU PM domains if it has some states to manage. */
pd_gov = pd->states ? &pm_domain_cpu_gov : NULL;
+ if (pd_gov && use_osi && of_machine_is_compatible("huawei,gaokun3") &&
+ gaokun3_has_cluster_idle_state(pd)) {
+ gaokun3_cluster_gov = pm_domain_cpu_gov;
+ gaokun3_cluster_gov.system_power_down_ok =
+ gaokun3_cluster_system_power_down_ok;
+ pd_gov = &gaokun3_cluster_gov;
+ }
ret = pm_genpd_init(pd, pd_gov, use_osi);
if (ret)