All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] PCI: ACPI: Don't blindly trust `HotPlugSupportInD3`
@ 2022-03-10 17:58 Mario Limonciello
  2022-03-10 18:25 ` Rafael J. Wysocki
  2022-03-11 18:23 ` Bjorn Helgaas
  0 siblings, 2 replies; 7+ messages in thread
From: Mario Limonciello @ 2022-03-10 17:58 UTC (permalink / raw)
  To: Bjorn Helgaas, open list:PCI SUBSYSTEM
  Cc: linux-pm, Sanju.Mehta, Mario Limonciello, Mika Westerberg

The `_DSD` `HotPlugSupportInD3` is supposed to indicate the ability for a
bridge to be able to wakeup from D3.

This however is static information in the ACPI table at BIOS compilation
time and on some platforms it's possible to configure the firmware at boot
up such that `_S0W` will not return "0" indicating the inability to wake
up the device from D3.

To fix these situations explicitly check that the ACPI device has a GPE
allowing the device to generate wakeup signals handled by the platform
in `acpi_pci_bridge_d3`.

This changes aligns the handling of the situation the same as Windows 10
and Windows 11 both do as well.

Link: https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/07_Power_and_Performance_Mgmt/device-power-management-objects.html?highlight=s0w#s0w-s0-device-wake-state
Link: https://docs.microsoft.com/en-us/windows-hardware/drivers/pci/dsd-for-pcie-root-ports#identifying-pcie-root-ports-supporting-hot-plug-in-d3
Fixes: 26ad34d510a87 ("PCI / ACPI: Whitelist D3 for more PCIe hotplug ports")
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v1->v2:
 * Add Mika's tag
 * Update commit message for Rafael's suggestions
 drivers/pci/pci-acpi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index a42dbf448860..9f8f55ed09d9 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -999,6 +999,9 @@ bool acpi_pci_bridge_d3(struct pci_dev *dev)
 	if (!adev)
 		return false;
 
+	if (!adev->wakeup.flags.valid)
+		return false;
+
 	if (acpi_dev_get_property(adev, "HotPlugSupportInD3",
 				   ACPI_TYPE_INTEGER, &obj) < 0)
 		return false;
-- 
2.34.1


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

end of thread, other threads:[~2022-03-11 18:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10 17:58 [PATCH v2] PCI: ACPI: Don't blindly trust `HotPlugSupportInD3` Mario Limonciello
2022-03-10 18:25 ` Rafael J. Wysocki
2022-03-10 20:12   ` Limonciello, Mario
2022-03-11 16:05     ` Rafael J. Wysocki
2022-03-11 18:52       ` Limonciello, Mario
2022-03-11 18:23 ` Bjorn Helgaas
2022-03-11 18:51   ` Limonciello, Mario

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.