From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 429ADC48BD6 for ; Tue, 25 Jun 2019 16:09:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1C1C02168B for ; Tue, 25 Jun 2019 16:09:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732578AbfFYQJW (ORCPT ); Tue, 25 Jun 2019 12:09:22 -0400 Received: from mga04.intel.com ([192.55.52.120]:8904 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732575AbfFYQJW (ORCPT ); Tue, 25 Jun 2019 12:09:22 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jun 2019 09:09:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,416,1557212400"; d="scan'208";a="182917442" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.157]) by fmsmga001.fm.intel.com with SMTP; 25 Jun 2019 09:09:18 -0700 Received: by lahna (sSMTP sendmail emulation); Tue, 25 Jun 2019 19:09:18 +0300 Date: Tue, 25 Jun 2019 19:09:18 +0300 From: Mika Westerberg To: "Rafael J. Wysocki" Cc: Linux PCI , Linux ACPI , Linux PM , LKML , Bjorn Helgaas , Lukas Wunner Subject: Re: [PATCH] PCI: PM/ACPI: Refresh all stale power state data in pci_pm_complete() Message-ID: <20190625160918.GK2640@lahna.fi.intel.com> References: <6435024.1ODgWP2se3@kreacher> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6435024.1ODgWP2se3@kreacher> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Tue, Jun 25, 2019 at 02:09:12PM +0200, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > In pci_pm_complete() there are checks to decide whether or not to > resume devices that were left in runtime-suspend during the preceding > system-wide transition into a sleep state. They involve checking the > current power state of the device and comparing it with the power > state of it set before the preceding system-wide transition, but the > platform component of the device's power state is not handled > correctly in there. > > Namely, on platforms with ACPI, the device power state information > needs to be updated with care, so that the reference counters of > power resources used by the device (if any) are set to ensure that > the refreshed power state of it will be maintained going forward. > > To that end, introduce a new ->refresh_state() platform PM callback > for PCI devices, for asking the platform to refresh the device power > state data and ensure that the corresponding power state will be > maintained going forward, make it invoke acpi_device_update_power() > (for devices with ACPI PM) on platforms with ACPI and make > pci_pm_complete() use it, through a new pci_refresh_power_state() > wrapper function. > > Fixes: a0d2a959d3da (PCI: Avoid unnecessary resume after direct-complete) > Signed-off-by: Rafael J. Wysocki Reviewed-by: Mika Westerberg I also tested this on Ice Lake system and did not see any issues over several suspend-to-ram cycles.