Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: "hoyoung seo" <hy50.seo@samsung.com>
To: "'Bart Van Assche'" <bvanassche@acm.org>,
	"'Martin K . Petersen'" <martin.petersen@oracle.com>
Cc: <linux-scsi@vger.kernel.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>,
	"'John Garry'" <john.garry@linux.dev>,
	"'Hyeoncheol Jeong'" <hyenc.jeong@samsung.com>,
	<cpgsproxy1@samsung.com>
Subject: RE: [PATCH] ufs: core: Remove the DMA addresses from struct ufshcd_lrb
Date: Mon, 23 Nov 2026 10:25:45 +0900	[thread overview]
Message-ID: <1860250540.01795399682092.JavaMail.epsvc@epcpadp2new> (raw)
In-Reply-To: <cc98d54dcd4a98fead25db50c5c6aec2dd65d595.1795135853.git.bvanassche@acm.org>

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;



      parent reply	other threads:[~2026-11-23  2:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1860250540.01795399682092.JavaMail.epsvc@epcpadp2new \
    --to=hy50.seo@samsung.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=can.guo@oss.qualcomm.com \
    --cc=cpgsproxy1@samsung.com \
    --cc=hyenc.jeong@samsung.com \
    --cc=john.garry@linux.dev \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mkp@kernel.org \
    --cc=peter.wang@mediatek.com \
    --cc=stanleyjhu@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox