Re: Regression from 7627a0edef54 ("ata: ahci: Drop low power policy board type") on reboot (but not cold boot)

Niklas Cassel
2025-03-11T14:14:38Z

Hello Hans, Eric,

On Mon, Mar 10, 2025 at 09:12:13PM +0100, Hans de Goede wrote:
>
> I agree with you that this is a BIOS bug of the motherboard in question
> and/or a bad interaction between the ATI SATA controller and Samsung SSD
> 870* models. Note that given the age of the motherboard there are likely
> not going to be any BIOS updates fixing this though.

Looking at the number of quirks for some of the ATI SB7x0/SB8x0/SB9x0 SATA
controllers, they really look like something special (not in a good way):
https://github.com/torvalds/linux/blob/v6.14-rc6/drivers/ata/ahci.c#L236-L244

-Ignore SError internal
-No MSI
-Max 255 sectors
-Broken 64-bit DMA
-Retry SRST (software reset)

And that is even without the weird "disable NCQ but only for Samsung SSD
8xx drives" quirk when using these ATI controllers.

What does bother me is that we don't know if it is this specific mobo/BIOS:
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: M5A99X EVO R2.0
Version: Rev 1.xx

M5A99X EVO R2.0 BIOS 2501
Version 2501
3.06 MB
2014/05/14

that should have a NOLPM quirk, like we do for specific BIOSes:
https://github.com/torvalds/linux/blob/v6.14-rc6/drivers/ata/ahci.c#L1402-L1439

Or if it this ATI SATA controller that is always broken when it comes
to LPM, regardless of the drive, or if it is only Samsung drives.

Considering the dmesg comparing cold boot, the Maxtor drive and the
ASUS ATAPI device seems to be recognized correctly.

Eric, could you please run:
$ sudo hdparm -I /dev/sdX | grep "interface power management"

on both your Samsung and Maxtor drive?
(A star to the left of feature means that the feature is enabled)

One guess... perhaps it could be Device Initiated PM that is broken with
these controllers? (Even though the controller does claim to support it.)

Eric, could you please try this patch:

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index f813dbdc2346..ca690fde8842 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -244,7 +244,7 @@ static const struct ata_port_info ahci_port_info[] = {
},
[board_ahci_sb700] = { /* for SB700 and SB800 */
AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL),
- .flags = AHCI_FLAG_COMMON,
+ .flags = AHCI_FLAG_COMMON | ATA_FLAG_NO_DIPM,
.pio_mask = ATA_PIO4,
.udma_mask = ATA_UDMA6,
.port_ops = &ahci_pmp_retry_srst_ops,

Normally, I do think that we need more reports, to see if it is just
this specific BIOS, or all the ATI SB7x0/SB8x0/SB9x0 SATA controllers
that are broken...

...but, considering how many quirks these ATI controllers have already...

...and the fact that the one (Dieter) who reported that his Samsung SSD 870
QVO could enter deeper sleep states just fine was running an Intel AHCI
controller (with the same FW version as Eric), I would be open to a patch
that sets ATA_FLAG_NO_LPM for all these ATI controllers.

Or a ATA_QUIRK_NO_LPM_ON_ATI, like you suggested, if we are certain that it
is only Samsung drives that don't work with these ATI SATA controllers.

Kind regards,
Niklas