aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinwoo Im <[email protected]>2024-06-01 06:22:44 +0900
committerMartin K. Petersen <[email protected]>2024-06-04 22:14:21 -0400
commita420a8ed0a92488a04b34dfc262101c87940c800 (patch)
tree65e5d4c93c8196b3292231664ef454724a61edaf
parent175d1825ca4d2288fee734ada0955a1e36dd50e6 (diff)
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]>
-rw-r--r--drivers/ufs/core/ufs-mcq.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index 46faa54aea94..4bcae410c268 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -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) {