Skip to content

Commit a420a8e

Browse files
minwooimmartinkpetersen
authored andcommitted
scsi: ufs: mcq: Prevent no I/O queue case for MCQ
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 <[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 175d182 commit a420a8e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/ufs/core/ufs-mcq.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,15 @@ static int ufshcd_mcq_config_nr_queues(struct ufs_hba *hba)
179179
return -EOPNOTSUPP;
180180
}
181181

182+
/*
183+
* Device should support at least one I/O queue to handle device
184+
* commands via hba->dev_cmd_queue.
185+
*/
186+
if (hba_maxq == poll_queues) {
187+
dev_err(hba->dev, "At least one non-poll queue required\n");
188+
return -EOPNOTSUPP;
189+
}
190+
182191
rem = hba_maxq;
183192

184193
if (rw_queues) {

0 commit comments

Comments
 (0)