Re: Regression on linux-next (next-20250708)

Borah, Chaitanya Kumar
2025-07-29T08:58:38Z

On 7/29/2025 4:00 AM, Damien Le Moal wrote:
> On 7/29/25 01:33, Borah, Chaitanya Kumar wrote:
>>
>>
>> On 7/28/2025 11:01 AM, Damien Le Moal wrote:
>>> On 7/25/25 3:43 PM, Borah, Chaitanya Kumar wrote:
>>>> For some context in our kms_pm_rpm tests, we enable min_power policy for SATA
>>>> so that we can reach deep runtime power states and restore the original policy
>>>> after finishing. [5][6]
>>>>
>>>> IIUC, the above change is based on spec and not something which can be
>>>> reverted. So as I see it, we have to drop this code path for external ports.
>>>> However I am not sure if we can achieve deep power states without enforcing it
>>>> through the sysfs entry.
>>>>
>>>> Atleast for the basic-rte subtest, the test passes if we comment out the
>>>> functions controlling the SATA ports. We will need more testing to determine if
>>>> this approach work. Any thoughts on it?
>>>>
>>>> Also, are there other ways to detect a port is external other than receiving
>>>> EOPNOTSUPP on the sysfs write?
>>>
>>> I completely forgot to mention one important thing: please check your test
>>> machine BIOS settings and see if you have "hotplug support" set to enable for
>>> SATA ports. If it is, set that BIOS setting to disable and you will see the
>>> SATA port as a regular one, not as an external port. So LPM support will be
>>> back and your test program will not need changes.
>>>
>>> Not all BIOSes have such setting though. Most of the machine I have do have it
>>> though and I checked that it does affect how the ahci driver sees the port
>>> (external or regular with LPM).
>>>
>>>
>>
>> Found a "Hot Plug" setting (thanks to Mika!) in our testing device's
>> BIOS but it does not seem to have any effect.
>>
>> We also have an option called "External", toggling that did not help either.
>>
>> There is another configuration which was *readonly*.
>>
>> "Configured as eSATA" -> "Hot Plug supported"
>>
>> Not sure if it is relevant to our discussion.
>
> It is and that probably is the reason why disabling hotplug does nothing on the
> port external characteristic. Does this machine really have eSata ports ? Do
> they correspond to the 4 ports (out of 8) that you see as external
> (link_power_management_supported = 0 ports) ?
>

I can see the BIOS setting available for all 8 ports.

> Likely, you have the SXS host capability set for this machine because of this
> BIOS setup. From the AHCI specifications:
>
> Supports External SATA (SXS): When set to ‘1’, indicates that the HBA has one or
> more Serial ATA ports that has a signal only connector that is externally
> accessible (e.g. eSATA connector).
>
> Hotplug is reported as a separate bit, but handled in the same way as an
> external port as we cannot (easily) support LPM if we want to preserve the
> hotplug capability (LPM changes the PHY state constantly, which clashes with hot
> plug/unplug PHY changes and is hard to differentiate).
>
> Note that you can see if a port is external in dmesg. Look for:
>
> ata4: SATA max UDMA/133 abar m524288@0xaa500000 port 0xaa500280 irq 112 lpm-pol
> 1 ext
>
> A regular port will not have the "ext" at the end:
>
> ata5: SATA max UDMA/133 abar m524288@0xaa500000 port 0xaa500300 irq 112 lpm-pol 1

Thanks for the hint. I see the following logs with our default BIOS
configuration.

[ 6.125670] ata1: DUMMY
[ 6.125673] ata2: DUMMY
[ 6.125676] ata3: DUMMY
[ 6.125678] ata4: DUMMY
[ 6.125683] ata5: SATA max UDMA/133 abar m2048@0xb8263000 port
0xb8263300 irq 128 lpm-pol 4
[ 6.125693] ata6: SATA max UDMA/133 abar m2048@0xb8263000 port
0xb8263380 irq 128 lpm-pol 4
[ 6.125702] ata7: SATA max UDMA/133 abar m2048@0xb8263000 port
0xb8263400 irq 128 lpm-pol 4
[ 6.125711] ata8: SATA max UDMA/133 abar m2048@0xb8263000 port
0xb8263480 irq 128 lpm-pol 4

Enabling the "External" option in BIOS has impact on the "non-DUMMY"
ports but has no affect on the DUMMY ones.

After enabling the External option on port 1 and 7, the dmesg becomes.

[ 6.366145] ata1: DUMMY
[ 6.366148] ata2: DUMMY
[ 6.366151] ata3: DUMMY
[ 6.366153] ata4: DUMMY
[ 6.366160] ata5: SATA max UDMA/133 abar m2048@0xb8263000 port
0xb8263300 irq 128 lpm-pol 4
[ 6.366168] ata6: SATA max UDMA/133 abar m2048@0xb8263000 port
0xb8263380 irq 128 lpm-pol 4
[ 6.366174] ata7: SATA max UDMA/133 abar m2048@0xb8263000 port
0xb8263400 irq 128 lpm-pol 1 ext
[ 6.366182] ata8: SATA max UDMA/133 abar m2048@0xb8263000 port
0xb8263480 irq 128 lpm-pol 4

Also enabling "External" hides the "Configured as eSATA" option.

-Chaitanya