Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2318967pxb; Mon, 20 Sep 2021 18:41:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw62ovosYo0ci/WiNIAektPeeI49D0VXxU4ctqetIVmINicmyyGpQu99I+oPAEMywbY/kTN X-Received: by 2002:a6b:3f54:: with SMTP id m81mr20806397ioa.184.1632188497027; Mon, 20 Sep 2021 18:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188497; cv=none; d=google.com; s=arc-20160816; b=RkuVVs6jgE1vAxhHrAlb9Y/Ekt+IvlubNZ9/whtb8UpvsTpTjxzVAQfDJkop9w8+fa i542i/8B1+jTUCTrPEOtfC4pMC7kGUX5Bn6uMJWjBv470PsLe9GPlP1t8vzRM2ctuNi/ orLddVDXGE+JsRsm6lTlqLuEvD1mmvJtt2ztLtVlNMe5BdKqNFXlaskzcGu8D7Oq3r9E QlszsVAFtz8DsUR7PW2f8vGIFGgHfd3OuHoO+F+BSk8uQk02o/qu4Y0APIwG+HCtxU1D 0eSTAP39qZ5LNyjvLXHYeT19xdqvyoH+6buNVtthUWyE34mJ09w+87GylSNz4Vjc+DZb hGJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ed+8rE+E/BhJ1VRr8RHH8DV/6UhSD2CfyNUphFdYmJc=; b=jloBUyhvxE+J8l6SE8fbLxnWDDX6YzzfeP4NVg+rJpTUzSI9AmeOnviNT4bxr9pr0F EdCyB9HaU22joZ+lTKU9tU332occNojvWV0auKGsql/TUUmVEJs/596cjCC4VSWp5U5Y K24YaatUB93fneeaqa+lkRQ67uQ8NSuabtUerVvqIuVK5bDJZdI7MpfPyXb02IkgtRLd SXBta7lzAdzoKlqXmRkWW0T2iSuAUb1u1w6ouoLiK67cJNy7QWtlC9zh7KIF7AUsGDJ9 Yp8FUCGWJ+qHYdzv7n5ofXIxsN1zh5PfnlCBMm6I5TkiUX5j6ik6yWDPoh8s0F1xNRFX Uzhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iifXkGk2; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y203si8357476iof.46.2021.09.20.18.41.26; Mon, 20 Sep 2021 18:41:37 -0700 (PDT) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iifXkGk2; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240458AbhITQtO (ORCPT + 99 others); Mon, 20 Sep 2021 12:49:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:35746 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243786AbhITQsP (ORCPT ); Mon, 20 Sep 2021 12:48:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3D2A161245; Mon, 20 Sep 2021 16:46:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632156408; bh=fflDxze+whBVZOthl1KKpEX2t7H1IarPfwK1vAgknAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iifXkGk2qw+oCg0sgF2fHuOqpEzY3fRiXy/8yWgQL1BMYAICaI57ygLroyVG+cDm/ 6qErbNEobGl51YNs56Cg+3FLF/CjobGUdaQM4PischaHavrppFnYjbBQ6FAY9tAoIr jWpKaiOLMrhcgg7RER5zfSKLO90WME0RTdOkEg8w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mika Westerberg , Utkarsh H Patel , Koba Ko , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.4 045/133] PCI: PM: Enable PME if it can be signaled from D3cold Date: Mon, 20 Sep 2021 18:42:03 +0200 Message-Id: <20210920163914.124447140@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163912.603434365@linuxfoundation.org> References: <20210920163912.603434365@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki [ Upstream commit 0e00392a895c95c6d12d42158236c8862a2f43f2 ] PME signaling is only enabled by __pci_enable_wake() if the target device can signal PME from the given target power state (to avoid pointless reconfiguration of the device), but if the hierarchy above the device goes into D3cold, the device itself will end up in D3cold too, so if it can signal PME from D3cold, it should be enabled to do so in __pci_enable_wake(). [Note that if the device does not end up in D3cold and it cannot signal PME from the original target power state, it will not signal PME, so in that case the behavior does not change.] Link: https://lore.kernel.org/linux-pm/3149540.aeNJFYEL58@kreacher/ Fixes: 5bcc2fb4e815 ("PCI PM: Simplify PCI wake-up code") Reported-by: Mika Westerberg Reported-by: Utkarsh H Patel Reported-by: Koba Ko Signed-off-by: Rafael J. Wysocki Reviewed-by: Mika Westerberg Tested-by: Mika Westerberg Signed-off-by: Sasha Levin --- drivers/pci/pci.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index b7f65fc54dc2..216a1c880924 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1876,7 +1876,14 @@ int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, if (enable) { int error; - if (pci_pme_capable(dev, state)) + /* + * Enable PME signaling if the device can signal PME from + * D3cold regardless of whether or not it can signal PME from + * the current target state, because that will allow it to + * signal PME when the hierarchy above it goes into D3cold and + * the device itself ends up in D3cold as a result of that. + */ + if (pci_pme_capable(dev, state) || pci_pme_capable(dev, PCI_D3cold)) pci_pme_active(dev, true); else ret = 1; -- 2.30.2