From: Niklas Cassel <cassel@kernel.org>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: linux-ide@vger.kernel.org
Subject: Re: [PATCH v2 07/10] ata: ahci: Disallow LPM policy control for external ports
Date: Tue, 1 Jul 2025 11:43:34 +0200 [thread overview]
Message-ID: <aGOtxhQUNy0OJLA2@ryzen> (raw)
In-Reply-To: <20250701001408.330364-8-dlemoal@kernel.org>
On Tue, Jul 01, 2025 at 09:14:05AM +0900, Damien Le Moal wrote:
> Commit ae1f3db006b7 ("ata: ahci: do not enable LPM on external ports")
> added an early return in ahci_update_initial_lpm_policy() for all
> ports flagged as external with the ATA_PFLAG_EXTERNAL port flag (e.g.
> eSATA ports or hotplug capable ports) so that the target_lpm_policy of
> these ports is unchanged and set to ATA_LPM_UNKNOWN. thus forcing libata
> EH to not be called for external port. The goal of this change is to
> preserve the initial power management policy to not break the hotplug
> capability of external ports.
>
> However, this change is incomplete as users or system daemon (e.g.
> systemd-udevd) can still apply the system preferred power management
> policy through sysfs, thus potentially unknowingly breaking the port
> hotplug capability.
>
> Modify ahci_update_initial_lpm_policy() to flag external ports with
> ATA_FLAG_NO_LPM to prevent changes to the LPM policy by users through
> the sysfs link_power_management_policy host attribute. Also set the
> target_lpm_policy of external ports to ATA_LPM_MAX_POWER to ensure
> that the port is not in a low power state preventing hotplug operations.
>
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Perhaps also mention that debug message is removed because since
commit 439d47608bb3 ("ata: libata: Print if port is external on boot")
it is printed unconditionally at boot.
With that:
Reviewed-by: Niklas Cassel <cassel@kernel.org>
> ---
> drivers/ata/ahci.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 0760fa47d90e..a061aa3299ef 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -1776,7 +1776,8 @@ static void ahci_update_initial_lpm_policy(struct ata_port *ap)
> * LPM if the port advertises itself as an external port.
> */
> if (ap->pflags & ATA_PFLAG_EXTERNAL) {
> - ata_port_dbg(ap, "external port, not enabling LPM\n");
> + ap->flags |= ATA_FLAG_NO_LPM;
> + ap->target_lpm_policy = ATA_LPM_MAX_POWER;
> return;
> }
>
> --
> 2.50.0
>
next prev parent reply other threads:[~2025-07-01 9:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-01 0:13 [PATCH v2 00/10] Improve link power management Damien Le Moal
2025-07-01 0:13 ` [PATCH v2 01/10] ata: libata-core: Introduce ata_dev_config_lpm() Damien Le Moal
2025-07-01 10:41 ` Niklas Cassel
2025-07-01 0:14 ` [PATCH v2 02/10] ata: libata-core: Move device LPM quirk settings to ata_dev_config_lpm() Damien Le Moal
2025-07-01 0:14 ` [PATCH v2 03/10] ata: libata-core: Advertize device support for DIPM and HIPM features Damien Le Moal
2025-07-01 0:14 ` [PATCH v2 04/10] ata: libata-eh: Avoid unnecessary resets when revalidating devices Damien Le Moal
2025-07-01 0:14 ` [PATCH v2 05/10] ata: libata-sata: Disallow changing LPM state if not supported Damien Le Moal
2025-07-01 0:14 ` [PATCH v2 06/10] ata: ahci: Disable DIPM if host lacks support Damien Le Moal
2025-07-01 0:14 ` [PATCH v2 07/10] ata: ahci: Disallow LPM policy control for external ports Damien Le Moal
2025-07-01 9:43 ` Niklas Cassel [this message]
2025-07-01 0:14 ` [PATCH v2 08/10] ata: ahci: Disallow LPM policy control if not supported Damien Le Moal
2025-07-01 9:44 ` Niklas Cassel
2025-07-01 0:14 ` [PATCH v2 09/10] ata: libata-core: Reduce the number of messages signaling broken LPM Damien Le Moal
2025-07-01 0:14 ` [PATCH v2 10/10] ata: libata_eh: Add debug messages to ata_eh_link_set_lpm() Damien Le Moal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aGOtxhQUNy0OJLA2@ryzen \
--to=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.