Patch "ata: libata: Fix sata_down_spd_limit() when no link speed is reported" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ata: libata: Fix sata_down_spd_limit() when no link speed is reported

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ata-libata-fix-sata_down_spd_limit-when-no-link-spee.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit fd1f8f519120ec06fd5aed93146284dfbdf9b3da
Author: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx>
Date:   Mon Jan 30 12:27:41 2023 +0900

    ata: libata: Fix sata_down_spd_limit() when no link speed is reported
    
    [ Upstream commit 69f2c9346313ba3d3dfa4091ff99df26c67c9021 ]
    
    Commit 2dc0b46b5ea3 ("libata: sata_down_spd_limit should return if
    driver has not recorded sstatus speed") changed the behavior of
    sata_down_spd_limit() to return doing nothing if a drive does not report
    a current link speed, to avoid reducing the link speed to the lowest 1.5
    Gbps speed.
    
    However, the change assumed that a speed was recorded before probing
    (e.g. before a suspend/resume) and set in link->sata_spd. This causes
    problems with adapters/drives combination failing to establish a link
    speed during probe autonegotiation. One example reported of this problem
    is an mvebu adapter with a 3Gbps port-multiplier box: autonegotiation
    fails, leaving no recorded link speed and no reported current link
    speed. Probe retries also fail as no action is taken by sata_set_spd()
    after each retry.
    
    Fix this by returning early in sata_down_spd_limit() only if we do have
    a recorded link speed, that is, if link->sata_spd is not 0. With this
    fix, a failed probe not leading to a recorded link speed is retried at
    the lower 1.5 Gbps speed, with the link speed potentially increased
    later on the second revalidate of the device if the device reports
    that it supports higher link speeds.
    
    Reported-by: Marius Dinu <marius@xxxxxxxxxxxxxx>
    Fixes: 2dc0b46b5ea3 ("libata: sata_down_spd_limit should return if driver has not recorded sstatus speed")
    Reviewed-by: Niklas Cassel <niklas.cassel@xxxxxxx>
    Tested-by: Marius Dinu <marius@xxxxxxxxxxxxxx>
    Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index d13474c6d181..14150767be44 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3051,7 +3051,7 @@ int sata_down_spd_limit(struct ata_link *link, u32 spd_limit)
 	 */
 	if (spd > 1)
 		mask &= (1 << (spd - 1)) - 1;
-	else
+	else if (link->sata_spd)
 		return -EINVAL;
 
 	/* were we already at the bottom? */



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux