Skip to contentSkip to conversation

nvme: Look for StorageD3Enable on the actual acpi device as well as root port

PATCH In review Mario Limonciello 2 participants 2 messages May 27, 2021 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: Look for StorageD3Enable on the actual acpi device as well as root port

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.

---
 drivers/nvme/host/pci.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/nvme/host/pci.c +13 -4
index a29b170701fc..4b7dd0cecd01 100644
@@ -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);
Signature · 7 lines
2.25.1


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme