diff mbox series

[06/10] ata: ahci: Disable DIPM if host lacks support

Message ID 20250630062637.258329-7-dlemoal@kernel.org
State New
Headers show
Series Improve link power management | expand

Commit Message

Damien Le Moal June 30, 2025, 6:26 a.m. UTC
The AHCI specification version 1.3.1 section 8.3.1.4 (Software
Requirements and Precedence) states that:

If CAP.SSC or CAP.PSC is cleared to ‘0’, software should disable
device-initiated power management by issuing the appropriate SET
FEATURES command to the device.

To satisfy this constraint and force ata_dev_configure to disable the
device DIPM feature, modify ahci_update_initial_lpm_policy() to set the
ATA_FLAG_NO_DIPM flag on ports that have a host with either the
ATA_HOST_NO_PART flag set or the ATA_HOST_NO_SSC flag set.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 drivers/ata/ahci.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Niklas Cassel June 30, 2025, 2:50 p.m. UTC | #1
On Mon, Jun 30, 2025 at 03:26:33PM +0900, Damien Le Moal wrote:
> The AHCI specification version 1.3.1 section 8.3.1.4 (Software
> Requirements and Precedence) states that:
> 
> If CAP.SSC or CAP.PSC is cleared to ‘0’, software should disable
> device-initiated power management by issuing the appropriate SET
> FEATURES command to the device.
> 
> To satisfy this constraint and force ata_dev_configure to disable the
> device DIPM feature, modify ahci_update_initial_lpm_policy() to set the
> ATA_FLAG_NO_DIPM flag on ports that have a host with either the
> ATA_HOST_NO_PART flag set or the ATA_HOST_NO_SSC flag set.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

Reviewed-by: Niklas Cassel <cassel@kernel.org>
Hannes Reinecke July 1, 2025, 6:23 a.m. UTC | #2
On 6/30/25 08:26, Damien Le Moal wrote:
> The AHCI specification version 1.3.1 section 8.3.1.4 (Software
> Requirements and Precedence) states that:
> 
> If CAP.SSC or CAP.PSC is cleared to ‘0’, software should disable
> device-initiated power management by issuing the appropriate SET
> FEATURES command to the device.
> 
> To satisfy this constraint and force ata_dev_configure to disable the
> device DIPM feature, modify ahci_update_initial_lpm_policy() to set the
> ATA_FLAG_NO_DIPM flag on ports that have a host with either the
> ATA_HOST_NO_PART flag set or the ATA_HOST_NO_SSC flag set.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>   drivers/ata/ahci.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 1b4151d95888..0760fa47d90e 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -1780,6 +1780,13 @@ static void ahci_update_initial_lpm_policy(struct ata_port *ap)
>   		return;
>   	}
>   
> +	/* If no Partial or no Slumber, we cannot support DIPM. */
> +	if ((ap->host->flags & ATA_HOST_NO_PART) ||
> +	    (ap->host->flags & ATA_HOST_NO_SSC)) {
> +		ata_port_dbg(ap, "Host does not support DIPM\n");
> +		ap->flags |= ATA_FLAG_NO_DIPM;
> +	}
> +
>   	/* If no LPM states are supported by the HBA, do not bother with LPM */
>   	if ((ap->host->flags & ATA_HOST_NO_PART) &&
>   	    (ap->host->flags & ATA_HOST_NO_SSC) &&

Reviewed-by: Hannes Reinecke <hare@suse.de.

Cheers,

Hannes
diff mbox series

Patch

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 1b4151d95888..0760fa47d90e 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1780,6 +1780,13 @@  static void ahci_update_initial_lpm_policy(struct ata_port *ap)
 		return;
 	}
 
+	/* If no Partial or no Slumber, we cannot support DIPM. */
+	if ((ap->host->flags & ATA_HOST_NO_PART) ||
+	    (ap->host->flags & ATA_HOST_NO_SSC)) {
+		ata_port_dbg(ap, "Host does not support DIPM\n");
+		ap->flags |= ATA_FLAG_NO_DIPM;
+	}
+
 	/* If no LPM states are supported by the HBA, do not bother with LPM */
 	if ((ap->host->flags & ATA_HOST_NO_PART) &&
 	    (ap->host->flags & ATA_HOST_NO_SSC) &&