]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ufs: allocate descriptors with size aligned with DMA_MINALIGN
authorNeil Armstrong <neil.armstrong@linaro.org>
Mon, 30 Sep 2024 12:44:23 +0000 (14:44 +0200)
committerNeil Armstrong <neil.armstrong@linaro.org>
Mon, 14 Oct 2024 06:55:28 +0000 (08:55 +0200)
Align the allocation size with DMA_MINALIGN to make sure we do not
flush/invalidate data from following allocations.

Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
Tested-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Tested-by: Julius Lehmann <lehmanju@devpi.de>
Link: https://lore.kernel.org/r/20240930-topic-ufs-enhancements-v3-1-58234f84ab89@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
drivers/ufs/ufs.c

index be64bf971f169ee50ae9029e09f8fa071d17b186..e005cc90608e564796f1cb6a09490ee19fbe52fc 100644 (file)
@@ -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;