summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Barnes <robbarnes@google.com>2022-04-11 10:58:38 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-12 00:28:10 +0000
commit60436e57ddfede61e8523afc03891728f74994ee (patch)
treef2a7ec92e9f34b28c5c6478b8a14e890ac3d3282
parent9e0aca287e03830b09acef8a9cdb9e4c814a0f5c (diff)
downloadchrome-ec-60436e57ddfede61e8523afc03891728f74994ee.tar.gz
amd_x86: Clear SMI/SCI event mask early during suspend
Clear the SMI/SCI event mask at the earliest indication that the host is suspending. The earliest indication is the host sleep event. This avoids the case where the EC asserts an event while the host has already started suspending which can cause a premature wake. BUG=b:213423172 BRANCH=guybrush TEST=suspend_stress_test while also attempting to trigger an SCI event Do not observe any premature wakes after 100+ cycles Change-Id: I83a842c64d33703595c4e9a5b110d038035cf72e Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3580114 Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r--power/amd_x86.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/power/amd_x86.c b/power/amd_x86.c
index c3698bde5d..2a35849039 100644
--- a/power/amd_x86.c
+++ b/power/amd_x86.c
@@ -252,13 +252,6 @@ __override void power_chipset_handle_sleep_hang(
host_set_single_event(EC_HOST_EVENT_HANG_DETECT);
}
-static void handle_chipset_suspend(void)
-{
- /* Clear masks before any hooks are run for suspend. */
- lpc_s0ix_suspend_clear_masks();
-}
-DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, handle_chipset_suspend, HOOK_PRIO_FIRST);
-
static void handle_chipset_reset(void)
{
if (chipset_in_state(CHIPSET_STATE_STANDBY)) {
@@ -296,6 +289,11 @@ __override void power_chipset_handle_host_sleep_event(
#ifdef CONFIG_POWER_S0IX
if (state == HOST_SLEEP_EVENT_S0IX_SUSPEND) {
/*
+ * Clear event mask for SMI and SCI first to avoid host being
+ * interrupted while suspending.
+ */
+ lpc_s0ix_suspend_clear_masks();
+ /*
* Indicate to power state machine that a new host event for
* s0ix/s3 suspend has been received and so chipset suspend
* notification needs to be sent to listeners.