Skip to contentSkip to conversation

ATA: ACPI: Do not check ACPI_FADT_LOW_POWER_S0

PATCH Superseded Rafael J. Wysocki 3 participants 4 messages Aug 24, 2022 – Aug 25, 2022

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ATA: ACPI: Do not check ACPI_FADT_LOW_POWER_S0

From: Rafael J. Wysocki <[email protected]>

The ACPI_FADT_LOW_POWER_S0 flag merely means that it is better to use low-power S0 idle on the given platform than S3 (provided that the latter is supported) and it doesn't preclude using either of them (which of them will be used depends on the choices made by user space).

For this reason, there is no benefit from checking that flag in ahci_update_initial_lpm_policy().

First off, it cannot be a bug to do S3 with policy set to either ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER, because S3 can be used on systems with ACPI_FADT_LOW_POWER_S0 set and it must work if really supported, so the ACPI_FADT_LOW_POWER_S0 check is not needed to protect the S3-capable systems from failing.

Second, suspend-to-idle can be carried out on a system with ACPI_FADT_LOW_POWER_S0 unset and it is expected to work, so if setting policy to either ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER is needed to handle that case correctly, it should be done regardless of the ACPI_FADT_LOW_POWER_S0 value.

Accordingly, drop the ACPI_FADT_LOW_POWER_S0 check from ahci_update_initial_lpm_policy().

---
 drivers/ata/ahci.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/ata/ahci.c +1 -2
Index: linux-pm/drivers/ata/ahci.c
===================================================================
@@ -1610,8 +1610,7 @@ static void ahci_update_initial_lpm_poli
 	}
 
 #ifdef CONFIG_ACPI
