From: Niklas Cassel <cassel@kernel.org>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: linux-ide@vger.kernel.org, wolf@yoxt.cc
Subject: Re: [PATCH v2 3/6] ata: libata-sata: Improve link_power_management_supported sysfs attribute
Date: Mon, 12 Jan 2026 16:08:31 +0100 [thread overview]
Message-ID: <aWUOb4Q2NfAVkt86@ryzen> (raw)
In-Reply-To: <698e738b-5ad2-4c03-ad5c-837123872a10@kernel.org>
On Mon, Jan 12, 2026 at 04:05:18PM +0100, Damien Le Moal wrote:
> On 1/12/26 15:39, Niklas Cassel wrote:
> > I'm not sure if we should set sysfs attribute
> > link_power_management_supported == false if ATA_LFLAG_NO_LPM is set
> > (Currently we don't). Because if so, the sysfs supported attribute could
> > potentially change value during runtime, isn't it supposed to be static?
> >
> > If we really want to, I guess we could do something like:
> >
> > diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
> > index 04e1e774645e..1134943f49ae 100644
> > --- a/drivers/ata/libata-sata.c
> > +++ b/drivers/ata/libata-sata.c
> > @@ -913,6 +913,8 @@ static bool ata_scsi_lpm_supported(struct ata_port *ap)
> > return false;
> >
> > ata_for_each_link(link, ap, EDGE) {
> > + if (link->flags & ATA_LFLAG_NO_LPM)
> > + return false;
>
> Yeah, I think we need this. NO_LPM == max power, but cannot be changed. That's
> the same as for external ports. So we should report not supported so that
> userspace cannot change it.
ata_scsi_lpm_supported() already checks port flag ATA_FLAG_NO_LPM:
https://github.com/torvalds/linux/blob/v6.19-rc5/drivers/ata/libata-sata.c#L912-L913
Port flag ATA_FLAG_NO_LPM:
call .set_lpm() with ATA_LPM_MAX_POWER.
Link flag ATA_LFLAG_NO_LPM:
we called .set_lpm() on
the port, but the device disappeared from the port when doing so,
so make futher calls to set_lpm() for this link a no-op...
(No idea why it doesn't instead call set_lpm() with ATA_LPM_MAX_POWER?)
Kind regards,
Niklas
next prev parent reply other threads:[~2026-01-12 15:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 12:20 [PATCH v2 0/6] misc LPM related fixes Niklas Cassel
2026-01-12 12:20 ` [PATCH v2 1/6] ata: ahci: Do not read the per port area for unimplemented ports Niklas Cassel
2026-01-12 12:20 ` [PATCH v2 2/6] ata: libata: Call ata_dev_config_lpm() for ATAPI devices Niklas Cassel
2026-01-12 12:20 ` [PATCH v2 3/6] ata: libata-sata: Improve link_power_management_supported sysfs attribute Niklas Cassel
2026-01-12 13:17 ` Damien Le Moal
2026-01-12 14:39 ` Niklas Cassel
2026-01-12 15:05 ` Damien Le Moal
2026-01-12 15:08 ` Niklas Cassel [this message]
2026-01-12 12:20 ` [PATCH v2 4/6] ata: libata: Add cpr_log to ata_dev_print_features() early return Niklas Cassel
2026-01-12 12:20 ` [PATCH v2 5/6] ata: libata: Add DIPM and HIPM " Niklas Cassel
2026-01-12 12:20 ` [PATCH v2 6/6] ata: libata: Print features also for ATAPI devices Niklas Cassel
2026-01-12 16:12 ` [PATCH v2 0/6] misc LPM related fixes wolf
2026-01-13 10:02 ` 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=aWUOb4Q2NfAVkt86@ryzen \
--to=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=wolf@yoxt.cc \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox