Skip to content

Commit d540628

Browse files
committed
ACPI: PM: s2idle: Refine active GPEs check
The check for any active GPEs added by commit fdde0ff ("ACPI: PM: s2idle: Prevent spurious SCIs from waking up the system") turns out to be insufficiently precise to prevent some systems from resuming prematurely due to a spurious EC wakeup, so refine it by first checking if any GPEs other than the EC GPE are active and skipping all of the SCIs coming from the EC that do not produce any genuine wakeup events after processing. Link: https://bugzilla.kernel.org/show_bug.cgi?id=206629 Fixes: fdde0ff ("ACPI: PM: s2idle: Prevent spurious SCIs from waking up the system") Reported-by: Ondřej Caletka <[email protected]> Tested-by: Ondřej Caletka <[email protected]> Cc: 5.4+ <[email protected]> # 5.4+ Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 0ce792d commit d540628

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

drivers/acpi/ec.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,6 +2037,11 @@ void acpi_ec_set_gpe_wake_mask(u8 action)
20372037
acpi_set_gpe_wake_mask(NULL, first_ec->gpe, action);
20382038
}
20392039

2040+
bool acpi_ec_other_gpes_active(void)
2041+
{
2042+
return acpi_any_gpe_status_set(first_ec ? first_ec->gpe : U32_MAX);
2043+
}
2044+
20402045
bool acpi_ec_dispatch_gpe(void)
20412046
{
20422047
u32 ret;

drivers/acpi/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit);
202202

203203
#ifdef CONFIG_PM_SLEEP
204204
void acpi_ec_flush_work(void);
205+
bool acpi_ec_other_gpes_active(void);
205206
bool acpi_ec_dispatch_gpe(void);
206207
#endif
207208

drivers/acpi/sleep.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,18 +1010,19 @@ static bool acpi_s2idle_wake(void)
10101010
return true;
10111011

10121012
/*
1013-
* If there are no EC events to process and at least one of the
1014-
* other enabled GPEs is active, the wakeup is regarded as a
1015-
* genuine one.
1016-
*
1017-
* Note that the checks below must be carried out in this order
1018-
* to avoid returning prematurely due to a change of the EC GPE
1019-
* status bit from unset to set between the checks with the
1020-
* status bits of all the other GPEs unset.
1013+
* If the status bit is set for any enabled GPE other than the
1014+
* EC one, the wakeup is regarded as a genuine one.
10211015
*/
1022-
if (acpi_any_gpe_status_set(U32_MAX) && !acpi_ec_dispatch_gpe())
1016+
if (acpi_ec_other_gpes_active())
10231017
return true;
10241018

1019+
/*
1020+
* If the EC GPE status bit has not been set, the wakeup is
1021+
* regarded as a spurious one.
1022+
*/
1023+
if (!acpi_ec_dispatch_gpe())
1024+
return false;
1025+
10251026
/*
10261027
* Cancel the wakeup and process all pending events in case
10271028
* there are any wakeup ones in there.

0 commit comments

Comments
 (0)