Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2816016ybg; Mon, 28 Oct 2019 02:54:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzLyBeXpg4jA8QpXTpoVpyTrAE4Yj/SX9+7FpZdcu16XNbO6KIcK5E1Liq64SodljMaL26T X-Received: by 2002:a17:906:1f44:: with SMTP id d4mr15567411ejk.16.1572256484533; Mon, 28 Oct 2019 02:54:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572256484; cv=none; d=google.com; s=arc-20160816; b=jvqJ/ji5QJtF8Up+Z0CSpGqnnotgtZcRUFeEBr4ej+poz81BQGAsirp0rE4LuwUD6W 1bI5MHref1X+it43roDhdQVSULy6yDKzfDVPDQZHdYHj4s2PAkZXm7xrwhygkboybQl7 N62rCm+vMok7a3COFX2T8zrxSXf2fd0KpZ1pQ7zqK6vaWCdnE4fU9c7gGXpnf2TccisS 5oCpPH4nOd5mXbp/fTWFTxeUQoIDL0vxWG3mHIIH/yPnXQcodQkdjXPq9qr96t66VWjF 90IZLzn1P3dX0HsDl4YsPLM8i6OW/ySWG7BcjIOMSK9EfB6T1I7jbbGoEI6rCaCTc5dt naNw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=h7ysLF3s6b2BGK1NeIiHfM6kFR24xrWQ704TLHwFPWI=; b=FJAsIDtOGRf91gmuDiZS4iuGElIpELVCFzuIAe0+bZt26pOBcoPrQn2b8dOIBQz5mT E9gmewzaDjRDl0DsAISRZUqqR9LDGMZK073ev6qzVve/g+dzt8D2QFR7jFsdfBZJsVYh ZQfThaUfzP4l8CPcC9GmjrUOa/7xGP7qU7WNKhGEzMZwC3sulW77JpOr0d52bjirh/pl 3adSNBMmx3dRXzoZkMVyKHcoul8Y6eTDuZGKnt84/pOwMee8dIr34/9AiI7OFaGIJLWu /vLsamRQZPEnM/H/4whfucN+AkRlvdG7NT5OC2+BR3ONq4PeLIxP1/L0+WLQjSx7y/wZ pkBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S2YqqKqh; 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 f12si7520456edc.1.2019.10.28.02.53.51; Mon, 28 Oct 2019 02:54:44 -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=pass header.i=@kernel.org header.s=default header.b=S2YqqKqh; 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 S1732828AbfJ0VZ4 (ORCPT + 99 others); Sun, 27 Oct 2019 17:25:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:47796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732232AbfJ0VZz (ORCPT ); Sun, 27 Oct 2019 17:25:55 -0400 Received: from localhost (100.50.158.77.rev.sfr.net [77.158.50.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D826B222BD; Sun, 27 Oct 2019 21:25:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572211554; bh=YNG+w3TVAqBqgDIyeJTMNfUZKtV9oZ6NkI/ZnG1nj00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S2YqqKqhfYgofbCf6wTZvOtx7EgmHpr116BP1U9tBwnALHCMfDzMxq4bFYY8UxX0j z0+tfUzbezkXtyYnVvDwaRQfcQ6VwBBPn4fbSdlKIXrN0NdHTuTQkxhax5ErTocUDl ZROcBQLlJR9KO4WD9oaFzpPSfzleFwyQBCKMgTBs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Drake , "Rafael J. Wysocki" , Bjorn Helgaas Subject: [PATCH 5.3 193/197] PCI: PM: Fix pci_power_up() Date: Sun, 27 Oct 2019 22:01:51 +0100 Message-Id: <20191027203406.906068286@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191027203351.684916567@linuxfoundation.org> References: <20191027203351.684916567@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki commit 45144d42f299455911cc29366656c7324a3a7c97 upstream. There is an arbitrary difference between the system resume and runtime resume code paths for PCI devices regarding the delay to apply when switching the devices from D3cold to D0. Namely, pci_restore_standard_config() used in the runtime resume code path calls pci_set_power_state() which in turn invokes __pci_start_power_transition() to power up the device through the platform firmware and that function applies the transition delay (as per PCI Express Base Specification Revision 2.0, Section 6.6.1). However, pci_pm_default_resume_early() used in the system resume code path calls pci_power_up() which doesn't apply the delay at all and that causes issues to occur during resume from suspend-to-idle on some systems where the delay is required. Since there is no reason for that difference to exist, modify pci_power_up() to follow pci_set_power_state() more closely and invoke __pci_start_power_transition() from there to call the platform firmware to power up the device (in case that's necessary). Fixes: db288c9c5f9d ("PCI / PM: restore the original behavior of pci_set_power_state()") Reported-by: Daniel Drake Tested-by: Daniel Drake Link: https://lore.kernel.org/linux-pm/CAD8Lp44TYxrMgPLkHCqF9hv6smEurMXvmmvmtyFhZ6Q4SE+dig@mail.gmail.com/T/#m21be74af263c6a34f36e0fc5c77c5449d9406925 Signed-off-by: Rafael J. Wysocki Acked-by: Bjorn Helgaas Cc: 3.10+ # 3.10+ Signed-off-by: Greg Kroah-Hartman --- drivers/pci/pci.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -959,19 +959,6 @@ void pci_refresh_power_state(struct pci_ } /** - * pci_power_up - Put the given device into D0 forcibly - * @dev: PCI device to power up - */ -void pci_power_up(struct pci_dev *dev) -{ - if (platform_pci_power_manageable(dev)) - platform_pci_set_power_state(dev, PCI_D0); - - pci_raw_set_power_state(dev, PCI_D0); - pci_update_current_state(dev, PCI_D0); -} - -/** * pci_platform_power_transition - Use platform to change device power state * @dev: PCI device to handle. * @state: State to put the device into. @@ -1154,6 +1141,17 @@ int pci_set_power_state(struct pci_dev * EXPORT_SYMBOL(pci_set_power_state); /** + * pci_power_up - Put the given device into D0 forcibly + * @dev: PCI device to power up + */ +void pci_power_up(struct pci_dev *dev) +{ + __pci_start_power_transition(dev, PCI_D0); + pci_raw_set_power_state(dev, PCI_D0); + pci_update_current_state(dev, PCI_D0); +} + +/** * pci_choose_state - Choose the power state of a PCI device * @dev: PCI device to be suspended * @state: target sleep state for the whole system. This is the value