Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] ACPI / hotplug / PCI: Runtime resume bridges before bus rescans
@ 2016-08-05  0:38 Rafael J. Wysocki
  2016-08-05  0:53 ` Linus Torvalds
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2016-08-05  0:38 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Linux PM list, Linux PCI, Mika Westerberg, Linus Torvalds,
	Dave Airlie

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI / hotplug / PCI: Runtime resume bridges before bus rescans
  2016-08-05  0:38 [PATCH] ACPI / hotplug / PCI: Runtime resume bridges before bus rescans Rafael J. Wysocki
@ 2016-08-05  0:53 ` Linus Torvalds
  2016-08-05  1:05   ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Torvalds @ 2016-08-05  0:53 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Bjorn Helgaas, Linux PM list, Linux PCI, Mika Westerberg,
	Dave Airlie

On Thu, Aug 4, 2016 at 8:38 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> 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.

Just checking: do you want me to apply this as a patch, or are you
adding it to your git tree and just cc'ing me as a FYI?

           Linus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI / hotplug / PCI: Runtime resume bridges before bus rescans
  2016-08-05  0:53 ` Linus Torvalds
@ 2016-08-05  1:05   ` Rafael J. Wysocki
  2016-08-05  1:32     ` Linus Torvalds
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2016-08-05  1:05 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Bjorn Helgaas, Linux PM list, Linux PCI, Mika Westerberg,
	Dave Airlie

On Thursday, August 04, 2016 08:53:14 PM Linus Torvalds wrote:
> On Thu, Aug 4, 2016 at 8:38 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> > 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.
> 
> Just checking: do you want me to apply this as a patch, or are you
> adding it to your git tree and just cc'ing me as a FYI?

Please apply it directly if that's not a problem.

Thanks,
Rafael


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI / hotplug / PCI: Runtime resume bridges before bus rescans
  2016-08-05  1:05   ` Rafael J. Wysocki
@ 2016-08-05  1:32     ` Linus Torvalds
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Torvalds @ 2016-08-05  1:32 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Bjorn Helgaas, Linux PM list, Linux PCI, Mika Westerberg,
	Dave Airlie

On Thu, Aug 4, 2016 at 9:05 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>
> Please apply it directly if that's not a problem.

Ok, NP.

           Linus

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-05  1:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-05  0:38 [PATCH] ACPI / hotplug / PCI: Runtime resume bridges before bus rescans Rafael J. Wysocki
2016-08-05  0:53 ` Linus Torvalds
2016-08-05  1:05   ` Rafael J. Wysocki
2016-08-05  1:32     ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox