From 60436e57ddfede61e8523afc03891728f74994ee Mon Sep 17 00:00:00 2001 From: Rob Barnes Date: Mon, 11 Apr 2022 10:58:38 -0600 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3580114 Reviewed-by: Diana Z --- power/amd_x86.c | 12 +++++------- 1 file 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)) { @@ -295,6 +288,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 -- cgit v1.2.1