Skip to content

Commit ccb23dc

Browse files
powen-kao-mtkmartinkpetersen
authored andcommitted
scsi: ufs: core: Remove dedicated hwq for dev command
This commit depends on "scsi: ufs: core: mcq: Fix the incorrect OCS value for the device command" which takes care of the OCS value of dev commands in MCQ mode. It is safe to share first hwq for dev command and I/O request here. Tested-by: Po-Wen Kao <[email protected]> Signed-off-by: Po-Wen Kao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Stanley Chu <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 0fef6bb commit ccb23dc

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

drivers/ufs/core/ufs-mcq.c

+4-10
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@
2020
#define MAX_QUEUE_SUP GENMASK(7, 0)
2121
#define UFS_MCQ_MIN_RW_QUEUES 2
2222
#define UFS_MCQ_MIN_READ_QUEUES 0
23-
#define UFS_MCQ_NUM_DEV_CMD_QUEUES 1
2423
#define UFS_MCQ_MIN_POLL_QUEUES 0
2524
#define QUEUE_EN_OFFSET 31
2625
#define QUEUE_ID_OFFSET 16
2726

28-
#define MAX_DEV_CMD_ENTRIES 2
2927
#define MCQ_CFG_MAC_MASK GENMASK(16, 8)
3028
#define MCQ_QCFG_SIZE 0x40
3129
#define MCQ_ENTRY_SIZE_IN_DWORD 8
@@ -115,8 +113,7 @@ struct ufs_hw_queue *ufshcd_mcq_req_to_hwq(struct ufs_hba *hba,
115113
u32 utag = blk_mq_unique_tag(req);
116114
u32 hwq = blk_mq_unique_tag_to_hwq(utag);
117115

118-
/* uhq[0] is used to serve device commands */
119-
return &hba->uhq[hwq + UFSHCD_MCQ_IO_QUEUE_OFFSET];
116+
return &hba->uhq[hwq];
120117
}
121118

122119
/**
@@ -159,16 +156,15 @@ static int ufshcd_mcq_config_nr_queues(struct ufs_hba *hba)
159156

160157
hba_maxq = FIELD_GET(MAX_QUEUE_SUP, hba->mcq_capabilities);
161158

162-
tot_queues = UFS_MCQ_NUM_DEV_CMD_QUEUES + read_queues + poll_queues +
163-
rw_queues;
159+
tot_queues = read_queues + poll_queues + rw_queues;
164160

165161
if (hba_maxq < tot_queues) {
166162
dev_err(hba->dev, "Total queues (%d) exceeds HC capacity (%d)\n",
167163
tot_queues, hba_maxq);
168164
return -EOPNOTSUPP;
169165
}
170166

171-
rem = hba_maxq - UFS_MCQ_NUM_DEV_CMD_QUEUES;
167+
rem = hba_maxq;
172168

173169
if (rw_queues) {
174170
hba->nr_queues[HCTX_TYPE_DEFAULT] = rw_queues;
@@ -194,7 +190,7 @@ static int ufshcd_mcq_config_nr_queues(struct ufs_hba *hba)
194190
for (i = 0; i < HCTX_MAX_TYPES; i++)
195191
host->nr_hw_queues += hba->nr_queues[i];
196192

197-
hba->nr_hw_queues = host->nr_hw_queues + UFS_MCQ_NUM_DEV_CMD_QUEUES;
193+
hba->nr_hw_queues = host->nr_hw_queues;
198194
return 0;
199195
}
200196

@@ -444,8 +440,6 @@ int ufshcd_mcq_init(struct ufs_hba *hba)
444440

445441
/* The very first HW queue serves device commands */
446442
hba->dev_cmd_queue = &hba->uhq[0];
447-
/* Give dev_cmd_queue the minimal number of entries */
448-
hba->dev_cmd_queue->max_entries = MAX_DEV_CMD_ENTRIES;
449443

450444
host->host_tagset = 1;
451445
return 0;

drivers/ufs/core/ufshcd-priv.h

-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ int ufshcd_try_to_abort_task(struct ufs_hba *hba, int tag);
8484
void ufshcd_release_scsi_cmd(struct ufs_hba *hba,
8585
struct ufshcd_lrb *lrbp);
8686

87-
#define UFSHCD_MCQ_IO_QUEUE_OFFSET 1
8887
#define SD_ASCII_STD true
8988
#define SD_RAW false
9089
int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,

drivers/ufs/core/ufshcd.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -5503,7 +5503,7 @@ static int ufshcd_poll(struct Scsi_Host *shost, unsigned int queue_num)
55035503
struct ufs_hw_queue *hwq;
55045504

55055505
if (is_mcq_enabled(hba)) {
5506-
hwq = &hba->uhq[queue_num + UFSHCD_MCQ_IO_QUEUE_OFFSET];
5506+
hwq = &hba->uhq[queue_num];
55075507

55085508
return ufshcd_mcq_poll_cqe_lock(hba, hwq);
55095509
}
@@ -5557,7 +5557,7 @@ static void ufshcd_mcq_compl_pending_transfer(struct ufs_hba *hba,
55575557

55585558
utag = blk_mq_unique_tag(scsi_cmd_to_rq(cmd));
55595559
hwq_num = blk_mq_unique_tag_to_hwq(utag);
5560-
hwq = &hba->uhq[hwq_num + UFSHCD_MCQ_IO_QUEUE_OFFSET];
5560+
hwq = &hba->uhq[hwq_num];
55615561

55625562
if (force_compl) {
55635563
ufshcd_mcq_compl_all_cqes_lock(hba, hwq);

0 commit comments

Comments
 (0)