Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] cpuidle: psci: Skip Gaokun3 cluster power-down in s2idle
@ 2026-11-27 10:56 Lee Youngjoon
  2026-11-29  9:13 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 2+ messages in thread
From: Lee Youngjoon @ 2026-11-27 10:56 UTC (permalink / raw)
  To: ulfh
  Cc: rafael, daniel.lezcano, christian.loehle, linux-pm,
	linux-arm-kernel, linux-kernel

The Huawei MateBook E Go (Gaokun3) fails to resume from s2idle when
the SC8280XP cluster idle state (0x4100c344) is available. Keep the
cluster idle state in the Device Tree so its runtime idle governor
and the RPMh next-wakeup lookup retain the existing configuration.

For the Gaokun3 cluster domain, wrap the system power-down decision
and reject the cluster transition during s2idle. Leave the runtime
power-down callback and per-CPU idle states intact.

On a GK-W7X running firmware 2.18, the candidate booted with the
original cluster idle state in DT and resumed in the same boot after
159 seconds of s2idle using the power button and no RTC alarm. The
cluster genpd counters showed 510 runtime uses and zero s2idle uses.
The test kernel also carried a separate RPMh KTIME_MAX guard.

Link: https://lore.kernel.org/r/CA+m4KrB1p2u_y92phm-xpn3up=kebi1OmiVc3X4CCdFzHT9-5Q@mail.gmail.com
Signed-off-by: Lee Youngjoon <getfeus@gmail.com>
---
Changes in v2:
- Keep the DT state and runtime governor in place.
- Limit the workaround to the system governor's s2idle decision.

--- a/drivers/cpuidle/cpuidle-psci-domain.c
+++ b/drivers/cpuidle/cpuidle-psci-domain.c
@@ -9,6 +9,7 @@

 #define pr_fmt(fmt) "CPUidle PSCI: " fmt

+#include <linux/suspend.h>
 #include <linux/cpu.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
@@ -41,6 +42,20 @@
 	return 0;
 }

+/*
+ * The Gaokun3 cluster state fails to resume from s2idle. Keep the
+ * normal governor for runtime idle and reject only s2idle power-down.
+ */
+static bool gaokun3_cluster_system_power_down_ok(struct dev_pm_domain *pd)
+{
+	if (pm_suspend_target_state == PM_SUSPEND_TO_IDLE)
+		return false;
+
+	return pm_domain_cpu_gov.system_power_down_ok(pd);
+}
+
+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;
@@ -71,6 +86,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 && of_machine_is_compatible("huawei,gaokun3") &&
+	    of_node_name_eq(np, "power-domain-cpu-cluster0")) {
+		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)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] cpuidle: psci: Skip Gaokun3 cluster power-down in s2idle
  2026-11-27 10:56 [PATCH v2] cpuidle: psci: Skip Gaokun3 cluster power-down in s2idle Lee Youngjoon
@ 2026-11-29  9:13 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-29  9:13 UTC (permalink / raw)
  To: Lee Youngjoon, ulfh
  Cc: rafael, daniel.lezcano, christian.loehle, linux-pm,
	linux-arm-kernel, linux-kernel

On 27/11/2026 11:56, Lee Youngjoon wrote:
>  static int psci_pd_init(struct device_node *np, bool use_osi)
>  {
>  	struct generic_pm_domain *pd;
> @@ -71,6 +86,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 && of_machine_is_compatible("huawei,gaokun3") &&
> +	    of_node_name_eq(np, "power-domain-cpu-cluster0")) {

Where did you document this ABI?

(and if you tried answer would be: no, you cannot)


Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-29  9:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 10:56 [PATCH v2] cpuidle: psci: Skip Gaokun3 cluster power-down in s2idle Lee Youngjoon
2026-11-29  9:13 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox