Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 854f84e

Browse files
Asutosh Dasmartinkpetersen
authored andcommitted
scsi: ufs: core: mcq: Find hardware queue to queue request
Add support to find the hardware queue on which the request would be queued. Since the very first queue is to serve device commands, an offset of 1 is added to the index of the hardware queue. Co-developed-by: Can Guo <[email protected]> Signed-off-by: Can Guo <[email protected]> Signed-off-by: Asutosh Das <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 22a2d56 commit 854f84e

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

drivers/ufs/core/ufs-mcq.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,25 @@ void ufshcd_mcq_config_mac(struct ufs_hba *hba, u32 max_active_cmds)
9292
ufshcd_writel(hba, val, REG_UFS_MCQ_CFG);
9393
}
9494

95+
/**
96+
* ufshcd_mcq_req_to_hwq - find the hardware queue on which the
97+
* request would be issued.
98+
* @hba - per adapter instance
99+
* @req - pointer to the request to be issued
100+
*
101+
* Returns the hardware queue instance on which the request would
102+
* be queued.
103+
*/
104+
struct ufs_hw_queue *ufshcd_mcq_req_to_hwq(struct ufs_hba *hba,
105+
struct request *req)
106+
{
107+
u32 utag = blk_mq_unique_tag(req);
108+
u32 hwq = blk_mq_unique_tag_to_hwq(utag);
109+
110+
/* uhq[0] is used to serve device commands */
111+
return &hba->uhq[hwq + UFSHCD_MCQ_IO_QUEUE_OFFSET];
112+
}
113+
95114
/**
96115
* ufshcd_mcq_decide_queue_depth - decide the queue depth
97116
* @hba - per adapter instance

drivers/ufs/core/ufshcd-priv.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ int ufshcd_mcq_memory_alloc(struct ufs_hba *hba);
6767
void ufshcd_mcq_make_queues_operational(struct ufs_hba *hba);
6868
void ufshcd_mcq_config_mac(struct ufs_hba *hba, u32 max_active_cmds);
6969
void ufshcd_mcq_select_mcq_mode(struct ufs_hba *hba);
70+
struct ufs_hw_queue *ufshcd_mcq_req_to_hwq(struct ufs_hba *hba,
71+
struct request *req);
7072

73+
#define UFSHCD_MCQ_IO_QUEUE_OFFSET 1
7174
#define SD_ASCII_STD true
7275
#define SD_RAW false
7376
int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,

drivers/ufs/core/ufshcd.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2935,6 +2935,9 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
29352935
goto out;
29362936
}
29372937

2938+
if (is_mcq_enabled(hba))
2939+
hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(cmd));
2940+
29382941
ufshcd_send_command(hba, tag, hwq);
29392942

29402943
out:

0 commit comments

Comments
 (0)