From: Bart Van Assche <bvanassche@acm.org>
To: Avri Altman <avri.altman@wdc.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Alim Akhtar <alim.akhtar@samsung.com>
Subject: Re: [PATCH v2] scsi: ufs: Use pre-calculated offsets in ufshcd_init_lrb
Date: Tue, 17 Sep 2024 11:21:39 -0700 [thread overview]
Message-ID: <5c15b6c8-b47b-40fc-ba05-e71ef6681ad2@acm.org> (raw)
In-Reply-To: <20240910044543.3812642-1-avri.altman@wdc.com>
On 9/9/24 9:45 PM, Avri Altman wrote:
> Replace manual offset calculations for response_upiu and prd_table in
> ufshcd_init_lrb() with pre-calculated offsets already stored in the
> utp_transfer_req_desc structure. The pre-calculated offsets are set
> differently in ufshcd_host_memory_configure() based on the
> UFSHCD_QUIRK_PRDT_BYTE_GRAN quirk, ensuring correct alignment and
> access.
>
> Fixes: 26f968d7de82 ("scsi: ufs: Introduce UFSHCD_QUIRK_PRDT_BYTE_GRAN quirk")
> Cc: stable@vger.kernel.org
> Signed-off-by: Avri Altman <avri.altman@wdc.com>
>
> ---
> Changes in v2:
> - add Fixes: and Cc: stable tags
> - fix kernel test robot warning about type mismatch by using le16_to_cpu
> ---
> drivers/ufs/core/ufshcd.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 8ea5a82503a9..85251c176ef7 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -2919,9 +2919,8 @@ static void ufshcd_init_lrb(struct ufs_hba *hba, struct ufshcd_lrb *lrb, int i)
> struct utp_transfer_req_desc *utrdlp = hba->utrdl_base_addr;
> dma_addr_t cmd_desc_element_addr = hba->ucdl_dma_addr +
> i * ufshcd_get_ucd_size(hba);
> - u16 response_offset = offsetof(struct utp_transfer_cmd_desc,
> - response_upiu);
> - u16 prdt_offset = offsetof(struct utp_transfer_cmd_desc, prd_table);
> + u16 response_offset = le16_to_cpu(utrdlp[i].response_upiu_offset);
> + u16 prdt_offset = le16_to_cpu(utrdlp[i].prd_table_offset);
>
> lrb->utr_descriptor_ptr = utrdlp + i;
> lrb->utrd_dma_addr = hba->utrdl_dma_addr +
Please always Cc the author of the original patch when posting a
candidate fix.
Alim, since the upstream kernel code seems to work fine with Exynos UFS
host controllers, is the description of UFSHCD_QUIRK_PRDT_BYTE_GRAN
perhaps wrong? I'm referring to the following description:
/*
* This quirk needs to be enabled if the host controller regards
* resolution of the values of PRDTO and PRDTL in UTRD as byte.
*/
UFSHCD_QUIRK_PRDT_BYTE_GRAN = 1 << 9,
Thanks,
Bart.
next prev parent reply other threads:[~2024-09-17 18:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 4:45 [PATCH v2] scsi: ufs: Use pre-calculated offsets in ufshcd_init_lrb Avri Altman
2024-09-11 22:32 ` Bart Van Assche
2024-09-12 6:56 ` Avri Altman
2024-09-17 7:10 ` Avri Altman
2024-09-17 18:21 ` Bart Van Assche [this message]
2024-09-21 6:30 ` Avri Altman
2024-10-01 7:19 ` Avri Altman
2024-10-01 17:19 ` Bart Van Assche
2024-10-02 23:25 ` Bart Van Assche
2024-10-04 2:08 ` Martin K. Petersen
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=5c15b6c8-b47b-40fc-ba05-e71ef6681ad2@acm.org \
--to=bvanassche@acm.org \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=stable@vger.kernel.org \
/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