Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3022599imm; Sun, 1 Jul 2018 10:29:37 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIEPzdjGP7kBl8hhGi5OY782GqnPJF86pv4GtvVJlwR2Mr0/32iSaFgdjf7cJP11v9mbGtq X-Received: by 2002:a17:902:8206:: with SMTP id x6-v6mr22388129pln.220.1530466177860; Sun, 01 Jul 2018 10:29:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530466177; cv=none; d=google.com; s=arc-20160816; b=c5ZPyisgU6c4SIgmzqB4f4v/TCYXAWP6pL5P/328iPwnj/q+4zdXN6FRsNknEMCiJ2 FS/r9LkNQKAK4uc8gMY5mzkxwUglTkwCqeGcm5IMujbuT37GxWefFIJv4G2y3EYh2Aan +6sb+6NiIxszy6hV1PvF0iPy4FvQ/1GfxYIvLPZLch0JIGlRzA+jnuACYeg4Ymtt1RSq T67h8Xg+Bvqc5CPdbT6ns9hEJNKQN9q01D4WHjrFj1JtXYUerNDTgb1kFuUKa5JlohBG MnV1uFZGKEky4BJynwsJ9FdJREhSYfSVIrCDt1C/IQ1XINqmS3xLggd3Aiq6pp05xlB7 X+kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=6VlBfz33aUNDb9VGasrOvBtFXx3kN2w6PeNBp8zcZXA=; b=s3BwFtvHhYDkQ35SC3vjSApduj3VxfSlCm/wU7NP1LPKxWJYYtFHmiPCeALKNjeqPj UY6vKCmaE6hcingYiUt/cxDTYhqaScKqeExbpA7nv/BI6KR8O/yMp7gXDb7l/nYWUo3N EAo+UjuDW3ncZfGhewUjmTTDy76a51tdFAgFMSB1KiQCJ2nMksUcymDMB1e43qlUmQDN WpfQRM/1q6zPvLHbqHQfpOhI0alv+HcBYr8JsOJSpYa97PTF6j1pIq3LR0AgFVjnA9Vi T26yzsgmDbqK7qFD5MeyfjZYq42KSIOmNjc7n3x0zqPXTBqX+jk6Z/PpRWkrqg9Hw64U u0Ag== 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 c17-v6si8867498pgu.583.2018.07.01.10.29.23; Sun, 01 Jul 2018 10:29:37 -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; 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 S1031420AbeGAQhZ (ORCPT + 99 others); Sun, 1 Jul 2018 12:37:25 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36218 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031397AbeGAQhQ (ORCPT ); Sun, 1 Jul 2018 12:37:16 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id F114892B; Sun, 1 Jul 2018 16:37:14 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Mika Westerberg , Bjorn Helgaas Subject: [PATCH 4.17 019/220] PCI / PM: Do not clear state_saved for devices that remain suspended Date: Sun, 1 Jul 2018 18:20:43 +0200 Message-Id: <20180701160909.148373756@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160908.272447118@linuxfoundation.org> References: <20180701160908.272447118@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rafael J. Wysocki commit 656088aa9b513907833ba091d0dcde87571fe05b upstream. The state_saved flag should not be cleared in pci_pm_suspend() if the given device is going to remain suspended, or the device's config space will not be restored properly during the subsequent resume. Namely, if the device is going to stay in suspend, both the late and noirq callbacks return early for it, so if its state_saved flag is cleared in pci_pm_suspend(), it will remain unset throughout the remaining part of suspend and resume and pci_restore_state() called for the device going forward will return without doing anything. For this reason, change pci_pm_suspend() to only clear state_saved if the given device is not going to remain suspended. [This is analogous to what commit ae860a19f37c (PCI / PM: Do not clear state_saved in pci_pm_freeze() when smart suspend is set) did for hibernation.] Fixes: c4b65157aeef (PCI / PM: Take SMART_SUSPEND driver flag into account) Cc: 4.15+ # 4.15+ Signed-off-by: Rafael J. Wysocki Reviewed-by: Mika Westerberg Acked-by: Bjorn Helgaas Signed-off-by: Greg Kroah-Hartman --- drivers/pci/pci-driver.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -753,10 +753,11 @@ static int pci_pm_suspend(struct device * better to resume the device from runtime suspend here. */ if (!dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND) || - !pci_dev_keep_suspended(pci_dev)) + !pci_dev_keep_suspended(pci_dev)) { pm_runtime_resume(dev); + pci_dev->state_saved = false; + } - pci_dev->state_saved = false; if (pm->suspend) { pci_power_t prev = pci_dev->current_state; int error;