Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp66202pxb; Mon, 13 Sep 2021 13:06:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhtl8ylVYpJVQ6Eb7AE3TPno7EioH4UdisNYMv63GEk3zJJlEMoxrDjIfl698mKoMknerY X-Received: by 2002:a05:6402:3107:: with SMTP id dc7mr15179747edb.341.1631563566663; Mon, 13 Sep 2021 13:06:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631563566; cv=none; d=google.com; s=arc-20160816; b=UvTNWYs6iIC+sURQvlvJTvt55cA1ChN9SF9XVSw734wvHGXJE8iuH31WIH8p36RqM8 rcUUKKTBqrKnv8ivmAe9WqTEUOkA7pdL6WgzMcVUkbLXlHVFqKlo/GU4nKs+akPp/7V4 iW9S9W/GbOf585G/kLXdi6DI7YGfnNui2MgfE0U6F50I7UcXP1cPWECGCeMBEkJcn45j N4ZRMu0fIU+JkfAUWiPnfE0nMCZt+wF9sKG6j4BUj87hglcCdUNzP0O9KYCpIAU/LY7u mNwctpAcZg+Bk5xq9EbMNOdgnHyqK8a5eFSmeyK93X1A+4AuqTP4vXN/G9jrmZJAOjg3 +/3w== 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=YyrAQIPfkyr2RpDY9uJlBYOuufC84+p4tso6ZuWkv34=; b=D8L34xh8eHN3MNCeHUCBT0vby6v9SjCNMIj76d2vFTdG9+DS2oAeRI3LUoEbC0JCEC 2lJZPQbQmGgtGYRVUgmGKXnXTWUaVH/ITHHCFHrRxbhZT6zkMvcgRmW/0oinwZdPvFI0 5pkesFDtD2cptCgJVXzxzXI50ujNQuLL5XDd6PJs24ZoOzuiuM/n89uq32e9FlFM2Pu4 nFzIHVcmy2dWW/78GzfkVWqQuRybmmnPHDPrnGXdsrNUV2QheyO+o3UmSIN/XgE360vP xSIf/ebLO8xVFx9tMztsc5kEB9rwbxitdXP6Q0QnHSqhV/2oV3863+M6iGR1m8MUBSGC 2KsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hfp2cIaH; 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 b18si9154614ejh.638.2021.09.13.13.05.40; Mon, 13 Sep 2021 13:06:06 -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=Hfp2cIaH; 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 S243263AbhIMNn2 (ORCPT + 99 others); Mon, 13 Sep 2021 09:43:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:37702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243119AbhIMNiS (ORCPT ); Mon, 13 Sep 2021 09:38:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D621A610A8; Mon, 13 Sep 2021 13:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539701; bh=VGqeDBwfQZyypiNEGbEPnEuu7wdVJoy9VF7pwXmx/jo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hfp2cIaHn9nj4TAyv3XiUxWmQtNdCqQ8wnuvB044CeA9SWd4/inwJjZXCm6Jg0BUl nGe41vUgc8tNxkCz1XZYGA47uEQGHO1JrBQ2ZaB+JedOJANl1RMPZmTtLcqTkLL9Pu YHsGRodVRwgWbKnUunkROcxzvfk8/VLh1f1yDwj4= 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 5.10 126/236] PCI: PM: Enable PME if it can be signaled from D3cold Date: Mon, 13 Sep 2021 15:13:51 +0200 Message-Id: <20210913131104.642792022@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@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 d864f964bcae..29f5d699fa06 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -2469,7 +2469,14 @@ static int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable 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