Re: [PATCH] scsi: ufs: Add support for the aggregated read query opcode
From: Hyeoncheol Jeong
Date: Wed Jul 15 2026 - 22:53:33 EST
On 7/13/26 09:55 PM, Bart Van Assche wrote:
> On 7/12/26 7:52 PM, Hyeoncheol Jeong wrote:
> > Would it be okay to keep utp_transfer_cmd_desc as is and give
> > just the reserved tag a dedicated 4 KiB response descriptor?
> > Regular tags and normal I/O would stay unchanged.
>
> That sounds better to me but how to implement the above proposal
> without slowing down the hot path?
Hi Bart,
Here's what I'm thinking. Keep utp_transfer_cmd_desc as is (512 B) and
add a dedicated 4 KiB one just for the reserved tag:
struct utp_devman_cmd_desc {
u8 command_upiu[ALIGNED_UPIU_SIZE];
u8 response_upiu[ALIGNED_DEVMAN_RSP_SIZE]; /* 4 KiB */
u8 prd_table[];
};
Allocated as a single instance, this keeps the extra cost to +(4 KiB - 512 B)
per host without growing any per-tag structure.
This probably touches two spots on the hot path, though hopefully only
slightly. First, ufshcd_init_lrb() would gain a reserved-tag check to
pick the descriptor:
if (unlikely(blk_mq_is_reserved_rq(scsi_cmd_to_rq(cmd))))
p = hba->devman_ucd_base_addr;
else
p = ... + (i - UFSHCD_NUM_RESERVED) * ufshcd_get_ucd_size(hba);
Since the reserved tag is only ever used for device management, this
branch is always false for normal I/O and should be well predicted.
The other is the pre-4.1 MCQ tag recovery, which would gain a check
before the existing division:
if (addr == hba->devman_ucd_dma_addr)
return 0; /* reserved tag */
It just gets one extra compare, and on UFSHCI 4.1+ the CQE carries
the tag directly, so that path isn't hit at all.
If the direction sounds reasonable, I'll prepare it as v2.
Thanks.