Re: Bug report for ahci-mvebu driver

Damien Le Moal
2023-01-17T08:27:05Z

On 1/15/23 03:01, marius@psihoexpert.ro wrote:
> Do you need any more tests?
>
>
> December 9, 2022 8:30 PM, marius@psihoexpert.ro wrote:
>
>> December 9, 2022 11:28 AM, "Damien Le Moal" <damien.lemoal@opensource.wdc.com> wrote:
>>
>>>> [ 19.006105][ T113] Reconfig spd
>>>
>>> Which function did you add this message to ?
>>
>> sata_link_hardreset(), inside if(sata_set_spd_needed(link)){} condition,
>> but I replaced it with detailed debug inside sata_set_spd_needed() and ___sata_set_spd_needed()

Could you try adding messages in the function sata_down_spd_limit() ?
I recall that during probe, scr status does not give a current speed,
which creates the problem of triggering that "return -EINVAL" in the else
for "if (spd > 1)"...

What I would like you to print is:

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 884ae73b11ea..ad68f86be1c5 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3081,14 +3081,21 @@ int sata_down_spd_limit(struct ata_link *link, u32
spd_limit)
if (!sata_scr_valid(link))
return -EOPNOTSUPP;

+ pr_info("sata_down_spd_limit: limit 0x%0x, cur spd 0x%0x, "
+ "saved limit 0x%0x, hw limit 0x%0x\n",
+ spd_limit, link->sata_spd
+ link->sata_spd_limit, link->hw_sata_spd_limit);
+
/* If SCR can be read, use it to determine the current SPD.
* If not, use cached value in link->sata_spd.
*/
rc = sata_scr_read(link, SCR_STATUS, &sstatus);
- if (rc == 0 && ata_sstatus_online(sstatus))
+ if (rc == 0 && ata_sstatus_online(sstatus)) {
spd = (sstatus >> 4) & 0xf;
- else
+ pr_info("spd from STS: 0x%0x\n", spd);
+ } else {
spd = link->sata_spd;
+ }

mask = link->sata_spd_limit;
if (mask <= 1)

Please try printing that in addition to the messages you already have. And
please try with default boot (no ata options) and with the 1.5gbps force
(since that is the only one working).