* [PATCH] ufs: core: Remove the DMA addresses from struct ufshcd_lrb @ 2026-11-20 0:50 ` Bart Van Assche 2026-11-20 21:58 ` Bean Huo 2026-11-23 1:25 ` hoyoung seo 0 siblings, 2 replies; 3+ messages in thread From: Bart Van Assche @ 2026-11-20 0:50 UTC (permalink / raw) To: Martin K . Petersen Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley, Martin K. Petersen, Peter Wang, Bean Huo, Stanley Jhu, Can Guo, HOYOUNG SEO, John Garry, Hyeoncheol Jeong The offsets stored in struct utp_transfer_req_desc are in double words on hosts without UFSHCD_QUIRK_PRDT_BYTE_GRAN. Using these offsets as byte offsets to compute ucd_rsp_dma_addr and ucd_prdt_dma_addr results in incorrect DMA addresses. These addresses are only used by ufshcd_print_tr() for error logging. Instead of fixing how these addresses are computed, remove the utrd_dma_addr, ucd_req_dma_addr, ucd_rsp_dma_addr and ucd_prdt_dma_addr members from struct ufshcd_lrb and do not report DMA addresses anymore in ufshcd_print_tr(). The contents of the transfer request descriptor, the request UPIU, the response UPIU and the PRDT are still dumped by that function. Remove the local variable cmd_desc_element_addr from ufshcd_init_lrb() since it is no longer used. This patch changes the output of ufshcd_print_tr() as follows: the "Transfer Request Descriptor phys@", "Request UPIU phys@" and "Response UPIU phys@" lines are no longer logged and the "PRDT" line no longer includes a physical address. Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/ufs/core/ufshcd.c | 23 +---------------------- include/ufs/ufshcd.h | 9 --------- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 56a77f4a2a6e..839d62aebe8a 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -614,18 +614,11 @@ static void ufshcd_print_tr(struct ufs_hba *hba, struct scsi_cmnd *cmd, dev_err(hba->dev, "UPIU[%d] - complete time %lld us\n", tag, div_u64(lrbp->compl_time_stamp_local_clock, 1000)); } - dev_err(hba->dev, - "UPIU[%d] - Transfer Request Descriptor phys@0x%llx\n", - tag, (u64)lrbp->utrd_dma_addr); ufshcd_hex_dump("UPIU TRD: ", lrbp->utr_descriptor_ptr, sizeof(struct utp_transfer_req_desc)); - dev_err(hba->dev, "UPIU[%d] - Request UPIU phys@0x%llx\n", tag, - (u64)lrbp->ucd_req_dma_addr); ufshcd_hex_dump("UPIU REQ: ", lrbp->ucd_req_ptr, sizeof(struct utp_upiu_req)); - dev_err(hba->dev, "UPIU[%d] - Response UPIU phys@0x%llx\n", tag, - (u64)lrbp->ucd_rsp_dma_addr); ufshcd_hex_dump("UPIU RSP: ", lrbp->ucd_rsp_ptr, sizeof(struct utp_upiu_rsp)); @@ -634,10 +627,7 @@ static void ufshcd_print_tr(struct ufs_hba *hba, struct scsi_cmnd *cmd, if (hba->quirks & UFSHCD_QUIRK_PRDT_BYTE_GRAN) prdt_length /= ufshcd_sg_entry_size(hba); - dev_err(hba->dev, - "UPIU[%d] - PRDT - %d entries phys@0x%llx\n", - tag, prdt_length, - (u64)lrbp->ucd_prdt_dma_addr); + dev_err(hba->dev, "UPIU[%d] - PRDT - %d entries\n", tag, prdt_length); if (pr_prdt) ufshcd_hex_dump("UPIU PRDT: ", lrbp->ucd_prdt_ptr, @@ -2983,17 +2973,13 @@ static void ufshcd_init_lrb(struct ufs_hba *hba, struct scsi_cmnd *cmd) { const int i = scsi_cmd_to_rq(cmd)->tag; struct utp_transfer_req_desc *utrdlp = hba->utrdl_base_addr; - u16 response_offset = le16_to_cpu(utrdlp[i].response_upiu_offset); - u16 prdt_offset = le16_to_cpu(utrdlp[i].prd_table_offset); struct ufshcd_lrb *lrb = scsi_cmd_priv(cmd); u8 *command_upiu, *response_upiu, *prd_table; - dma_addr_t cmd_desc_element_addr; /* The reserved tag uses a dedicated UCD outside the pool. */ if (unlikely(blk_mq_is_reserved_rq(scsi_cmd_to_rq(cmd)))) { struct utp_devman_cmd_desc *cmd_descp = hba->devman_ucd_base_addr; - cmd_desc_element_addr = hba->devman_ucd_dma_addr; command_upiu = cmd_descp->command_upiu; response_upiu = cmd_descp->response_upiu; prd_table = cmd_descp->prd_table; @@ -3005,22 +2991,15 @@ static void ufshcd_init_lrb(struct ufs_hba *hba, struct scsi_cmnd *cmd) WARN_ON_ONCE(slot < 0); cmd_descp = (void *)hba->ucdl_base_addr + slot * ufshcd_get_ucd_size(hba); - cmd_desc_element_addr = - hba->ucdl_dma_addr + slot * ufshcd_get_ucd_size(hba); command_upiu = cmd_descp->command_upiu; response_upiu = cmd_descp->response_upiu; prd_table = cmd_descp->prd_table; } lrb->utr_descriptor_ptr = utrdlp + i; - lrb->utrd_dma_addr = - hba->utrdl_dma_addr + i * sizeof(struct utp_transfer_req_desc); lrb->ucd_req_ptr = (struct utp_upiu_req *)command_upiu; - lrb->ucd_req_dma_addr = cmd_desc_element_addr; lrb->ucd_rsp_ptr = (struct utp_upiu_rsp *)response_upiu; - lrb->ucd_rsp_dma_addr = cmd_desc_element_addr + response_offset; lrb->ucd_prdt_ptr = (struct ufshcd_sg_entry *)prd_table; - lrb->ucd_prdt_dma_addr = cmd_desc_element_addr + prdt_offset; } static void __ufshcd_setup_cmd(struct ufs_hba *hba, struct scsi_cmnd *cmd, diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index be62165b785e..4465e06fd394 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -157,10 +157,6 @@ struct ufs_pm_lvl_states { * @ucd_req_ptr: UCD address of the command * @ucd_rsp_ptr: Response UPIU address for this command * @ucd_prdt_ptr: PRDT address of the command - * @utrd_dma_addr: UTRD dma address for debug - * @ucd_prdt_dma_addr: PRDT dma address for debug - * @ucd_rsp_dma_addr: UPIU response dma address for debug - * @ucd_req_dma_addr: UPIU request dma address for debug * @scsi_status: SCSI status of the command * @command_type: SCSI, UFS, Query. * @lun: LUN of the command @@ -179,11 +175,6 @@ struct ufshcd_lrb { struct utp_upiu_rsp *ucd_rsp_ptr; struct ufshcd_sg_entry *ucd_prdt_ptr; - dma_addr_t utrd_dma_addr; - dma_addr_t ucd_req_dma_addr; - dma_addr_t ucd_rsp_dma_addr; - dma_addr_t ucd_prdt_dma_addr; - int scsi_status; int command_type; ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ufs: core: Remove the DMA addresses from struct ufshcd_lrb 2026-11-20 0:50 ` [PATCH] ufs: core: Remove the DMA addresses from struct ufshcd_lrb Bart Van Assche @ 2026-11-20 21:58 ` Bean Huo 2026-11-23 1:25 ` hoyoung seo 1 sibling, 0 replies; 3+ messages in thread From: Bean Huo @ 2026-11-20 21:58 UTC (permalink / raw) To: Bart Van Assche, Martin K . Petersen Cc: linux-scsi, James E.J. Bottomley, Martin K. Petersen, Peter Wang, Bean Huo, Stanley Jhu, Can Guo, HOYOUNG SEO, John Garry, Hyeoncheol Jeong Reviewed-by: Bean Huo <beanhuo@micron.com> ^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] ufs: core: Remove the DMA addresses from struct ufshcd_lrb 2026-11-20 0:50 ` [PATCH] ufs: core: Remove the DMA addresses from struct ufshcd_lrb Bart Van Assche 2026-11-20 21:58 ` Bean Huo @ 2026-11-23 1:25 ` hoyoung seo 1 sibling, 0 replies; 3+ messages in thread From: hoyoung seo @ 2026-11-23 1:25 UTC (permalink / raw) To: 'Bart Van Assche', 'Martin K . Petersen' Cc: linux-scsi, 'James E.J. Bottomley', 'Martin K. Petersen', 'Peter Wang', 'Bean Huo', 'Stanley Jhu', 'Can Guo', 'John Garry', 'Hyeoncheol Jeong', cpgsproxy1 Reviewed-by: HOYOUNG SEO <hy50.seo@samsung.com> > -----Original Message----- > From: Bart Van Assche <bvanassche@acm.org> > Sent: Friday, November 20, 2026 9:51 AM > To: Martin K . Petersen <martin.petersen@oracle.com> > Cc: linux-scsi@vger.kernel.org; Bart Van Assche <bvanassche@acm.org>; > James E.J. Bottomley <James.Bottomley@HansenPartnership.com>; Martin K. > Petersen <mkp@kernel.org>; Peter Wang <peter.wang@mediatek.com>; Bean Huo > <beanhuo@micron.com>; Stanley Jhu <stanleyjhu@google.com>; Can Guo > <can.guo@oss.qualcomm.com>; HOYOUNG SEO <hy50.seo@samsung.com>; John Garry > <john.garry@linux.dev>; Hyeoncheol Jeong <hyenc.jeong@samsung.com> > Subject: [PATCH] ufs: core: Remove the DMA addresses from struct > ufshcd_lrb > > The offsets stored in struct utp_transfer_req_desc are in double words on > hosts without UFSHCD_QUIRK_PRDT_BYTE_GRAN. Using these offsets as byte > offsets to compute ucd_rsp_dma_addr and ucd_prdt_dma_addr results in > incorrect DMA addresses. These addresses are only used by > ufshcd_print_tr() for error logging. > > Instead of fixing how these addresses are computed, remove the > utrd_dma_addr, ucd_req_dma_addr, ucd_rsp_dma_addr and ucd_prdt_dma_addr > members from struct ufshcd_lrb and do not report DMA addresses anymore in > ufshcd_print_tr(). The contents of the transfer request descriptor, the > request UPIU, the response UPIU and the PRDT are still dumped by that > function. Remove the local variable cmd_desc_element_addr from > ufshcd_init_lrb() since it is no longer used. > > This patch changes the output of ufshcd_print_tr() as follows: the > "Transfer Request Descriptor phys@", "Request UPIU phys@" and "Response > UPIU phys@" lines are no longer logged and the "PRDT" line no longer > includes a physical address. > > Signed-off-by: Bart Van Assche <bvanassche@acm.org> > --- > drivers/ufs/core/ufshcd.c | 23 +---------------------- > include/ufs/ufshcd.h | 9 --------- > 2 files changed, 1 insertion(+), 31 deletions(-) > > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index > 56a77f4a2a6e..839d62aebe8a 100644 > --- a/drivers/ufs/core/ufshcd.c > +++ b/drivers/ufs/core/ufshcd.c > @@ -614,18 +614,11 @@ static void ufshcd_print_tr(struct ufs_hba *hba, > struct scsi_cmnd *cmd, > dev_err(hba->dev, "UPIU[%d] - complete time %lld us\n", tag, > div_u64(lrbp->compl_time_stamp_local_clock, 1000)); > } > - dev_err(hba->dev, > - "UPIU[%d] - Transfer Request Descriptor phys@0x%llx\n", > - tag, (u64)lrbp->utrd_dma_addr); > > ufshcd_hex_dump("UPIU TRD: ", lrbp->utr_descriptor_ptr, > sizeof(struct utp_transfer_req_desc)); > - dev_err(hba->dev, "UPIU[%d] - Request UPIU phys@0x%llx\n", tag, > - (u64)lrbp->ucd_req_dma_addr); > ufshcd_hex_dump("UPIU REQ: ", lrbp->ucd_req_ptr, > sizeof(struct utp_upiu_req)); > - dev_err(hba->dev, "UPIU[%d] - Response UPIU phys@0x%llx\n", tag, > - (u64)lrbp->ucd_rsp_dma_addr); > ufshcd_hex_dump("UPIU RSP: ", lrbp->ucd_rsp_ptr, > sizeof(struct utp_upiu_rsp)); > > @@ -634,10 +627,7 @@ static void ufshcd_print_tr(struct ufs_hba *hba, > struct scsi_cmnd *cmd, > if (hba->quirks & UFSHCD_QUIRK_PRDT_BYTE_GRAN) > prdt_length /= ufshcd_sg_entry_size(hba); > > - dev_err(hba->dev, > - "UPIU[%d] - PRDT - %d entries phys@0x%llx\n", > - tag, prdt_length, > - (u64)lrbp->ucd_prdt_dma_addr); > + dev_err(hba->dev, "UPIU[%d] - PRDT - %d entries\n", tag, > prdt_length); > > if (pr_prdt) > ufshcd_hex_dump("UPIU PRDT: ", lrbp->ucd_prdt_ptr, @@ - > 2983,17 +2973,13 @@ static void ufshcd_init_lrb(struct ufs_hba *hba, > struct scsi_cmnd *cmd) { > const int i = scsi_cmd_to_rq(cmd)->tag; > struct utp_transfer_req_desc *utrdlp = hba->utrdl_base_addr; > - u16 response_offset = le16_to_cpu(utrdlp[i].response_upiu_offset); > - u16 prdt_offset = le16_to_cpu(utrdlp[i].prd_table_offset); > struct ufshcd_lrb *lrb = scsi_cmd_priv(cmd); > u8 *command_upiu, *response_upiu, *prd_table; > - dma_addr_t cmd_desc_element_addr; > > /* The reserved tag uses a dedicated UCD outside the pool. */ > if (unlikely(blk_mq_is_reserved_rq(scsi_cmd_to_rq(cmd)))) { > struct utp_devman_cmd_desc *cmd_descp = hba- > >devman_ucd_base_addr; > > - cmd_desc_element_addr = hba->devman_ucd_dma_addr; > command_upiu = cmd_descp->command_upiu; > response_upiu = cmd_descp->response_upiu; > prd_table = cmd_descp->prd_table; > @@ -3005,22 +2991,15 @@ static void ufshcd_init_lrb(struct ufs_hba *hba, > struct scsi_cmnd *cmd) > WARN_ON_ONCE(slot < 0); > cmd_descp = (void *)hba->ucdl_base_addr + slot * > ufshcd_get_ucd_size(hba); > > - cmd_desc_element_addr = > - hba->ucdl_dma_addr + slot * ufshcd_get_ucd_size(hba); > command_upiu = cmd_descp->command_upiu; > response_upiu = cmd_descp->response_upiu; > prd_table = cmd_descp->prd_table; > } > > lrb->utr_descriptor_ptr = utrdlp + i; > - lrb->utrd_dma_addr = > - hba->utrdl_dma_addr + i * sizeof(struct > utp_transfer_req_desc); > lrb->ucd_req_ptr = (struct utp_upiu_req *)command_upiu; > - lrb->ucd_req_dma_addr = cmd_desc_element_addr; > lrb->ucd_rsp_ptr = (struct utp_upiu_rsp *)response_upiu; > - lrb->ucd_rsp_dma_addr = cmd_desc_element_addr + response_offset; > lrb->ucd_prdt_ptr = (struct ufshcd_sg_entry *)prd_table; > - lrb->ucd_prdt_dma_addr = cmd_desc_element_addr + prdt_offset; > } > > static void __ufshcd_setup_cmd(struct ufs_hba *hba, struct scsi_cmnd *cmd, > diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index > be62165b785e..4465e06fd394 100644 > --- a/include/ufs/ufshcd.h > +++ b/include/ufs/ufshcd.h > @@ -157,10 +157,6 @@ struct ufs_pm_lvl_states { > * @ucd_req_ptr: UCD address of the command > * @ucd_rsp_ptr: Response UPIU address for this command > * @ucd_prdt_ptr: PRDT address of the command > - * @utrd_dma_addr: UTRD dma address for debug > - * @ucd_prdt_dma_addr: PRDT dma address for debug > - * @ucd_rsp_dma_addr: UPIU response dma address for debug > - * @ucd_req_dma_addr: UPIU request dma address for debug > * @scsi_status: SCSI status of the command > * @command_type: SCSI, UFS, Query. > * @lun: LUN of the command > @@ -179,11 +175,6 @@ struct ufshcd_lrb { > struct utp_upiu_rsp *ucd_rsp_ptr; > struct ufshcd_sg_entry *ucd_prdt_ptr; > > - dma_addr_t utrd_dma_addr; > - dma_addr_t ucd_req_dma_addr; > - dma_addr_t ucd_rsp_dma_addr; > - dma_addr_t ucd_prdt_dma_addr; > - > int scsi_status; > > int command_type; ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-23 2:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20261120005128epcas2p236aa8583f2847df64974267f9a760773@epcas2p2.samsung.com>
2026-11-20 0:50 ` [PATCH] ufs: core: Remove the DMA addresses from struct ufshcd_lrb Bart Van Assche
2026-11-20 21:58 ` Bean Huo
2026-11-23 1:25 ` hoyoung seo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox