linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Linux PM list <linux-pm@vger.kernel.org>,
	Linux PCI <linux-pci@vger.kernel.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Dave Airlie <airlied@linux.ie>
Subject: [PATCH] ACPI / hotplug / PCI: Runtime resume bridges before bus rescans
Date: Fri, 05 Aug 2016 02:38:44 +0200	[thread overview]
Message-ID: <5356594.Wd8M8VygiD@vostro.rjw.lan> (raw)

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

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 <torvalds@linux-foundation.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/pci/hotplug/acpiphp_glue.c |    6 ++++++
 1 file changed, 6 insertions(+)

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);
 }
 
 /*


             reply	other threads:[~2016-08-05  0:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-05  0:38 Rafael J. Wysocki [this message]
2016-08-05  0:53 ` [PATCH] ACPI / hotplug / PCI: Runtime resume bridges before bus rescans Linus Torvalds
2016-08-05  1:05   ` Rafael J. Wysocki
2016-08-05  1:32     ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5356594.Wd8M8VygiD@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=airlied@linux.ie \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).