Re: Bug report for ahci-mvebu driver

marius
2023-01-19T18:46:21Z

January 19, 2023 2:29 AM, "Damien Le Moal" <damien.lemoal@opensource.wdc.com> wrote:

> On 2023/01/19 4:43, marius@psihoexpert.ro wrote:
>
>> [ 73.075849][ T112] hardreset, Online=>Offline
>> [ 73.075856][ T112] sata_set_spd_needed, scontrol=0x300
>> [ 73.080328][ T112] __sata_set_spd_needed, initial limit=0xFFFFFFFF
>> [ 73.085601][ T112] __sata_set_spd_needed, corrected limit=0xFFFFFFFF
>> [ 73.091900][ T112] __sata_set_spd_needed, target=0x0
>> [ 73.098386][ T112] __sata_set_spd_needed, spd=0x0
>> [ 73.103475][ T112] __sata_set_spd_needed, final *scontrol=0x300
>
> Can you share the patch/diff printing these ? Just to be sure I look at the
> right place :)

--- a/drivers/ata/libata-sata.c
+++ b/drivers/ata/libata-sata.c
@@ -427,6 +430,7 @@ static int __sata_set_spd_needed(struct ata_link *link, u32 *scontrol)
u32 limit, target, spd;

limit = link->sata_spd_limit;
+ printk(KERN_DEBUG "__sata_set_spd_needed, initial limit=0x%X",limit);

/* Don't configure downstream link faster than upstream link.
* It doesn't speed up anything and some PMPs choke on such
@@ -435,14 +439,18 @@ static int __sata_set_spd_needed(struct ata_link *link, u32 *scontrol)
if (!ata_is_host_link(link) && host_link->sata_spd)
limit &= (1 << host_link->sata_spd) - 1;

+ printk(KERN_DEBUG "__sata_set_spd_needed, corrected limit=0x%X",limit);
if (limit == UINT_MAX)
target = 0;
else
target = fls(limit);

+ printk(KERN_DEBUG "__sata_set_spd_needed, target=0x%X",target);
spd = (*scontrol >> 4) & 0xf;
*scontrol = (*scontrol & ~0xf0) | ((target & 0xf) << 4);

+ printk(KERN_DEBUG "__sata_set_spd_needed, spd=0x%X",spd);
+ printk(KERN_DEBUG "__sata_set_spd_needed, final *scontrol=0x%X",*scontrol);
return spd != target;
}

@@ -467,6 +475,7 @@ static int sata_set_spd_needed(struct ata_link *link)

if (sata_scr_read(link, SCR_CONTROL, &scontrol))
return 1;
+ printk(KERN_DEBUG "sata_set_spd_needed, scontrol=0x%X",scontrol);

return __sata_set_spd_needed(link, &scontrol);
}

Marius Dinu