diff mbox series

[4/5] ata: ahci: do not enable LPM on external ports

Message ID 20240201161507.1147521-5-cassel@kernel.org
State New
Headers show
Series drop low power policy board type | expand

Commit Message

Niklas Cassel Feb. 1, 2024, 4:15 p.m. UTC
The SATA specification contains a known incompatibility between LPM and
hot-plug events, thus do not enable LPM if the port advertises itself as
being an external SATA port (i.e. either hot-plug capable or eSATA).

This matches the power policy used in Microsoft Windows, which disables
LPM for external SATA ports, such that hot-plug events can be received.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
---
 drivers/ata/ahci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Damien Le Moal Feb. 2, 2024, 2:09 a.m. UTC | #1
On 2/2/24 01:15, Niklas Cassel wrote:
> The SATA specification contains a known incompatibility between LPM and
> hot-plug events, thus do not enable LPM if the port advertises itself as
> being an external SATA port (i.e. either hot-plug capable or eSATA).
> 
> This matches the power policy used in Microsoft Windows, which disables
> LPM for external SATA ports, such that hot-plug events can be received.
> 
> Signed-off-by: Niklas Cassel <cassel@kernel.org>
> ---
>  drivers/ata/ahci.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 19b605c98d42..d50d1ae44e7f 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -1664,6 +1664,14 @@ static void ahci_update_initial_lpm_policy(struct ata_port *ap)
>  	if (!(hpriv->flags & AHCI_HFLAG_USE_LPM_POLICY))
>  		return;
>  
> +	/*
> +	 * The SATA specification contains a known incompatibility between LPM
> +	 * and hot-plug events, thus do not enable LPM if the port advertises
> +	 * itself as an external port (i.e. either hot-plug capable or eSATA).
> +	 */

s/SATA/Serial ATA Revision 3.5a ?
s/contains/warns about ?

I see section 5.3.10 "Potential external SATA incompatibility issues" but it
does not mention LPM. Where is this stated in SATA-IO ?

> +	if (ap->pflags & ATA_PFLAG_EXTERNAL)
> +		return;
> +
>  	/* user modified policy via module param */
>  	if (mobile_lpm_policy != -1) {
>  		policy = mobile_lpm_policy;
diff mbox series

Patch

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 19b605c98d42..d50d1ae44e7f 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1664,6 +1664,14 @@  static void ahci_update_initial_lpm_policy(struct ata_port *ap)
 	if (!(hpriv->flags & AHCI_HFLAG_USE_LPM_POLICY))
 		return;
 
+	/*
+	 * The SATA specification contains a known incompatibility between LPM
+	 * and hot-plug events, thus do not enable LPM if the port advertises
+	 * itself as an external port (i.e. either hot-plug capable or eSATA).
+	 */
+	if (ap->pflags & ATA_PFLAG_EXTERNAL)
+		return;
+
 	/* user modified policy via module param */
 	if (mobile_lpm_policy != -1) {
 		policy = mobile_lpm_policy;