]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
scsi: ufs: core: Fix single doorbell mode support
authorBart Van Assche <bvanassche@acm.org>
Fri, 14 Nov 2025 19:34:03 +0000 (11:34 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 19 Nov 2025 17:02:22 +0000 (12:02 -0500)
Commit 22089c218037 ("scsi: ufs: core: Optimize the hot path")
accidentally broke support for the legacy single doorbell mode.  The
tag_set.shared_tags pointer is only != NULL if shared tag support is
enabled. The UFS driver only enables shared tag support in MCQ mode.

Fix this by handling legacy and MCQ modes differently in
ufshcd_tag_to_cmd().

Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Closes: https://lore.kernel.org/linux-scsi/c988a6dd-588d-4dbc-ab83-bbee17f2a686@samsung.com/
Reported-by: André Draszik <andre.draszik@linaro.org>
Closes: https://lore.kernel.org/linux-scsi/83ffbceb9e66b2a3b6096231551d969034ed8a74.camel@linaro.org/
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Fixes: 22089c218037 ("scsi: ufs: core: Optimize the hot path")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: André Draszik <andre.draszik@linaro.org>
Link: https://patch.msgid.link/20251114193406.3097237-1-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/core/ufshcd-priv.h

index 2f752a45db8756a77141524c4d0369fb1a882793..676ebb02db8bd3c2847c80adc54e5744e6b5db55 100644 (file)
@@ -368,7 +368,12 @@ static inline bool ufs_is_valid_unit_desc_lun(struct ufs_dev_info *dev_info, u8
  */
 static inline struct scsi_cmnd *ufshcd_tag_to_cmd(struct ufs_hba *hba, u32 tag)
 {
-       struct blk_mq_tags *tags = hba->host->tag_set.shared_tags;
+       /*
+        * Host-wide tags are enabled in MCQ mode only. See also the
+        * host->host_tagset assignment in ufs-mcq.c.
+        */
+       struct blk_mq_tags *tags = hba->host->tag_set.shared_tags ?:
+                                          hba->host->tag_set.tags[0];
        struct request *rq = blk_mq_tag_to_rq(tags, tag);
 
        if (WARN_ON_ONCE(!rq))