Skip to contentSkip to conversation

ACPI / hotplug / PCI: Runtime resume bridges before bus rescans

PATCH In review Rafael J. Wysocki 2 participants 4 messages Aug 5, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI / hotplug / PCI: Runtime resume bridges before bus rescans

From: Rafael J. Wysocki <[email protected]>

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.

---
 drivers/pci/hotplug/acpiphp_glue.c |    6 ++++++
 1 file changed, 6 insertions(+)
drivers/pci/hotplug/acpiphp_glue.c +6 -0
Index: 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);
 }
 
 /*
#1 lore raw
Quoted 6 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

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

#2 lore raw
Quoted 10 lines · Linus Torvalds
Quoted 6 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

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

#3 lore raw
Quoted 2 lines · Rafael J. Wysocki

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

Ok, NP.

Linus