]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/acpica-clear-status-of-gpes-before-enabling-them.patch
Linux 4.14.112
[thirdparty/kernel/stable-queue.git] / queue-4.19 / acpica-clear-status-of-gpes-before-enabling-them.patch
1 From c8b1917c8987a6fa3695d479b4d60fbbbc3e537b Mon Sep 17 00:00:00 2001
2 From: Furquan Shaikh <furquan@google.com>
3 Date: Wed, 20 Mar 2019 15:28:44 -0700
4 Subject: ACPICA: Clear status of GPEs before enabling them
5
6 From: Furquan Shaikh <furquan@google.com>
7
8 commit c8b1917c8987a6fa3695d479b4d60fbbbc3e537b upstream.
9
10 Commit 18996f2db918 ("ACPICA: Events: Stop unconditionally clearing
11 ACPI IRQs during suspend/resume") was added to stop clearing event
12 status bits unconditionally in the system-wide suspend and resume
13 paths. This was done because of an issue with a laptop lid appaering
14 to be closed even when it was used to wake up the system from suspend
15 (see https://bugzilla.kernel.org/show_bug.cgi?id=196249), which
16 happened because event status bits were cleared unconditionally on
17 system resume. Though this change fixed the issue in the resume path,
18 it introduced regressions in a few suspend paths.
19
20 First regression was reported and fixed in the S5 entry path by commit
21 fa85015c0d95 ("ACPICA: Clear status of all events when entering S5").
22 Next regression was reported and fixed for all legacy sleep paths by
23 commit f317c7dc12b7 ("ACPICA: Clear status of all events when entering
24 sleep states"). However, there still is a suspend-to-idle regression,
25 since suspend-to-idle does not follow the legacy sleep paths.
26
27 In the suspend-to-idle case, wakeup is enabled as part of device
28 suspend. If the status bits of wakeup GPEs are set when they are
29 enabled, it causes a premature system wakeup to occur.
30
31 To address that problem, partially revert commit 18996f2db918 to
32 restore GPE status bits clearing before the GPE is enabled in
33 acpi_ev_enable_gpe().
34
35 Fixes: 18996f2db918 ("ACPICA: Events: Stop unconditionally clearing ACPI IRQs during suspend/resume")
36 Signed-off-by: Furquan Shaikh <furquan@google.com>
37 Cc: 4.17+ <stable@vger.kernel.org> # 4.17+
38 [ rjw: Subject & changelog ]
39 Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
40 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
41
42 ---
43 drivers/acpi/acpica/evgpe.c | 6 +++++-
44 1 file changed, 5 insertions(+), 1 deletion(-)
45
46 --- a/drivers/acpi/acpica/evgpe.c
47 +++ b/drivers/acpi/acpica/evgpe.c
48 @@ -81,8 +81,12 @@ acpi_status acpi_ev_enable_gpe(struct ac
49
50 ACPI_FUNCTION_TRACE(ev_enable_gpe);
51
52 - /* Enable the requested GPE */
53 + /* Clear the GPE status */
54 + status = acpi_hw_clear_gpe(gpe_event_info);
55 + if (ACPI_FAILURE(status))
56 + return_ACPI_STATUS(status);
57
58 + /* Enable the requested GPE */
59 status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
60 return_ACPI_STATUS(status);
61 }