PCI/ACPI: Account for _S0W of the target bridge in acpi_pci_bridge_d3()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 12 Jan 2023 20:51:24 +0000 (21:51 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 13 Jan 2023 21:56:10 +0000 (15:56 -0600)
commit8133844a8f2434be9576850c6978179d7cca5c81
tree84fa8ea7145efeddd8e187906faf8091d9d01a0b
parent1b929c02afd37871d5afb9d498426f83432e71c2
PCI/ACPI: Account for _S0W of the target bridge in acpi_pci_bridge_d3()

It is questionable to allow a PCI bridge to go into D3 if it has _S0W
returning D2 or a shallower power state, so modify acpi_pci_bridge_d3(() to
always take the return value of _S0W for the target bridge into account.
That is, make it return 'false' if _S0W returns D2 or a shallower power
state for the target bridge regardless of its ancestor Root Port
properties.  Of course, this also causes 'false' to be returned if the Root
Port itself is the target and its _S0W returns D2 or a shallower power
state.

However, still allow bridges without _S0W that are power-manageable via
ACPI to enter D3 to retain the current code behavior in that case.

This fixes problems where a hotplug notification is missed because a bridge
is in D3.  That means hot-added devices such as USB4 docks (and the devices
they contain) and Thunderbolt 3 devices may not work.

Link: https://lore.kernel.org/linux-pci/20221031223356.32570-1-mario.limonciello@amd.com/
Link: https://lore.kernel.org/r/12155458.O9o76ZdvQC@kreacher
Reported-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/acpi/device_pm.c
drivers/pci/pci-acpi.c
include/acpi/acpi_bus.h