From patchwork Fri Nov 1 20:45:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 11223663 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4104013BD for ; Fri, 1 Nov 2019 20:46:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 20ABB21906 for ; Fri, 1 Nov 2019 20:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572641189; bh=gBtBxUPX0z0dr/96PZO7T5LUfDsyS3pS2T9fKmfigx0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=TZdRErCd60aEJCqbAxieW8amQ1813XZrk1/ID9DGE4E64G+HqI+vZY/r3CQfgvRo1 114zLlZ/oN0b08ixGSZowytZw0dKED/xiWi/z/1+3euAEDTawO9Z0F79KYY/pEMU0U TR9L1kwqEJnAZi8VHOXUFHbnIfDC60440aj2vcgQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727950AbfKAUq2 (ORCPT ); Fri, 1 Nov 2019 16:46:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:55234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726477AbfKAUq2 (ORCPT ); Fri, 1 Nov 2019 16:46:28 -0400 Received: from localhost (unknown [69.71.4.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 64153217D9; Fri, 1 Nov 2019 20:46:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572641187; bh=gBtBxUPX0z0dr/96PZO7T5LUfDsyS3pS2T9fKmfigx0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V5GePef3mZHVsWfixm6pT0lp9b+3EXpxI+IeheoSd6Rox+c0CPhnRowItQi5+8uOk bShJdg1uDunvD69b+lR9SHlMBqfL9h6ZPqXLIOk1KDiO28bXa2cD8EAvlhvuTH0sjv WlFeVltFWmAL1xMV1cCmYHR1Rbw6KRBmwr9zQtDg= From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 1/6] PCI/PM: Apply D2 delay as milliseconds, not microseconds Date: Fri, 1 Nov 2019 15:45:53 -0500 Message-Id: <20191101204558.210235-2-helgaas@kernel.org> X-Mailer: git-send-email 2.24.0.rc1.363.gb1bccd3e3d-goog In-Reply-To: <20191101204558.210235-1-helgaas@kernel.org> References: <20191101204558.210235-1-helgaas@kernel.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Bjorn Helgaas PCI_PM_D2_DELAY is defined as 200, which is milliseconds, but previously we used udelay(), which only waited for 200 microseconds. Use msleep() instead so we wait the correct amount of time. See PCIe r5.0, sec 5.9. Signed-off-by: Bjorn Helgaas Reviewed-by: Rafael J. Wysocki --- drivers/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index e7982af9a5d8..cd96874ae76d 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -886,7 +886,7 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state) if (state == PCI_D3hot || dev->current_state == PCI_D3hot) pci_dev_d3_sleep(dev); else if (state == PCI_D2 || dev->current_state == PCI_D2) - udelay(PCI_PM_D2_DELAY); + msleep(PCI_PM_D2_DELAY); pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK); From patchwork Fri Nov 1 20:45:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 11223669 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4F9F214E5 for ; Fri, 1 Nov 2019 20:46:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2F77221906 for ; Fri, 1 Nov 2019 20:46:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572641201; bh=TCp0l1jH9H1lbEk8p88U/LHDGbUuuVhCEFyPIpUQiNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=x3ojyhO8QcYSxImPSJZm8LazQGyKZlEZ27sLQi0EZL8a3bbowlaEJ5py2l2KUG4/a mKrkbYA2BLUECChQ/lBLMOmNpb/jT67NmvLX9imgTGIPJGS1Y9i3Zu9PSvtqLbI1zp bsRq0bzN1ujlB1s9r86se9aFZOQxSkzAP3P8tyOs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727984AbfKAUqh (ORCPT ); Fri, 1 Nov 2019 16:46:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:55388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727874AbfKAUqh (ORCPT ); Fri, 1 Nov 2019 16:46:37 -0400 Received: from localhost (unknown [69.71.4.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 296B3217D9; Fri, 1 Nov 2019 20:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572641196; bh=TCp0l1jH9H1lbEk8p88U/LHDGbUuuVhCEFyPIpUQiNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FJJVklLmffG1e2WqY/JuLruwMrGeInDMpbAnrVeEiihp9VbUcr15VqezHanPZSAJU /IOzzWegGrgcbDfE4hG38Pq3odAHfQAfUpr0G89TgAlY+tg3Mh9ygxNcJpFb4DZWiB Wvh37lSCTWpLozIibjYfwAj7ZDOLCAILtovR4QDE= From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 2/6] PCI/PM: Expand PM reset messages to mention D3hot (not just D3) Date: Fri, 1 Nov 2019 15:45:54 -0500 Message-Id: <20191101204558.210235-3-helgaas@kernel.org> X-Mailer: git-send-email 2.24.0.rc1.363.gb1bccd3e3d-goog In-Reply-To: <20191101204558.210235-1-helgaas@kernel.org> References: <20191101204558.210235-1-helgaas@kernel.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Bjorn Helgaas pci_pm_reset() resets a device by putting it in D3hot and bringing it back to D0. Clarify related messages to mention "D3hot" explicitly instead of just "D3". Signed-off-by: Bjorn Helgaas Reviewed-by: Rafael J. Wysocki --- drivers/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index cd96874ae76d..a9d3653ef960 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4605,7 +4605,7 @@ static int pci_pm_reset(struct pci_dev *dev, int probe) pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, csr); pci_dev_d3_sleep(dev); - return pci_dev_wait(dev, "PM D3->D0", PCIE_RESET_READY_POLL_MS); + return pci_dev_wait(dev, "PM D3hot->D0", PCIE_RESET_READY_POLL_MS); } /** * pcie_wait_for_link - Wait until link is active or inactive From patchwork Fri Nov 1 20:45:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 11223673 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1984313BD for ; Fri, 1 Nov 2019 20:46:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ECD0D217D9 for ; Fri, 1 Nov 2019 20:46:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572641209; bh=R7go2cekJOh0q8Qziha8jZKepmAyBufTxO3bA4KzDBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=n+UhioT62IqjDvyevZjTGbybAw0cW16VnSN1QKDkvexAXO5nN+ar+rwget0B4bNII PeewVYAFqg43u0d7n4GYKpQ+cixVpZ4xr95pWvbAA+XhbOdJHu2jDaHaDwF1WQEwmZ Iw+CIDpgZ9uoFjUCzjH7u0tB7Vue5tYosCdlgOfk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728009AbfKAUqp (ORCPT ); Fri, 1 Nov 2019 16:46:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:55578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727517AbfKAUqp (ORCPT ); Fri, 1 Nov 2019 16:46:45 -0400 Received: from localhost (unknown [69.71.4.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 04D48217D9; Fri, 1 Nov 2019 20:46:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572641204; bh=R7go2cekJOh0q8Qziha8jZKepmAyBufTxO3bA4KzDBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xTjQcIJm4BZf9SrqjFqlgY6f3rfgm/eMIyQkURGUWR+0YjoZwAPb7VCYFsTV4OqgF aBpcAKxgigcSSr5eVKyRF93tONOrjR+HuzLjGu336YGCuo4FQJg2jbFzYd+agNkBAA xtLWRJB/V+NqGkse2arjLppp2A3hJfK1DkpFB+Cc= From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 3/6] PCI/PM: Simplify pci_set_power_state() Date: Fri, 1 Nov 2019 15:45:55 -0500 Message-Id: <20191101204558.210235-4-helgaas@kernel.org> X-Mailer: git-send-email 2.24.0.rc1.363.gb1bccd3e3d-goog In-Reply-To: <20191101204558.210235-1-helgaas@kernel.org> References: <20191101204558.210235-1-helgaas@kernel.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Bjorn Helgaas Check for the PCI_DEV_FLAGS_NO_D3 quirk early, before calling __pci_start_power_transition(). This way all the cases where we don't need to do anything at all are checked up front. This doesn't fix anything because if the caller requested D3hot or D3cold, __pci_start_power_transition() is a no-op. But calling it is pointless and makes the code harder to analyze. Signed-off-by: Bjorn Helgaas Reviewed-by: Rafael J. Wysocki --- drivers/pci/pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index a9d3653ef960..281bc8fc51b3 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1130,8 +1130,6 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state) if (dev->current_state == state) return 0; - __pci_start_power_transition(dev, state); - /* * This device is quirked not to be put into D3, so don't put it in * D3 @@ -1139,6 +1137,8 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state) if (state >= PCI_D3hot && (dev->dev_flags & PCI_DEV_FLAGS_NO_D3)) return 0; + __pci_start_power_transition(dev, state); + /* * To put device in D3cold, we put device into D3hot in native * way, then put device into D3cold with platform ops From patchwork Fri Nov 1 20:45:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 11223677 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F25F14E5 for ; Fri, 1 Nov 2019 20:46:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 15B78218DE for ; Fri, 1 Nov 2019 20:46:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572641215; bh=k7uCsAAUnxZ80bJgOazN3gY0TaSbWkotrbmrix3LrZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=PG35e7SNQxWsPN7J77XKnGc+BZSpJSR76R3ADf7YWWEn1VUgRbGSV1ueFrpsrljSJ YPyq+N1eFYFatdvMfdZVpYW/xGpHmeM6r/UtYuFSMNRfOC+OBa9gAb6HKJN6TarV/E i6qlXWjiocbnUO7OTFx0KTAeE8GXWkgIPvBMSLW0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728034AbfKAUqy (ORCPT ); Fri, 1 Nov 2019 16:46:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:55742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727517AbfKAUqy (ORCPT ); Fri, 1 Nov 2019 16:46:54 -0400 Received: from localhost (unknown [69.71.4.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 0FC64217D9; Fri, 1 Nov 2019 20:46:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572641213; bh=k7uCsAAUnxZ80bJgOazN3gY0TaSbWkotrbmrix3LrZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MQwnuCXbx0NlLtjWD9KPezsAVDSxkvv84gdXz4Ncz1guqwmzSK/+wHVua4XoqdUHc tRQZrUMg2MYnhIbs5N/XQM9w22+2Qu7Zbjfrfsl+8yoE6OFwNS8P3IZsqMXhech3Lv KdQCL65NrM+6brGLhI6ADlR1OElJBbdLgv9ozp68= From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Bjorn Helgaas , Stefano Stabellini , KarimAllah Ahmed Subject: [PATCH 4/6] xen-platform: Convert to generic power management Date: Fri, 1 Nov 2019 15:45:56 -0500 Message-Id: <20191101204558.210235-5-helgaas@kernel.org> X-Mailer: git-send-email 2.24.0.rc1.363.gb1bccd3e3d-goog In-Reply-To: <20191101204558.210235-1-helgaas@kernel.org> References: <20191101204558.210235-1-helgaas@kernel.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Bjorn Helgaas Convert xen-platform from the legacy PCI power management callbacks to the generic operations. This is one step towards removing support for the legacy PCI callbacks. The generic .resume_noirq() operation is called by pci_pm_resume_noirq() at the same point the legacy PCI .resume_early() callback was, so this patch should not change the xen-platform behavior. Signed-off-by: Bjorn Helgaas Cc: Stefano Stabellini Cc: KarimAllah Ahmed Acked-by: Rafael J. Wysocki --- drivers/xen/platform-pci.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c index 5e30602fdbad..e06e8769eb84 100644 --- a/drivers/xen/platform-pci.c +++ b/drivers/xen/platform-pci.c @@ -168,13 +168,17 @@ static const struct pci_device_id platform_pci_tbl[] = { {0,} }; +static struct dev_pm_ops platform_pm_ops = { + .resume_noirq = platform_pci_resume, +}; + static struct pci_driver platform_driver = { .name = DRV_NAME, .probe = platform_pci_probe, .id_table = platform_pci_tbl, -#ifdef CONFIG_PM - .resume_early = platform_pci_resume, -#endif + .driver = { + .pm = &platform_pm_ops, + }, }; builtin_pci_driver(platform_driver); From patchwork Fri Nov 1 20:45:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 11223681 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 849C013BD for ; Fri, 1 Nov 2019 20:47:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 58A1C217D9 for ; Fri, 1 Nov 2019 20:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572641229; bh=F7PH70pV5iRcDB3FWGQpi2C/PscRlDn66LS+BKMC4sI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=jyf8ANHZ/DUspY2kvyvc5ECS+TleZmnOSybI6JGmXVdSxEBZuf3o0UEZ5QGbGf01d ccEACwoI6tIL9ynpSYhI1p58VU1HQ5LidIqb+aMjYTcQAqlpnTji7Efinowndg+wWq 4fFr1D96MgT5IbN4WEKR/kYKu2fQ71ofsIzLkDYQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728062AbfKAUrF (ORCPT ); Fri, 1 Nov 2019 16:47:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:55918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727517AbfKAUrF (ORCPT ); Fri, 1 Nov 2019 16:47:05 -0400 Received: from localhost (unknown [69.71.4.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 EA452217D9; Fri, 1 Nov 2019 20:47:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572641223; bh=F7PH70pV5iRcDB3FWGQpi2C/PscRlDn66LS+BKMC4sI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P4tkuro0wOn5dPQ8WBjCh2r44pELA50BZy/uS36TXmatniQIZwi0bCllaOZ67hkGq ywdYWBhJ4ADTy/X0htOsuScHqSNrPYkes7Urq+B6bAtgKXh3NXrgG4s6F6VnjFOIXl QKYyHTrhfXTG4Vt6SOGLHDCMJ6d7jEdce8GNK3uA= From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 5/6] PCI/PM: Remove unused pci_driver.resume_early() hook Date: Fri, 1 Nov 2019 15:45:57 -0500 Message-Id: <20191101204558.210235-6-helgaas@kernel.org> X-Mailer: git-send-email 2.24.0.rc1.363.gb1bccd3e3d-goog In-Reply-To: <20191101204558.210235-1-helgaas@kernel.org> References: <20191101204558.210235-1-helgaas@kernel.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Bjorn Helgaas The struct pci_driver.resume_early() hook is one of the legacy PCI power management callbacks, and there are no remaining users of it. Remove it. Signed-off-by: Bjorn Helgaas Reviewed-by: Rafael J. Wysocki --- Documentation/power/pci.rst | 2 +- drivers/pci/pci-driver.c | 23 ++++++----------------- include/linux/pci.h | 2 -- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/Documentation/power/pci.rst b/Documentation/power/pci.rst index a90e82c70a3b..ff7029b94068 100644 --- a/Documentation/power/pci.rst +++ b/Documentation/power/pci.rst @@ -692,7 +692,7 @@ controlling the runtime power management of their devices. At the time of this writing there are two ways to define power management callbacks for a PCI device driver, the recommended one, based on using a dev_pm_ops structure described in Documentation/driver-api/pm/devices.rst, and -the "legacy" one, in which the .suspend(), .suspend_late(), .resume_early(), and +the "legacy" one, in which the .suspend(), .suspend_late(), and .resume() callbacks from struct pci_driver are used. The legacy approach, however, doesn't allow one to define runtime power management callbacks and is not really suitable for any new drivers. Therefore it is not covered by this diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 5337cbbd69de..fc372c2d529a 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -630,15 +630,6 @@ static int pci_legacy_suspend_late(struct device *dev, pm_message_t state) return 0; } -static int pci_legacy_resume_early(struct device *dev) -{ - struct pci_dev *pci_dev = to_pci_dev(dev); - struct pci_driver *drv = pci_dev->driver; - - return drv && drv->resume_early ? - drv->resume_early(pci_dev) : 0; -} - static int pci_legacy_resume(struct device *dev) { struct pci_dev *pci_dev = to_pci_dev(dev); @@ -662,8 +653,7 @@ static void pci_pm_default_suspend(struct pci_dev *pci_dev) static bool pci_has_legacy_pm_support(struct pci_dev *pci_dev) { struct pci_driver *drv = pci_dev->driver; - bool ret = drv && (drv->suspend || drv->suspend_late || drv->resume - || drv->resume_early); + bool ret = drv && (drv->suspend || drv->suspend_late || drv->resume); /* * Legacy PM support is used by default, so warn if the new framework is @@ -944,7 +934,7 @@ static int pci_pm_resume_noirq(struct device *dev) pcie_pme_root_status_cleanup(pci_dev); if (pci_has_legacy_pm_support(pci_dev)) - return pci_legacy_resume_early(dev); + return 0; if (pm && pm->resume_noirq) return pm->resume_noirq(dev); @@ -1074,9 +1064,8 @@ static int pci_pm_thaw_noirq(struct device *dev) } /* - * Both the legacy ->resume_early() and the new pm->thaw_noirq() - * callbacks assume the device has been returned to D0 and its - * config state has been restored. + * The pm->thaw_noirq() callback assumes the device has been + * returned to D0 and its config state has been restored. * * In addition, pci_restore_state() restores MSI-X state in MMIO * space, which requires the device to be in D0, so return it to D0 @@ -1087,7 +1076,7 @@ static int pci_pm_thaw_noirq(struct device *dev) pci_restore_state(pci_dev); if (pci_has_legacy_pm_support(pci_dev)) - return pci_legacy_resume_early(dev); + return 0; if (pm && pm->thaw_noirq) return pm->thaw_noirq(dev); @@ -1219,7 +1208,7 @@ static int pci_pm_restore_noirq(struct device *dev) pci_fixup_device(pci_fixup_resume_early, pci_dev); if (pci_has_legacy_pm_support(pci_dev)) - return pci_legacy_resume_early(dev); + return 0; if (pm && pm->restore_noirq) return pm->restore_noirq(dev); diff --git a/include/linux/pci.h b/include/linux/pci.h index 4846306d521c..dd4596fc1208 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -806,7 +806,6 @@ struct module; * context, so it can sleep. * @suspend: Put device into low power state. * @suspend_late: Put device into low power state. - * @resume_early: Wake device from low power state. * @resume: Wake device from low power state. * (Please see Documentation/power/pci.rst for descriptions * of PCI Power Management and the related functions.) @@ -830,7 +829,6 @@ struct pci_driver { void (*remove)(struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ int (*suspend)(struct pci_dev *dev, pm_message_t state); /* Device suspended */ int (*suspend_late)(struct pci_dev *dev, pm_message_t state); - int (*resume_early)(struct pci_dev *dev); int (*resume)(struct pci_dev *dev); /* Device woken up */ void (*shutdown)(struct pci_dev *dev); int (*sriov_configure)(struct pci_dev *dev, int num_vfs); /* On PF */ From patchwork Fri Nov 1 20:45:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 11223683 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4456F14E5 for ; Fri, 1 Nov 2019 20:47:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 242A52190F for ; Fri, 1 Nov 2019 20:47:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572641236; bh=SSkz3soRV0jdoMV7GQDwd9LGZExhDp/y3PEYxGNxQLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=MrxNNeb6WnIayI3j3Tlj05CJDFrhXvjd9QOBy/m8fycxKCRbHnPhp6owJGBeysQ+3 W4e6jdDg/yw/fSwmA6SDd1F/6PN4H6XdE4kvAVJ2ItEx5/BAoPvUILqrwndUGPOWaJ xQHwkDIpMevORHu7ZCpGIQZ1mTtMXKsPuOU1/s3g= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727876AbfKAUrP (ORCPT ); Fri, 1 Nov 2019 16:47:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:56082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727517AbfKAUrP (ORCPT ); Fri, 1 Nov 2019 16:47:15 -0400 Received: from localhost (unknown [69.71.4.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 92699217D9; Fri, 1 Nov 2019 20:47:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572641234; bh=SSkz3soRV0jdoMV7GQDwd9LGZExhDp/y3PEYxGNxQLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jVoqK4iZZstPIyuKWWbEFzDm5toz63GhaArRo3fr0RbJXH38Yu90S9QnQSeUZp6GA MgdvB+9y8GOV1FAak3eTcsrCsba1SSCPxlKZi7t+7jD/9iLHwppKo5bZr51OX1xpy6 Fu+YQ3KiBQrIL4hnYEg/sHXAI7x9oRodQwIWxgyY= From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 6/6] PCI/PM: Remove unused pci_driver.suspend_late() hook Date: Fri, 1 Nov 2019 15:45:58 -0500 Message-Id: <20191101204558.210235-7-helgaas@kernel.org> X-Mailer: git-send-email 2.24.0.rc1.363.gb1bccd3e3d-goog In-Reply-To: <20191101204558.210235-1-helgaas@kernel.org> References: <20191101204558.210235-1-helgaas@kernel.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Bjorn Helgaas The struct pci_driver.suspend_late() hook is one of the legacy PCI power management callbacks, and there are no remaining users of it. Remove it. Signed-off-by: Bjorn Helgaas Reviewed-by: Rafael J. Wysocki --- Documentation/power/pci.rst | 10 +++++----- drivers/pci/pci-driver.c | 22 +--------------------- include/linux/pci.h | 2 -- 3 files changed, 6 insertions(+), 28 deletions(-) diff --git a/Documentation/power/pci.rst b/Documentation/power/pci.rst index ff7029b94068..0924d29636ad 100644 --- a/Documentation/power/pci.rst +++ b/Documentation/power/pci.rst @@ -692,11 +692,11 @@ controlling the runtime power management of their devices. At the time of this writing there are two ways to define power management callbacks for a PCI device driver, the recommended one, based on using a dev_pm_ops structure described in Documentation/driver-api/pm/devices.rst, and -the "legacy" one, in which the .suspend(), .suspend_late(), and -.resume() callbacks from struct pci_driver are used. The legacy approach, -however, doesn't allow one to define runtime power management callbacks and is -not really suitable for any new drivers. Therefore it is not covered by this -document (refer to the source code to learn more about it). +the "legacy" one, in which the .suspend() and .resume() callbacks from struct +pci_driver are used. The legacy approach, however, doesn't allow one to define +runtime power management callbacks and is not really suitable for any new +drivers. Therefore it is not covered by this document (refer to the source code +to learn more about it). It is recommended that all PCI device drivers define a struct dev_pm_ops object containing pointers to power management (PM) callbacks that will be executed by diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index fc372c2d529a..e89fd90eaa93 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -599,32 +599,12 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state) static int pci_legacy_suspend_late(struct device *dev, pm_message_t state) { struct pci_dev *pci_dev = to_pci_dev(dev); - struct pci_driver *drv = pci_dev->driver; - - if (drv && drv->suspend_late) { - pci_power_t prev = pci_dev->current_state; - int error; - - error = drv->suspend_late(pci_dev, state); - suspend_report_result(drv->suspend_late, error); - if (error) - return error; - - if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0 - && pci_dev->current_state != PCI_UNKNOWN) { - pci_WARN_ONCE(pci_dev, pci_dev->current_state != prev, - "PCI PM: Device state not saved by %pS\n", - drv->suspend_late); - goto Fixup; - } - } if (!pci_dev->state_saved) pci_save_state(pci_dev); pci_pm_set_unknown_state(pci_dev); -Fixup: pci_fixup_device(pci_fixup_suspend_late, pci_dev); return 0; @@ -653,7 +633,7 @@ static void pci_pm_default_suspend(struct pci_dev *pci_dev) static bool pci_has_legacy_pm_support(struct pci_dev *pci_dev) { struct pci_driver *drv = pci_dev->driver; - bool ret = drv && (drv->suspend || drv->suspend_late || drv->resume); + bool ret = drv && (drv->suspend || drv->resume); /* * Legacy PM support is used by default, so warn if the new framework is diff --git a/include/linux/pci.h b/include/linux/pci.h index dd4596fc1208..9b0e35e09874 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -805,7 +805,6 @@ struct module; * The remove function always gets called from process * context, so it can sleep. * @suspend: Put device into low power state. - * @suspend_late: Put device into low power state. * @resume: Wake device from low power state. * (Please see Documentation/power/pci.rst for descriptions * of PCI Power Management and the related functions.) @@ -828,7 +827,6 @@ struct pci_driver { int (*probe)(struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ void (*remove)(struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ int (*suspend)(struct pci_dev *dev, pm_message_t state); /* Device suspended */ - int (*suspend_late)(struct pci_dev *dev, pm_message_t state); int (*resume)(struct pci_dev *dev); /* Device woken up */ void (*shutdown)(struct pci_dev *dev); int (*sriov_configure)(struct pci_dev *dev, int num_vfs); /* On PF */