]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-6.6/scsi-ufs-core-fix-mcq-mode-dev-command-timeout.patch
Fixes for 6.6
[thirdparty/kernel/stable-queue.git] / queue-6.6 / scsi-ufs-core-fix-mcq-mode-dev-command-timeout.patch
1 From 575180ef6954eeb5e761c1178f5b74bee2003abf Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Thu, 28 Mar 2024 19:12:44 +0800
4 Subject: scsi: ufs: core: Fix MCQ mode dev command timeout
5
6 From: Peter Wang <peter.wang@mediatek.com>
7
8 [ Upstream commit 2a26a11e9c258b14be6fd98f8a85f20ac1fff66e ]
9
10 When a dev command times out in MCQ mode, a successfully cleared command
11 should cause a retry. However, because we currently return 0, the caller
12 considers the command a success which causes the following error to be
13 logged: "Invalid offset 0x0 in descriptor IDN 0x9, length 0x0".
14
15 Retry if clearing the command was successful.
16
17 Signed-off-by: Peter Wang <peter.wang@mediatek.com>
18 Link: https://lore.kernel.org/r/20240328111244.3599-1-peter.wang@mediatek.com
19 Reviewed-by: Bart Van Assche <bvanassche@acm.org>
20 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
21 Signed-off-by: Sasha Levin <sashal@kernel.org>
22 ---
23 drivers/ufs/core/ufshcd.c | 4 +++-
24 1 file changed, 3 insertions(+), 1 deletion(-)
25
26 diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
27 index 8005373e20bae..344806330be16 100644
28 --- a/drivers/ufs/core/ufshcd.c
29 +++ b/drivers/ufs/core/ufshcd.c
30 @@ -3064,7 +3064,9 @@ static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba,
31
32 /* MCQ mode */
33 if (is_mcq_enabled(hba)) {
34 - err = ufshcd_clear_cmd(hba, lrbp->task_tag);
35 + /* successfully cleared the command, retry if needed */
36 + if (ufshcd_clear_cmd(hba, lrbp->task_tag) == 0)
37 + err = -EAGAIN;
38 hba->dev_cmd.complete = NULL;
39 return err;
40 }
41 --
42 2.43.0
43