diff mbox series

[01/13] ufs: allocate descriptors with size aligned with DMA_MINALIGN

Message ID 20240910-topic-ufs-enhancements-v1-1-3ee0bffacc64@linaro.org
State Superseded
Headers show
Series ufs: enhancements to support Qualcomm UFS controllers | expand

Commit Message

Neil Armstrong Sept. 10, 2024, 9:20 a.m. UTC
Align the allocation size with DMA_MINALIGN to make sure we do not
flush/invalidate data from following allocations.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
 drivers/ufs/ufs.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Neha Malcom Francis Sept. 10, 2024, 10:42 a.m. UTC | #1
Hi Neil,

On 10/09/24 14:50, Neil Armstrong wrote:
> Align the allocation size with DMA_MINALIGN to make sure we do not
> flush/invalidate data from following allocations.
> 
> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> ---
>   drivers/ufs/ufs.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c
> index be64bf971f1..e005cc90608 100644
> --- a/drivers/ufs/ufs.c
> +++ b/drivers/ufs/ufs.c
> @@ -633,7 +633,9 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba)
>   	/* Allocate one Transfer Request Descriptor
>   	 * Should be aligned to 1k boundary.
>   	 */
> -	hba->utrdl = memalign(1024, sizeof(struct utp_transfer_req_desc));
> +	hba->utrdl = memalign(1024,
> +			      ALIGN(sizeof(struct utp_transfer_req_desc),
> +				    ARCH_DMA_MINALIGN));
>   	if (!hba->utrdl) {
>   		dev_err(hba->dev, "Transfer Descriptor memory allocation failed\n");
>   		return -ENOMEM;
> @@ -642,7 +644,9 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba)
>   	/* Allocate one Command Descriptor
>   	 * Should be aligned to 1k boundary.
>   	 */
> -	hba->ucdl = memalign(1024, sizeof(struct utp_transfer_cmd_desc));
> +	hba->ucdl = memalign(1024,
> +			     ALIGN(sizeof(struct utp_transfer_cmd_desc),
> +				   ARCH_DMA_MINALIGN));
>   	if (!hba->ucdl) {
>   		dev_err(hba->dev, "Command descriptor memory allocation failed\n");
>   		return -ENOMEM;
> 

Reviewed-by: Neha Malcom Francis <n-francis@ti.com>

Sorry for the delay in sending out this review, I had reviewed the first few 
patches that you had send in an earlier version and looks like this cleanup/fix 
was needed. Thanks!
diff mbox series

Patch

diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c
index be64bf971f1..e005cc90608 100644
--- a/drivers/ufs/ufs.c
+++ b/drivers/ufs/ufs.c
@@ -633,7 +633,9 @@  static int ufshcd_memory_alloc(struct ufs_hba *hba)
 	/* Allocate one Transfer Request Descriptor
 	 * Should be aligned to 1k boundary.
 	 */
-	hba->utrdl = memalign(1024, sizeof(struct utp_transfer_req_desc));
+	hba->utrdl = memalign(1024,
+			      ALIGN(sizeof(struct utp_transfer_req_desc),
+				    ARCH_DMA_MINALIGN));
 	if (!hba->utrdl) {
 		dev_err(hba->dev, "Transfer Descriptor memory allocation failed\n");
 		return -ENOMEM;
@@ -642,7 +644,9 @@  static int ufshcd_memory_alloc(struct ufs_hba *hba)
 	/* Allocate one Command Descriptor
 	 * Should be aligned to 1k boundary.
 	 */
-	hba->ucdl = memalign(1024, sizeof(struct utp_transfer_cmd_desc));
+	hba->ucdl = memalign(1024,
+			     ALIGN(sizeof(struct utp_transfer_cmd_desc),
+				   ARCH_DMA_MINALIGN));
 	if (!hba->ucdl) {
 		dev_err(hba->dev, "Command descriptor memory allocation failed\n");
 		return -ENOMEM;