Received: by 10.223.185.116 with SMTP id b49csp6341034wrg; Wed, 28 Feb 2018 07:52:15 -0800 (PST) X-Google-Smtp-Source: AH8x225rHLhI86YruNMsTtIfotmDe7ilrFdcOOG4hxZt1C38c/WSKALkORABbdo6cPLJtMl9qUnP X-Received: by 10.99.124.68 with SMTP id l4mr14546381pgn.225.1519833135436; Wed, 28 Feb 2018 07:52:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519833135; cv=none; d=google.com; s=arc-20160816; b=BiC0ifduxYzP1tMibmKhykZ+SpJ4drI+r3uoF7eIrUfTRbzDIdUs7cVS1umAohD2Ol H5njeT1VKDsykuTxO56LlsxFSuldDP9ZuitRi/CRU/e7OVvhCm/LRVTpRqHfTTbACTiy mMGEkOw5nUpb7P0/XPNL6Xafa4swhZIbf+veg4YSyKtRhJBLyE0/nAijcVpJhZcbo3aO 0KWZ8iLh9Tcw/VAPBbFYvH/Z7QKc0gNotvT/1YSs4LOinUpo2NeM2w5uszHBAHXfKkzv fmNze15Bee9mRf8F9vmjatizd55nJ3AzuNWRu6GTmCP/SBzvlo8pPmlw3bi/CgKqzEVc /fzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=GL4PQEbxyxLfdOM9FCV5+8gT+AN+k6VHLSTh2BOh9iA=; b=AuGYK8Htp0jYpmL8IJgnWWiZWOaViCTmcCD7d5o0WfD5O7ZkS+loURihlLNcE0G8of tuM/Hy+TElpF6RcNlSBNAsAdgav1MvD4siwsisloD4Yol+z8gufBA+5e1V902HyuQuvq 1Z/mpSojmf3DsWm1qwMv5UaDaVg1U/FKXmV8XziQ5K6hir4OUudyDQ6dkEYMu0ooZi5+ h2NdH3xBRrDyA5dowcpUJVd0UBH6kAVRlOtT3J6oMobIwYw9IzwzErkRAUFwkb0SJr/4 b7M8ic0HpI4UxcVikxRS749El4tkjFj0qbpRnG+ZXlZGWBXp3bewo1rsJw0L96FYXmS0 49iQ== ARC-Authentication-Results: i=1; mx.google.com; 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 i2si1093429pgf.145.2018.02.28.07.52.00; Wed, 28 Feb 2018 07:52:15 -0800 (PST) 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; 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 S1752981AbeB1Puw (ORCPT + 99 others); Wed, 28 Feb 2018 10:50:52 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34321 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932634AbeB1PuW (ORCPT ); Wed, 28 Feb 2018 10:50:22 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yi-0006Xd-6a; Wed, 28 Feb 2018 15:22:20 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yg-00006a-Ry; Wed, 28 Feb 2018 15:22:18 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Thomas Gleixner" , "Bjorn Helgaas" , "Rafael J. Wysocki" , "Maarten Lankhorst" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 120/254] PCI / PM: Force devices to D0 in pci_pm_thaw_noirq() In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: "Rafael J. Wysocki" commit 5839ee7389e893a31e4e3c9cf17b50d14103c902 upstream. It is incorrect to call pci_restore_state() for devices in low-power states (D1-D3), as that involves the restoration of MSI setup which requires MMIO to be operational and that is only the case in D0. However, pci_pm_thaw_noirq() may do that if the driver's "freeze" callbacks put the device into a low-power state, so fix it by making it force devices into D0 via pci_set_power_state() instead of trying to "update" their power state which is pointless. Fixes: e60514bd4485 (PCI/PM: Restore the status of PCI devices across hibernation) Reported-by: Thomas Gleixner Reported-by: Maarten Lankhorst Tested-by: Thomas Gleixner Tested-by: Maarten Lankhorst Signed-off-by: Rafael J. Wysocki Acked-by: Bjorn Helgaas Signed-off-by: Ben Hutchings --- drivers/pci/pci-driver.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -921,7 +921,12 @@ static int pci_pm_thaw_noirq(struct devi if (pci_has_legacy_pm_support(pci_dev)) return pci_legacy_resume_early(dev); - pci_update_current_state(pci_dev, PCI_D0); + /* + * pci_restore_state() requires the device to be in D0 (because of MSI + * restoration among other things), so force it into D0 in case the + * driver's "freeze" callbacks put it into a low-power state directly. + */ + pci_set_power_state(pci_dev, PCI_D0); pci_restore_state(pci_dev); if (drv && drv->pm && drv->pm->thaw_noirq)