Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2504235imm; Wed, 16 May 2018 14:03:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrFCcC9LR4HUqY905kJi68qapS4u6kIxc7FHoWTQveKbRtYap79yTPL1qQ4w1UZjDIJfO/I X-Received: by 2002:a17:902:758d:: with SMTP id j13-v6mr2526427pll.188.1526504634474; Wed, 16 May 2018 14:03:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526504634; cv=none; d=google.com; s=arc-20160816; b=HSUlpE49NT4wf11qTifUD0X6H6vRpD1fDRwS3bO0I/znJ7cUXpY0Wnz6v7yjBxrBx5 i367eflq7sxhkijgsWVl6WzXEfdt2izU9KlkEgdBfCDrCtuok3zPehE980RBhA9wFQ46 Ql4Rxm3g3smv1R1q+wRboI/maSI2cuzgYxl4pkhmDijZvE4J0URW0wAlBOD7mdPPwd49 pHGHEXXTtClwV8Rgqrcl3teBPB2u1zw5pMYryuAzbi3phihN2I/3YcqR3eGYQObrnPuf w9R8wcaEFATU5t5L3G0mjW9nYn9Jql2jj2LfavgJZoy2qCKajyBUC2QAtgwwIkunms6e a2UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=jmSjQ5CDAddb8Fq61Z8o7ZdhVepSYgN+iAAGnl5Xy4A=; b=B5GC1KwFio+ZfL8mMLWYDd/1EdEPsqvgXqw6us+p7WQsEYLNEhegxF3Zpm0luZb27r YLMq6OtDcaeHm4b+LL7bkEZp5vkBditcvR3+Ah+lrJ3CPYATcRcLhLv3Da3MjC3VlwXO s9F2uP6RZlHQ2mmBjOfAgfwocX+jJuZk8ph/ePTZ4dgRLm1SGNSrbY9JDUXGXvc86aG1 qSLrc4fd9P2WndHux256OfqBTYGFhR7VQTzYgRTfsyz9uZQVsL3WvfmLBB35vb5O+b6z c3yHvDOfOxFISG51x7VsGObC5oKSO05iROVIQYv0q7N+oEH1pMCw9xLYfG3mRPk8YEJB cdtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=fiI4/OTR; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1-v6si3461662plt.39.2018.05.16.14.03.39; Wed, 16 May 2018 14:03:54 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=fiI4/OTR; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751984AbeEPVDN (ORCPT + 99 others); Wed, 16 May 2018 17:03:13 -0400 Received: from mail-ot0-f196.google.com ([74.125.82.196]:35387 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751163AbeEPVDL (ORCPT ); Wed, 16 May 2018 17:03:11 -0400 Received: by mail-ot0-f196.google.com with SMTP id h8-v6so2595781otb.2; Wed, 16 May 2018 14:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=jmSjQ5CDAddb8Fq61Z8o7ZdhVepSYgN+iAAGnl5Xy4A=; b=fiI4/OTRPQV3FDLx0KkO5oM/n4p8mXYua+KVzYuWOkE0eEtKJX3VJn2k0Q9wDQoKcF 1jtQK8nXxmgm6NCXVTqMmFwUJ6MZcMPQdU+p7H/pGhFTELJtd9H7wb30aEqr1/D2atv/ 5Mm78yaz6CU6WgpVYj2vQZTvlwuimNa2XJmcdfNSIxlUsvWrJS29qTbU4Z0IVGgdVyds wYnQkkIbZUpF4ISwm6Tpy4R0xzO2x3CEXHaRQQZAAsT0eEZR4xQ+Cw+0daPGAd2yFQ1+ rwdMDe9tbHGTNn9Ow7xoDT9BAOFPCmCCa5Xa22MNwd+cbFgDac+8ABXkmlv+uxcAT3gM ZZ+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=jmSjQ5CDAddb8Fq61Z8o7ZdhVepSYgN+iAAGnl5Xy4A=; b=PSh6518W+v6/uRLq/o3l2BRu6mjmHdaJcWLPYzHFHtJ6I+YPild13N/8ZAC6WbcnWT l9nJwKkQFowCKjWFJnHC0h78B/4HFNzM+3d0g2mORaVq+36eEpU1esU8euKblkUC83X5 7dn0Ynhzb4uiEaUW301QE3y5a5HLdh2eSC5UV3opY0rA+Ja9e4HfzCtEhWm3EZUdqNDK V4XE/QWuarqMzKUwNIOb0cV3K23/FXYi8UVJKZinWte5z96FWt/zIi9l6G9kYGas9TmU 6i+GrW5BW31XUysA2bwrqFUm0Dj9Ycp2m8IoKAOln9HhGbunLR6rlb3uataG2QgTnrWc 9rGA== X-Gm-Message-State: ALKqPwfW6CRX0IkIFKBVqpCYMB/DvYM5fV7/SEVYPdjwILUxgBz6UqN8 sS+G3d7qqoksAl1+Pr6cUiuO5Jhf6v8YqawDn8E= X-Received: by 2002:a9d:5990:: with SMTP id u16-v6mr1840419oth.370.1526504590277; Wed, 16 May 2018 14:03:10 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:1468:0:0:0:0:0 with HTTP; Wed, 16 May 2018 14:03:09 -0700 (PDT) In-Reply-To: <94F2FBAB4432B54E8AACC7DFDE6C92E3B776DF31@ORSMSX108.amr.corp.intel.com> References: <2406722.gU2bUHd7bl@aspire.rjw.lan> <1877957.ohNgiH8Sko@aspire.rjw.lan> <94F2FBAB4432B54E8AACC7DFDE6C92E3B776DF31@ORSMSX108.amr.corp.intel.com> From: "Rafael J. Wysocki" Date: Wed, 16 May 2018 23:03:09 +0200 X-Google-Sender-Auth: eavjEK7267oTFw7uO3vc_5Jg0Fk Message-ID: Subject: Re: [PATCH 1/2] ACPICA: Introduce acpi_dispatch_gpe() To: "Moore, Robert" Cc: "Rafael J. Wysocki" , Linux ACPI , "Zhang, Rui" , Linux PM , LKML , "Schmauss, Erik" , "Wang, Wendy" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 16, 2018 at 9:18 PM, Moore, Robert wrote: > I'm not sure why this is necessary, please explain. > > Is the implication here that some driver is going to poll on acpi_dispatch_gpe? Not a driver, but the core part of resume from suspend-to-idle and it needs to call it for the EC GPE specifically to avoid missing events that will be discarded on some platforms if the EC is not poked at within specific time since when the GPE status changed. IOW, the use case is in patch [2/2]. :-) I do realize, however, that you may not want this upstream as it is strictly Linux-specific and will probably stay this way forever (suspend-to-idle is a Linux concept and I'm not aware of any OSes doing it). >> -----Original Message----- >> From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net] >> Sent: Wednesday, May 16, 2018 5:12 AM >> To: Linux ACPI >> Cc: Zhang, Rui ; Linux PM > pm@vger.kernel.org>; LKML ; Schmauss, Erik >> ; Moore, Robert ; Wang, >> Wendy >> Subject: [PATCH 1/2] ACPICA: Introduce acpi_dispatch_gpe() >> >> From: Rafael J. Wysocki >> >> Introduce acpi_dispatch_gpe() as a wrapper around acpi_ev_detect_gpe() >> for checking if the given GPE (as represented by a GPE device handle and >> a GPE number) is currently active and dispatching it (if that's the >> case) outside of interrupt context. >> >> Signed-off-by: Rafael J. Wysocki >> --- >> drivers/acpi/acpica/evgpe.c | 6 ++++++ >> drivers/acpi/acpica/evxfgpe.c | 22 ++++++++++++++++++++++ >> include/acpi/acpixf.h | 1 + >> 3 files changed, 29 insertions(+) >> >> Index: linux-pm/drivers/acpi/acpica/evgpe.c >> =================================================================== >> --- linux-pm.orig/drivers/acpi/acpica/evgpe.c >> +++ linux-pm/drivers/acpi/acpica/evgpe.c >> @@ -634,6 +634,12 @@ acpi_ev_detect_gpe(struct acpi_namespace >> >> flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); >> >> + if (!gpe_event_info) { >> + gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, >> gpe_number); >> + if (!gpe_event_info) >> + goto error_exit; >> + } >> + >> /* Get the info block for the entire GPE register */ >> >> gpe_register_info = gpe_event_info->register_info; >> Index: linux-pm/drivers/acpi/acpica/evxfgpe.c >> =================================================================== >> --- linux-pm.orig/drivers/acpi/acpica/evxfgpe.c >> +++ linux-pm/drivers/acpi/acpica/evxfgpe.c >> @@ -639,6 +639,28 @@ ACPI_EXPORT_SYMBOL(acpi_get_gpe_status) >> >> >> /*********************************************************************** >> ******** >> * >> + * FUNCTION: acpi_gispatch_gpe >> + * >> + * PARAMETERS: gpe_device - Parent GPE Device. NULL for >> GPE0/GPE1 >> + * gpe_number - GPE level within the GPE block >> + * >> + * RETURN: None >> + * >> + * DESCRIPTION: Detect and dispatch a General Purpose Event to either a >> function >> + * (e.g. EC) or method (e.g. _Lxx/_Exx) handler. >> + * >> + >> +*********************************************************************** >> +*******/ void acpi_dispatch_gpe(acpi_handle gpe_device, u32 gpe_number) >> +{ >> + ACPI_FUNCTION_TRACE(acpi_dispatch_gpe); >> + >> + acpi_ev_detect_gpe(gpe_device, NULL, gpe_number); } >> + >> +ACPI_EXPORT_SYMBOL(acpi_dispatch_gpe) >> + >> +/********************************************************************** >> +********* >> + * >> * FUNCTION: acpi_finish_gpe >> * >> * PARAMETERS: gpe_device - Namespace node for the GPE Block >> Index: linux-pm/include/acpi/acpixf.h >> =================================================================== >> --- linux-pm.orig/include/acpi/acpixf.h >> +++ linux-pm/include/acpi/acpixf.h >> @@ -753,6 +753,7 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_sta >> u32 gpe_number, >> acpi_event_status >> *event_status)) >> +void acpi_dispatch_gpe(acpi_handle gpe_device, u32 gpe_number); >> ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status >> acpi_disable_all_gpes(void)) >> ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status >> acpi_enable_all_runtime_gpes(void)) >> ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status >> acpi_enable_all_wakeup_gpes(void)) >