[PATCH] nvme: Look for StorageD3Enable on the actual acpi device as well as root port
Mario Limonciello
mario.limonciello at amd.com
Wed May 26 19:38:07 PDT 2021
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 at amd.com>
CC: Shyam-sundar S-k <Shyam-sundar.S-k at amd.com>
CC: Alexander Deucher <Alexander.Deucher at amd.com>
CC: Hans de Goede <hdegoede at redhat.com>
CC: "Rafael J. Wysocki" <rjw at rjwysocki.net>
Signed-off-by: Mario Limonciello <mario.limonciello at 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
More information about the Linux-nvme
mailing list