Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1419200imm; Sun, 8 Jul 2018 02:15:01 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc7KnZTSlWDdWT4qO0Vk0nmmVL3mOZcWYboxcx0woKgkTj/9NrXlQZNht0pXQRM8D/GTfS+ X-Received: by 2002:a62:3b89:: with SMTP id w9-v6mr16931563pfj.80.1531041301150; Sun, 08 Jul 2018 02:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531041301; cv=none; d=google.com; s=arc-20160816; b=AM5tkA7dVG6wF9cBMzrN0qudLvgi8omcVKEK/qFhEX1cT4NQEgN0v/Q4zvk9wUBHhN 2TaCiGR3MYCzDxXFY1cOVuopSjeXgZ3Ibdg34+cLAOoxPeoG3HiJmTC0vqfwm8zLtwF6 ELjCIKyFXzmUMDiQciYJEGqO/DSJ+oraLcTXGpDVZlmmW3POFaR8anwh+GA2SUCXlIf7 fOYCklS85/n9sLJiDJCjuN21NHBGrF9h5biwZCy5nOUrmdBmeUQO29UTIXloB9wkAQ9J XR6RS6zb5/aZ4iJnGf+No48a/TMSQbKW95CDt0sSX4LMsQpdw1AuY1npgQv+04m3GJ0w PkdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=2zPOtsIxsec8vXNEfnujzpEOPqfisZQl7w4VNgxUiWI=; b=PpK0b/rFtztLzrAh82Z0zKOauOQ5s7CRmCcFHS5RRNGYEVjgnTQs/+mF3kv/tfU6ss 3iyGFIO4/eQJaJ+iEU6CQjOoUnLKhIKeeg3h+1XJbTRJWsIcpsSvYQ0IWKKC4YGTAioQ DUJFJuzETBieYbGTr1F7Z8SAPE0Uu3Cun9g4DxUExPvvH/tOH9BWMt8jyVWsbsO9ves4 jj5U6npJ/b5RLkjytGjXMJY5fDRpr2e5TCLOkKg9naZCmMBb1gAcJ52i8ze3UYeIoNtb 8UGO3IGyWsceRWajX0Nf9bYHN1fPoa1S65PAEV/9zoWvgcr3grfQ1It1UHR+BQIZS4yU OLow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m13-v6si12105792pls.70.2018.07.08.02.14.17; Sun, 08 Jul 2018 02:15:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754115AbeGHJLq convert rfc822-to-8bit (ORCPT + 99 others); Sun, 8 Jul 2018 05:11:46 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:41555 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754027AbeGHJLo (ORCPT ); Sun, 8 Jul 2018 05:11:44 -0400 Received: from 79.184.255.246.ipv4.supernova.orange.pl (79.184.255.246) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83) id 9c4e14fc15384825; Sun, 8 Jul 2018 11:11:42 +0200 From: "Rafael J. Wysocki" To: Linux ACPI Cc: Thomas =?ISO-8859-1?Q?H=E4nig?= , Takashi Iwai , Erik Schmauss , Linux PM , Linux Kernel Mailing List Subject: [PATCH] ACPICA: Clear status of all events when entering S5 Date: Sun, 08 Jul 2018 11:10:13 +0200 Message-ID: <2396867.eZQXUlvGZn@aspire.rjw.lan> In-Reply-To: <6f01a906-b27c-0e1a-e9f6-fa27c015faa3@cosifan.de> References: <1704080.gFTvVrrZA1@aspire.rjw.lan> <6f01a906-b27c-0e1a-e9f6-fa27c015faa3@cosifan.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="iso-8859-1" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki After commit 18996f2db918 (ACPICA: Events: Stop unconditionally clearing ACPI IRQs during suspend/resume) the status of ACPI events is not cleared any more when entering the ACPI S5 system state (power off) which causes some systems to power up immediately after turing off power in certain situations. That is a functional regression, so address it by making the code clear the status of all ACPI events again when entering S5 (for system-wide suspend or hibernation the clearing of the status of all events is not desirable, as it might cause the kernel to miss wakeup events sometimes). Fixes: 18996f2db918 (ACPICA: Events: Stop unconditionally clearing ACPI IRQs during suspend/resume) Reported-by: Takashi Iwai Tested-by: Thomas H?nig Signed-off-by: Rafael J. Wysocki --- Resend https://patchwork.kernel.org/patch/10511451/ with a changelig and tags. --- drivers/acpi/acpica/hwsleep.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) Index: linux-pm/drivers/acpi/acpica/hwsleep.c =================================================================== --- linux-pm.orig/drivers/acpi/acpica/hwsleep.c +++ linux-pm/drivers/acpi/acpica/hwsleep.c @@ -51,16 +51,23 @@ acpi_status acpi_hw_legacy_sleep(u8 slee return_ACPI_STATUS(status); } - /* - * 1) Disable all GPEs - * 2) Enable all wakeup GPEs - */ + /* Disable all GPEs */ status = acpi_hw_disable_all_gpes(); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } + /* + * If the target sleep state is S5, clear all GPEs and fixed events too + */ + if (sleep_state == ACPI_STATE_S5) { + status = acpi_hw_clear_acpi_status(); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + } acpi_gbl_system_awake_and_running = FALSE; + /* Enable all wakeup GPEs */ status = acpi_hw_enable_all_wakeup_gpes(); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status);