From 288e2c80a3b55eca5f15ddcbf48104d467d7534a Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Mon, 23 Dec 2024 13:56:26 +0000 Subject: [PATCH] CHROMIUM: Reland "pm: re-program timer HW only when the exit latency is not zero"" This reverts commit e939377e9fd2b5b090950f67e8a494fd57e8db6b, relanding 3a58885433b3abfd4bfcd258466f98200cc96730. (aka 6a962fb50a084168d33cf1b43fb2f854628a41da). The original issue has been fixed in: 2bda7b87ee1 driver: timer: npcx: bypass timer counter reading issue bdf05004976 driver: timer: npcx: fix possible vulnerabilities (http://crrev.com/c/5041238 and http://crrev.com/c/5855298) BUG=b:361773754 TEST=Verified on a Rex system, letting it idle with ap off for 4 days, no crashes observed. Change-Id: I1aa8cf1744c707d913c85f489d960ca883f36381 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/6110606 Commit-Queue: Fabio Baltieri Reviewed-by: Peter Marheine Tested-by: Fabio Baltieri Reviewed-by: Jeremy Bettis --- subsys/pm/pm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/pm/pm.c b/subsys/pm/pm.c index aba426262cd..ba90fe7b42f 100644 --- a/subsys/pm/pm.c +++ b/subsys/pm/pm.c @@ -194,7 +194,8 @@ bool pm_system_suspend(int32_t kernel_ticks) } #endif - if (ticks != K_TICKS_FOREVER) { + if ((z_cpus_pm_state[id].exit_latency_us != 0) && + (ticks != K_TICKS_FOREVER)) { /* * We need to set the timer to interrupt a little bit early to * accommodate the time required by the CPU to fully wake up.