From patchwork Fri Aug 5 00:38:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 9264681 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 45D426048B for ; Fri, 5 Aug 2016 00:40:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 381E5283AC for ; Fri, 5 Aug 2016 00:40:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C98728415; Fri, 5 Aug 2016 00:40:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23D8D283AC for ; Fri, 5 Aug 2016 00:40:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934805AbcHEAkL (ORCPT ); Thu, 4 Aug 2016 20:40:11 -0400 Received: from cloudserver094114.home.net.pl ([79.96.170.134]:62401 "HELO cloudserver094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S934728AbcHEAkK (ORCPT ); Thu, 4 Aug 2016 20:40:10 -0400 Received: from 217.96.253.253.ipv4.supernova.orange.pl (217.96.253.253) (HELO vostro.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer v0.80.3) id c63f792d52b23df2; Fri, 5 Aug 2016 02:33:28 +0200 From: "Rafael J. Wysocki" To: Bjorn Helgaas Cc: Linux PM list , Linux PCI , Mika Westerberg , Linus Torvalds , Dave Airlie Subject: [PATCH] ACPI / hotplug / PCI: Runtime resume bridges before bus rescans Date: Fri, 05 Aug 2016 02:38:44 +0200 Message-ID: <5356594.Wd8M8VygiD@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/4.5.0-rc1+; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafael J. Wysocki If a PCI bridge (or PCIe port) that is runtime-suspended gets an ACPI hotplug notification, such as a bus check, it has to be resumed before re-scanning the devices below it, or those devices will not be accessible and will be treated as hot-removed. Make that happen and let the bridge suspend again after the bus below it has been re-scanned. This is a replacement for commit 16468c783cb4 (ACPI / hotplug / PCI: Runtime resume bridge before rescan) that has been reverted, because it introduced a system resume regression (due to missing bridge->pci_dev checks that are necessary in case the notification is targeted at the host bridge) and it is necessary for the code added by commit 006d44e49a25 (PCI: Add runtime PM support for PCIe ports) to work as expected. Tested-by: Linus Torvalds Signed-off-by: Rafael J. Wysocki --- drivers/pci/hotplug/acpiphp_glue.c | 6 ++++++ 1 file changed, 6 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-pm/drivers/pci/hotplug/acpiphp_glue.c =================================================================== --- linux-pm.orig/drivers/pci/hotplug/acpiphp_glue.c +++ linux-pm/drivers/pci/hotplug/acpiphp_glue.c @@ -675,6 +675,9 @@ static void acpiphp_check_bridge(struct if (bridge->is_going_away) return; + if (bridge->pci_dev) + pm_runtime_get_sync(&bridge->pci_dev->dev); + list_for_each_entry(slot, &bridge->slots, node) { struct pci_bus *bus = slot->bus; struct pci_dev *dev, *tmp; @@ -694,6 +697,9 @@ static void acpiphp_check_bridge(struct disable_slot(slot); } } + + if (bridge->pci_dev) + pm_runtime_put(&bridge->pci_dev->dev); } /*