[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230525183144.1717540-49-sashal@kernel.org>
Date: Thu, 25 May 2023 14:31:26 -0400
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Po-Wen Kao <powen.kao@...iatek.com>,
Bart Van Assche <bvanassche@....org>,
Manivannan Sadhasivam <mani@...nel.org>,
Stanley Chu <stanley.chu@...iatek.com>,
Ziqi Chen <quic_ziqichen@...cinc.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
Sasha Levin <sashal@...nel.org>, jejb@...ux.ibm.com,
matthias.bgg@...il.com, quic_cang@...cinc.com,
quic_asutoshd@...cinc.com, alice.chao@...iatek.com,
avri.altman@....com, beanhuo@...ron.com, j-young.choi@...sung.com,
Arthur.Simchaev@....com, athierry@...hat.com,
linux-scsi@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org
Subject: [PATCH AUTOSEL 6.3 49/67] scsi: ufs: core: Fix MCQ tag calculation
From: Po-Wen Kao <powen.kao@...iatek.com>
[ Upstream commit 5149452ca66289ef33d13897ee845a2f6f5b680f ]
The transfer command descriptor is allocated in ufshcd_memory_alloc() and
referenced by the transfer request descriptor with stride size
sizeof_utp_transfer_cmd_desc() instead of sizeof(struct
utp_transfer_cmd_desc).
Consequently, computing tag by address offset should also refer to the
same stride.
Signed-off-by: Po-Wen Kao <powen.kao@...iatek.com>
Link: https://lore.kernel.org/r/20230504154454.26654-2-powen.kao@mediatek.com
Reviewed-by: Bart Van Assche <bvanassche@....org>
Reviewed-by: Manivannan Sadhasivam <mani@...nel.org>
Reviewed-by: Stanley Chu <stanley.chu@...iatek.com>
Reviewed-by: Ziqi Chen <quic_ziqichen@...cinc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@...cle.com>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/ufs/core/ufs-mcq.c | 2 +-
drivers/ufs/core/ufshcd.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index 202ff71e1b582..b7c5f39b50e6d 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -265,7 +265,7 @@ static int ufshcd_mcq_get_tag(struct ufs_hba *hba,
addr = (le64_to_cpu(cqe->command_desc_base_addr) & CQE_UCD_BA) -
hba->ucdl_dma_addr;
- return div_u64(addr, sizeof(struct utp_transfer_cmd_desc));
+ return div_u64(addr, sizeof_utp_transfer_cmd_desc(hba));
}
static void ufshcd_mcq_process_cqe(struct ufs_hba *hba,
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 70b112038792a..c7a9a1cedf920 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -8422,7 +8422,7 @@ static void ufshcd_release_sdb_queue(struct ufs_hba *hba, int nutrs)
{
size_t ucdl_size, utrdl_size;
- ucdl_size = sizeof(struct utp_transfer_cmd_desc) * nutrs;
+ ucdl_size = sizeof_utp_transfer_cmd_desc(hba) * nutrs;
dmam_free_coherent(hba->dev, ucdl_size, hba->ucdl_base_addr,
hba->ucdl_dma_addr);
--
2.39.2
Powered by blists - more mailing lists