-	if (policy > ATA_LPM_MED_POWER &&
-	    (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
+	if (policy > ATA_LPM_MED_POWER) {
 		if (hpriv->cap & HOST_CAP_PART)
 			policy = ATA_LPM_MIN_POWER_WITH_PARTIAL;
 		else if (hpriv->cap & HOST_CAP_SSC)
#1 lore raw
Quoted 1 line · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

The patch title should be "ata: ahci: ..."

Quoted 47 lines

The ACPI_FADT_LOW_POWER_S0 flag merely means that it is better to use low-power S0 idle on the given platform than S3 (provided that the latter is supported) and it doesn't preclude using either of them (which of them will be used depends on the choices made by user space).

For this reason, there is no benefit from checking that flag in ahci_update_initial_lpm_policy().

First off, it cannot be a bug to do S3 with policy set to either ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER, because S3 can be used on systems with ACPI_FADT_LOW_POWER_S0 set and it must work if really supported, so the ACPI_FADT_LOW_POWER_S0 check is not needed to protect the S3-capable systems from failing.

Second, suspend-to-idle can be carried out on a system with ACPI_FADT_LOW_POWER_S0 unset and it is expected to work, so if setting policy to either ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER is needed to handle that case correctly, it should be done regardless of the ACPI_FADT_LOW_POWER_S0 value.

Accordingly, drop the ACPI_FADT_LOW_POWER_S0 check from ahci_update_initial_lpm_policy().

---
 drivers/ata/ahci.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: linux-pm/drivers/ata/ahci.c
===================================================================

drivers/ata/ahci.c +1 -2
@@ -1610,8 +1610,7 @@ static void ahci_update_initial_lpm_poli
 	}
 
 #ifdef CONFIG_ACPI
-	if (policy > ATA_LPM_MED_POWER &&
-	    (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
+	if (policy > ATA_LPM_MED_POWER) {
 		if (hpriv->cap & HOST_CAP_PART)
 			policy = ATA_LPM_MIN_POWER_WITH_PARTIAL;
 		else if (hpriv->cap & HOST_CAP_SSC)
Signature · 2 lines
Damien Le Moal
Western Digital Research
#2 lore raw
Quoted 42 lines · Damien Le Moal
Quoted 1 line · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

The patch title should be "ata: ahci: ..."

Quoted 37 lines

The ACPI_FADT_LOW_POWER_S0 flag merely means that it is better to use low-power S0 idle on the given platform than S3 (provided that the latter is supported) and it doesn't preclude using either of them (which of them will be used depends on the choices made by user space).

For this reason, there is no benefit from checking that flag in ahci_update_initial_lpm_policy().

First off, it cannot be a bug to do S3 with policy set to either ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER, because S3 can be used on systems with ACPI_FADT_LOW_POWER_S0 set and it must work if really supported, so the ACPI_FADT_LOW_POWER_S0 check is not needed to protect the S3-capable systems from failing.

Second, suspend-to-idle can be carried out on a system with ACPI_FADT_LOW_POWER_S0 unset and it is expected to work, so if setting policy to either ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER is needed to handle that case correctly, it should be done regardless of the ACPI_FADT_LOW_POWER_S0 value.

Accordingly, drop the ACPI_FADT_LOW_POWER_S0 check from ahci_update_initial_lpm_policy().

---
  drivers/ata/ahci.c |    3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

Index: linux-pm/drivers/ata/ahci.c
===================================================================

drivers/ata/ahci.c +0 -0
@@ -1610,8 +1610,7 @@ static void ahci_update_initial_lpm_poli
  	}
 
Quoted 4 lines

drivers/ata/ahci.c static void ahci_update_initial_lpm_poli · line 1613

Quoted 4 lines
drivers/ata/ahci.c +1 -2
  #ifdef CONFIG_ACPI
-	if (policy > ATA_LPM_MED_POWER &&
-	    (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
+	if (policy > ATA_LPM_MED_POWER) {

If making this change, perhaps the #ifdef CONFIG_ACPI can drop too.

Quoted 8 lines
Quoted 6 lines
drivers/ata/ahci.c +0 -0
  		if (hpriv->cap & HOST_CAP_PART)
  			policy = ATA_LPM_MIN_POWER_WITH_PARTIAL;
  		else if (hpriv->cap & HOST_CAP_SSC)
#3 lore raw
Quoted 43 lines · Mario Limonciello
Quoted 42 lines · Damien Le Moal
Quoted 1 line · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

The patch title should be "ata: ahci: ..."

Quoted 37 lines

The ACPI_FADT_LOW_POWER_S0 flag merely means that it is better to use low-power S0 idle on the given platform than S3 (provided that the latter is supported) and it doesn't preclude using either of them (which of them will be used depends on the choices made by user space).

For this reason, there is no benefit from checking that flag in ahci_update_initial_lpm_policy().

First off, it cannot be a bug to do S3 with policy set to either ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER, because S3 can be used on systems with ACPI_FADT_LOW_POWER_S0 set and it must work if really supported, so the ACPI_FADT_LOW_POWER_S0 check is not needed to protect the S3-capable systems from failing.

Second, suspend-to-idle can be carried out on a system with ACPI_FADT_LOW_POWER_S0 unset and it is expected to work, so if setting policy to either ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER is needed to handle that case correctly, it should be done regardless of the ACPI_FADT_LOW_POWER_S0 value.

Accordingly, drop the ACPI_FADT_LOW_POWER_S0 check from ahci_update_initial_lpm_policy().

---
  drivers/ata/ahci.c |    3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

Index: linux-pm/drivers/ata/ahci.c
===================================================================

drivers/ata/ahci.c +0 -0
@@ -1610,8 +1610,7 @@ static void ahci_update_initial_lpm_poli
  	}
 
Quoted 6 lines
Quoted 4 lines

drivers/ata/ahci.c static void ahci_update_initial_lpm_poli · line 1613

Quoted 4 lines
drivers/ata/ahci.c +1 -2
  #ifdef CONFIG_ACPI
-	if (policy > ATA_LPM_MED_POWER &&
-	    (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
+	if (policy > ATA_LPM_MED_POWER) {

If making this change, perhaps the #ifdef CONFIG_ACPI can drop too.

Indeed.

Quoted 10 lines
Quoted 9 lines
Quoted 7 lines
drivers/ata/ahci.c +0 -0
  		if (hpriv->cap & HOST_CAP_PART)
  			policy = ATA_LPM_MIN_POWER_WITH_PARTIAL;
  		else if (hpriv->cap & HOST_CAP_SSC)
Signature · 2 lines
Damien Le Moal
Western Digital Research