Skip to content

Commit

Permalink
scsi: ufs: mcq: Prevent no I/O queue case for MCQ
Browse files Browse the repository at this point in the history
If hba_maxq equals poll_queues, which means there are no I/O queues
(HCTX_TYPE_DEFAULT, HCTX_TYPE_READ), the very first hw queue will be
allocated as HCTX_TYPE_POLL and it will be used as the dev_cmd_queue.  In
this case, device commands such as QUERY cannot be properly handled.

This patch prevents the initialization of MCQ when the number of I/O queues
is not set and only the number of POLL queues is set.

Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
Link: https://lore.kernel.org/r/20240531212244.1593535-3-minwoo.im@samsung.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Minwoo Im authored and Martin K. Petersen committed Jun 5, 2024
1 parent 175d182 commit a420a8e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/ufs/core/ufs-mcq.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,15 @@ static int ufshcd_mcq_config_nr_queues(struct ufs_hba *hba)
return -EOPNOTSUPP;
}

/*
* Device should support at least one I/O queue to handle device
* commands via hba->dev_cmd_queue.
*/
if (hba_maxq == poll_queues) {
dev_err(hba->dev, "At least one non-poll queue required\n");
return -EOPNOTSUPP;
}

rem = hba_maxq;

if (rw_queues) {
Expand Down

0 comments on commit a420a8e

Please sign in to comment.