On 10/14/24 5:33 AM, gregkh@xxxxxxxxxxxxxxxxxxx wrote:
This is a note to let you know that I've just added the patch titled
scsi: ufs: Use pre-calculated offsets in ufshcd_init_lrb()
to the 6.11-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
scsi-ufs-use-pre-calculated-offsets-in-ufshcd_init_lrb.patch
and it can be found in the queue-6.11 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.
From d5130c5a093257aa4542aaded8034ef116a7624a Mon Sep 17 00:00:00 2001
From: Avri Altman <avri.altman@xxxxxxx>
Date: Tue, 10 Sep 2024 07:45:43 +0300
Subject: scsi: ufs: Use pre-calculated offsets in ufshcd_init_lrb()
From: Avri Altman <avri.altman@xxxxxxx>
commit d5130c5a093257aa4542aaded8034ef116a7624a upstream.
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@xxxxxxxxxxxxxxx
Signed-off-by: Avri Altman <avri.altman@xxxxxxx>
Link: https://lore.kernel.org/r/20240910044543.3812642-1-avri.altman@xxxxxxx
Acked-by: Bart Van Assche <bvanassche@xxxxxxx>
Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/ufs/core/ufshcd.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -2920,9 +2920,8 @@ static void ufshcd_init_lrb(struct ufs_h
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 +
Patches currently in stable-queue which might be from avri.altman@xxxxxxx are
queue-6.11/scsi-ufs-use-pre-calculated-offsets-in-ufshcd_init_lrb.patch
Hi Greg,
It may be prudent to drop this patch from all stable trees. In the best
case, this patch doesn't change the behavior of the UFS Exynos driver.
If anything would have been overlooked, there is a risk that this patch
breaks the UFS Exynos driver.
Thanks,
Bart.