Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1662004pxu; Tue, 24 Nov 2020 06:08:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLt60xyfGEVu9bV8ZaSyLy8c44Lpi/5ecopCSGZrv40/qyk6GAr/ErYj++hnI86fNKm2bA X-Received: by 2002:aa7:d54b:: with SMTP id u11mr4260249edr.341.1606226905499; Tue, 24 Nov 2020 06:08:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606226905; cv=none; d=google.com; s=arc-20160816; b=vcRc4iUXpNv+ByaN1WfnS3rdy3QSG6WKpEdhzDnOT/zlppTl1KaFi5rso9gvHe5HV/ RdHxaM1/zAnO9b4b0aDUU71AxISfM9YjVCJVLf+LPKxXFAJEwxto3eBCSn4HilZar7jB PCV7XO+0VljF2wakDzC0UadjGeFffF5gwRseql85fkvOIZjI2Ezwu45/+fRGMf7zWTM8 jkxWAdjAgDDn5Y1XciaSjf1+jBOReNbHZEUjd05M+LYj3kpUD88H0ETBy3xv1qi6/YvO mHP9i2NPbLmmLk4hh3FqzzDpAiIQpOIgIfzlT80wL3aY3XNuynVBZ8DqD8u4E3XSvqY0 STsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=MMxyaPdI5i63a9I9pY9fTE+BbPQuigoaoOJPLNSYJ2s=; b=Nk4fXSa9X/IwCbE1wkQk8Wes5xhnZtoSmq8JFT1iKd68mxJpAHiR2Uggfadk4V8ak+ Ew4jhlb8XLvUCqO4GdZZJnrS+8y9RFuluwmxpF3tX6ToeEVp/k+8BlZeCVjUUxK/OWwU iJ1lY3x0yer3c77PpiZn2CXljaHcYRNxG/hmrV+Hp2vNhgTj42dwHS7XfzHgszIvA+di s3z5s6XfBUVK5KAThheyY9cad3DmOQ2eq+o8U7I5bQld3z45yZYhaHTKwi7o+tnkOl8v dNqq06ESLu7jjOGs5l/Jmb4y0FgcEJi1MF7IIoUEeAQgSOODafQJMyaz09h4sCFtntGp RSAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f24si8582804edw.120.2020.11.24.06.07.59; Tue, 24 Nov 2020 06:08:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729059AbgKXOB1 (ORCPT + 99 others); Tue, 24 Nov 2020 09:01:27 -0500 Received: from mail-oi1-f193.google.com ([209.85.167.193]:37602 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727161AbgKXOAy (ORCPT ); Tue, 24 Nov 2020 09:00:54 -0500 Received: by mail-oi1-f193.google.com with SMTP id j15so18536072oih.4; Tue, 24 Nov 2020 06:00:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MMxyaPdI5i63a9I9pY9fTE+BbPQuigoaoOJPLNSYJ2s=; b=r9DZAJNjWR07M8ZzEueuffHZZw86lPP5fZ/RhtKHHktB8PF+eWNBvVHUD7XkDxqKVv EjblOXGhGUQ9yU7cAR0qJBX9fFYwfc2gN16RC352V6DsSV7nfnn+niwMQeSBSZE8Ys1v hwCveN0VLWNqYFBrc18Kl/BpjrM+gybwAaD5FuG8YKn0cbgfpYry/NCVs6qDP8LDgInr b7MpAf5PnMIMzGzuNXH69exJlrrRek2i5rEcZgkyaNpS/j1fphdEdaxqS3HwkEagwnv8 BReqLZDzceA7+wXK/jEa2SyVjp2haNW10tYg8h8G3pJpzC4Ap4POSirpZM5y1mlIZiIZ U1aA== X-Gm-Message-State: AOAM530WxwyMQ92QprmD/qHZXanMjdEnTMXeKtMQudUfUBcKNrHdGNXi mXdEacZDjJMyrtVeKeCuIsL7xbNcObKYT/43RmNv7ZzgWyU= X-Received: by 2002:aca:5a42:: with SMTP id o63mr2758594oib.69.1606226452885; Tue, 24 Nov 2020 06:00:52 -0800 (PST) MIME-Version: 1.0 References: <20201124073619.771940-1-kai.heng.feng@canonical.com> In-Reply-To: <20201124073619.771940-1-kai.heng.feng@canonical.com> From: "Rafael J. Wysocki" Date: Tue, 24 Nov 2020 15:00:41 +0100 Message-ID: Subject: Re: [PATCH] ACPI: PM: Re-enable ACPI GPE if it's already enabled To: Kai-Heng Feng Cc: Rafael Wysocki , Andy Shevchenko , Mika Westerberg , Hans de Goede , Bjorn Helgaas , ACPI Devel Maling List , Linux PCI , "Rafael J. Wysocki" , Len Brown , open list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 24, 2020 at 8:36 AM Kai-Heng Feng wrote: > > Dell Precision 5550 fails to detect Thunderbolt device hotplug events, > once the Thunderbolt device and its root port are runtime-suspended to > D3cold. > > While putting the entire hierarchy to D3cold, the root port ACPI GPE is > enabled via acpi_pci_propagate_wakeup() when suspending Thunderbolt > bridges/switches. So when putting the root port to D3cold as last step, > ACPI GPE is untouched as it's already enabled. > > However, platform may need PCI devices to be in D3hot or PME enabled > prior enabling GPE to make it work. What platforms and why. > So re-enable ACPI GPE to address this. > > Signed-off-by: Kai-Heng Feng > --- > drivers/acpi/device_pm.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c > index 94d91c67aeae..dc25d9d204ae 100644 > --- a/drivers/acpi/device_pm.c > +++ b/drivers/acpi/device_pm.c > @@ -757,11 +757,10 @@ static int __acpi_device_wakeup_enable(struct acpi_device *adev, > > mutex_lock(&acpi_wakeup_lock); > > - if (wakeup->enable_count >= max_count) > - goto out; > - > - if (wakeup->enable_count > 0) > - goto inc; > + if (wakeup->enable_count > 0) { > + acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number); > + acpi_disable_wakeup_device_power(adev); > + } An event occurring at this point may be lost after this patch. It looks like you are trying to work around a hardware issue. Can you please describe that issue in detail? > > error = acpi_enable_wakeup_device_power(adev, target_state); > if (error) > @@ -777,8 +776,8 @@ static int __acpi_device_wakeup_enable(struct acpi_device *adev, > acpi_handle_debug(adev->handle, "GPE%2X enabled for wakeup\n", > (unsigned int)wakeup->gpe_number); > > -inc: > - wakeup->enable_count++; > + if (wakeup->enable_count < max_count) > + wakeup->enable_count++; > > out: > mutex_unlock(&acpi_wakeup_lock); > -- > 2.29.2 >