Skip to content

Commit fa997b0

Browse files
committed
ata: ahci: Do not enable LPM if no LPM states are supported by the HBA
LPM consists of HIPM (host initiated power management) and DIPM (device initiated power management). ata_eh_set_lpm() will only enable HIPM if both the HBA and the device supports it. However, DIPM will be enabled as long as the device supports it. The HBA will later reject the device's request to enter a power state that it does not support (Slumber/Partial/DevSleep) (DevSleep is never initiated by the device). For a HBA that doesn't support any LPM states, simply don't set a LPM policy such that all the HIPM/DIPM probing/enabling will be skipped. Not enabling HIPM or DIPM in the first place is safer than relying on the device following the AHCI specification and respecting the NAK. (There are comments in the code that some devices misbehave when receiving a NAK.) Performing this check in ahci_update_initial_lpm_policy() also has the advantage that a HBA that doesn't support any LPM states will take the exact same code paths as a port that is external/hot plug capable. Side note: the port in ata_port_dbg() has not been given a unique id yet, but this is not overly important as the debug print is disabled unless explicitly enabled using dynamic debug. A follow-up series will make sure that the unique id assignment will be done earlier. For now, the important thing is that the function returns before setting the LPM policy. Fixes: 7627a0e ("ata: ahci: Drop low power policy board type") Cc: [email protected] Reviewed-by: Mario Limonciello <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Niklas Cassel <[email protected]>
1 parent a6a75ed commit fa997b0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/ata/ahci.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,6 +1735,14 @@ static void ahci_update_initial_lpm_policy(struct ata_port *ap)
17351735
if (ap->pflags & ATA_PFLAG_EXTERNAL)
17361736
return;
17371737

1738+
/* If no LPM states are supported by the HBA, do not bother with LPM */
1739+
if ((ap->host->flags & ATA_HOST_NO_PART) &&
1740+
(ap->host->flags & ATA_HOST_NO_SSC) &&
1741+
(ap->host->flags & ATA_HOST_NO_DEVSLP)) {
1742+
ata_port_dbg(ap, "no LPM states supported, not enabling LPM\n");
1743+
return;
1744+
}
1745+
17381746
/* user modified policy via module param */
17391747
if (mobile_lpm_policy != -1) {
17401748
policy = mobile_lpm_policy;

0 commit comments

Comments
 (0)