All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: Look for StorageD3Enable on the actual acpi device as well as root port
@ 2021-05-27  2:38 Mario Limonciello
  2021-05-27 11:37 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Mario Limonciello @ 2021-05-27  2:38 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg
  Cc: open list:NVM EXPRESS DRIVER, Mario Limonciello, Prike Liang,
	Shyam-sundar S-k, Alexander Deucher, Hans de Goede,
	Rafael J. Wysocki

The documentation around the StorageD3Enable property wasn't prescriptive
on which device in the hierarchy should contain it.

The existing logic was intended for usage on Intel-based systems where the
root port contained the StorageD3Enable property.

On AMD systems the StorageD3Enable property is directly on the device
itself.

Link: https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/power-management-for-storage-hardware-devices-intro
Suggested-by: Prike Liang <Prike.Liang@amd.com>
CC: Shyam-sundar S-k <Shyam-sundar.S-k@amd.com>
CC: Alexander Deucher <Alexander.Deucher@amd.com>
CC: Hans de Goede <hdegoede@redhat.com>
CC: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/nvme/host/pci.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index a29b170701fc..4b7dd0cecd01 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2842,6 +2842,19 @@ static bool nvme_acpi_storage_d3(struct pci_dev *dev)
 	 * must use D3 to support deep platform power savings during
 	 * suspend-to-idle.
 	 */
+
+	/* First check the device itself for this property */
+	adev = ACPI_COMPANION(&dev->dev);
+	if (adev) {
+		fwnode_property_read_u8(acpi_fwnode_handle(adev), "StorageD3Enable", &val);
+		if (val == 1)
+			return true;
+	}
+
+	/*
+	 * For Intel systems the property is defined in the PXSX device for South
+	 * complex ports and in the PEGP device for North complex ports.
+	 */
 	root = pcie_find_root_port(dev);
 	if (!root)
 		return false;
@@ -2850,10 +2863,6 @@ static bool nvme_acpi_storage_d3(struct pci_dev *dev)
 	if (!adev)
 		return false;
 
-	/*
-	 * The property is defined in the PXSX device for South complex ports
-	 * and in the PEGP device for North complex ports.
-	 */
 	status = acpi_get_handle(adev->handle, "PXSX", &handle);
 	if (ACPI_FAILURE(status)) {
 		status = acpi_get_handle(adev->handle, "PEGP", &handle);
-- 
2.25.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH] nvme: Look for StorageD3Enable on the actual acpi device as well as root port
  2021-05-27  2:38 [PATCH] nvme: Look for StorageD3Enable on the actual acpi device as well as root port Mario Limonciello
@ 2021-05-27 11:37 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2021-05-27 11:37 UTC (permalink / raw)
  To: Mario Limonciello
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	open list:NVM EXPRESS DRIVER, Prike Liang, Shyam-sundar S-k,
	Alexander Deucher, Hans de Goede, Rafael J. Wysocki

We currently have a proposal on the list to only use the ACPI companion.
Can you chime in there?

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

end of thread, other threads:[~2021-05-27 11:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27  2:38 [PATCH] nvme: Look for StorageD3Enable on the actual acpi device as well as root port Mario Limonciello
2021-05-27 11:37 ` Christoph Hellwig

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.