public inbox for linux-ide@vger.kernel.org
 help / color / mirror / Atom feed
From: marius@psihoexpert.ro
To: "Damien Le Moal" <damien.lemoal@opensource.wdc.com>,
	linux-ide@vger.kernel.org
Cc: "David Milburn" <dmilburn@redhat.com>
Subject: Re: [PATCH v2] ata: libata: Fix sata_down_spd_limit() when no link speed is reported
Date: Wed, 01 Feb 2023 07:01:18 +0000	[thread overview]
Message-ID: <2ae3974cc9739bfc4da9076e48beb25a@psihoexpert.ro> (raw)
In-Reply-To: <20230130122427.113156-1-damien.lemoal@opensource.wdc.com>

January 30, 2023 2:24 PM, "Damien Le Moal" <damien.lemoal@opensource.wdc.com> wrote:

> 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@psihoexpert.ro>
> Fixes: 2dc0b46b5ea3 ("libata: sata_down_spd_limit should return if driver has not recorded sstatus
> speed")
> Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> ---
> 
> Changes from v1:
> * Fixed commit message typos
> 
> drivers/ata/libata-core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 884ae73b11ea..2ea572628b1c 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -3109,7 +3109,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? */
> --
> 2.39.1

Tested-by: Marius Dinu <marius@psihoexpert.ro>


      parent reply	other threads:[~2023-02-01  7:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30 12:24 [PATCH v2] ata: libata: Fix sata_down_spd_limit() when no link speed is reported Damien Le Moal
2023-01-30 14:10 ` Niklas Cassel
2023-02-01  7:01 ` marius [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2ae3974cc9739bfc4da9076e48beb25a@psihoexpert.ro \
    --to=marius@psihoexpert.ro \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=dmilburn@redhat.com \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox