Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] ufs: core: Fix single doorbell mode support
@ 2025-11-14 19:34 Bart Van Assche
  2025-11-15 16:10 ` André Draszik
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bart Van Assche @ 2025-11-14 19:34 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Marek Szyprowski, André Draszik,
	James E.J. Bottomley, Peter Wang, Ziqi Chen, Can Guo,
	Manivannan Sadhasivam, Bao D. Nguyen, Bean Huo

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>
---
 drivers/ufs/core/ufshcd-priv.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h
index 2f752a45db87..676ebb02db8b 100644
--- a/drivers/ufs/core/ufshcd-priv.h
+++ b/drivers/ufs/core/ufshcd-priv.h
@@ -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))

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ufs: core: Fix single doorbell mode support
  2025-11-14 19:34 [PATCH] ufs: core: Fix single doorbell mode support Bart Van Assche
@ 2025-11-15 16:10 ` André Draszik
  2025-11-19 17:04 ` Martin K. Petersen
  2025-11-29  3:30 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: André Draszik @ 2025-11-15 16:10 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen
  Cc: linux-scsi, Marek Szyprowski, James E.J. Bottomley, Peter Wang,
	Ziqi Chen, Can Guo, Manivannan Sadhasivam, Bao D. Nguyen,
	Bean Huo

On Fri, 2025-11-14 at 11:34 -0800, Bart Van Assche wrote:
> 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>
> ---
>  drivers/ufs/core/ufshcd-priv.h | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

This fixes it for me on Pixel 6, too.

Tested-by: André Draszik <andre.draszik@linaro.org>


Thanks Bart for the quick fix!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ufs: core: Fix single doorbell mode support
  2025-11-14 19:34 [PATCH] ufs: core: Fix single doorbell mode support Bart Van Assche
  2025-11-15 16:10 ` André Draszik
@ 2025-11-19 17:04 ` Martin K. Petersen
  2025-11-29  3:30 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2025-11-19 17:04 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Martin K . Petersen, linux-scsi, Marek Szyprowski,
	André Draszik, James E.J. Bottomley, Peter Wang, Ziqi Chen,
	Can Guo, Manivannan Sadhasivam, Bao D. Nguyen, Bean Huo


Bart,

> 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().

Applied to 6.19/scsi-staging, thanks!

-- 
Martin K. Petersen

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ufs: core: Fix single doorbell mode support
  2025-11-14 19:34 [PATCH] ufs: core: Fix single doorbell mode support Bart Van Assche
  2025-11-15 16:10 ` André Draszik
  2025-11-19 17:04 ` Martin K. Petersen
@ 2025-11-29  3:30 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2025-11-29  3:30 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Martin K . Petersen, linux-scsi, Marek Szyprowski,
	André Draszik, James E.J. Bottomley, Peter Wang, Ziqi Chen,
	Can Guo, Manivannan Sadhasivam, Bao D. Nguyen, Bean Huo

On Fri, 14 Nov 2025 11:34:03 -0800, Bart Van Assche wrote:

> 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().
> 
> [...]

Applied to 6.19/scsi-queue, thanks!

[1/1] ufs: core: Fix single doorbell mode support
      https://git.kernel.org/mkp/scsi/c/02b5822d2fea

-- 
Martin K. Petersen

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-11-29  3:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-14 19:34 [PATCH] ufs: core: Fix single doorbell mode support Bart Van Assche
2025-11-15 16:10 ` André Draszik
2025-11-19 17:04 ` Martin K. Petersen
2025-11-29  3:30 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox