Skip to content

Commit 93e6c0e

Browse files
ptr324martinkpetersen
authored andcommitted
scsi: ufs: core: Clear cmd if abort succeeds in MCQ mode
In MCQ mode, if cmd is pending in device and abort succeeds, response will not be returned by device. So we need clear the cmd, otherwise timeout will happen and next time we use same tag we will get a WARN_ON(lrbp->cmd). Below is error log: <3>[ 2277.447611][T21376] ufshcd-mtk 112b0000.ufshci: ufshcd_try_to_abort_task: cmd pending in the device. tag = 7 <3>[ 2277.476954][T21376] ufshcd-mtk 112b0000.ufshci: Aborting tag 7 / CDB 0x2a succeeded <6>[ 2307.551263][T30974] ufshcd-mtk 112b0000.ufshci: ufshcd_abort: Device abort task at tag 7 <4>[ 2307.623264][ T327] WARNING: CPU: 5 PID: 327 at source/drivers/ufs/core/ufshcd.c:3021 ufshcd_queuecommand+0x66c/0xe34 Fixes: ab24864 ("scsi: ufs: core: Add error handling for MCQ mode") Cc: <[email protected]> Signed-off-by: Peter Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 2a0508d commit 93e6c0e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6444,11 +6444,24 @@ static bool ufshcd_abort_one(struct request *rq, void *priv)
64446444
struct scsi_device *sdev = cmd->device;
64456445
struct Scsi_Host *shost = sdev->host;
64466446
struct ufs_hba *hba = shost_priv(shost);
6447+
struct ufshcd_lrb *lrbp = &hba->lrb[tag];
6448+
struct ufs_hw_queue *hwq;
6449+
unsigned long flags;
64476450

64486451
*ret = ufshcd_try_to_abort_task(hba, tag);
64496452
dev_err(hba->dev, "Aborting tag %d / CDB %#02x %s\n", tag,
64506453
hba->lrb[tag].cmd ? hba->lrb[tag].cmd->cmnd[0] : -1,
64516454
*ret ? "failed" : "succeeded");
6455+
6456+
/* Release cmd in MCQ mode if abort succeeds */
6457+
if (is_mcq_enabled(hba) && (*ret == 0)) {
6458+
hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(lrbp->cmd));
6459+
spin_lock_irqsave(&hwq->cq_lock, flags);
6460+
if (ufshcd_cmd_inflight(lrbp->cmd))
6461+
ufshcd_release_scsi_cmd(hba, lrbp);
6462+
spin_unlock_irqrestore(&hwq->cq_lock, flags);
6463+
}
6464+
64526465
return *ret == 0;
64536466
}
64546467

0 commit comments

Comments
 (0)