Patch "remoteproc: mtk_scp: use dma_addr_t for DMA API" has been added to the 5.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    remoteproc: mtk_scp: use dma_addr_t for DMA API

to the 5.6-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:
     remoteproc-mtk_scp-use-dma_addr_t-for-dma-api.patch
and it can be found in the queue-5.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit fd19a84b2094d7aaa468ab0bd887aada633731fa
Author: Arnd Bergmann <arnd@xxxxxxxx>
Date:   Wed Apr 8 17:54:29 2020 +0200

    remoteproc: mtk_scp: use dma_addr_t for DMA API
    
    commit c2781e4d9bc6d925dfc1ff833dfdaf12b69679de upstream.
    
    dma_addr_t and phys_addr_t are distinct types and must not be
    mixed, as both the values and the size of the type may be
    different depending on what the remote device uses.
    
    In this driver the compiler warns when the two types are different:
    
    drivers/remoteproc/mtk_scp.c: In function 'scp_map_memory_region':
    drivers/remoteproc/mtk_scp.c:454:9: error: passing argument 3 of 'dma_alloc_coherent' from incompatible pointer type [-Werror=incompatible-pointer-types]
      454 |         &scp->phys_addr, GFP_KERNEL);
          |         ^~~~~~~~~~~~~~~
          |         |
          |         phys_addr_t * {aka unsigned int *}
    In file included from drivers/remoteproc/mtk_scp.c:7:
    include/linux/dma-mapping.h:642:15: note: expected 'dma_addr_t *' {aka 'long long unsigned int *'} but argument is of type 'phys_addr_t *' {aka 'unsigned int *'}
      642 |   dma_addr_t *dma_handle, gfp_t gfp)
    
    Change the phys_addr member to be typed and named according
    to how it is allocated.
    
    Fixes: 63c13d61eafe ("remoteproc/mediatek: add SCP support for mt8183")
    Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
    Link: https://lore.kernel.org/r/20200408155450.2186471-1-arnd@xxxxxxxx
    Signed-off-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h
index deb20096146a4..0066c83636d08 100644
--- a/drivers/remoteproc/mtk_common.h
+++ b/drivers/remoteproc/mtk_common.h
@@ -68,7 +68,7 @@ struct mtk_scp {
 	wait_queue_head_t ack_wq;
 
 	void __iomem *cpu_addr;
-	phys_addr_t phys_addr;
+	dma_addr_t dma_addr;
 	size_t dram_size;
 
 	struct rproc_subdev *rpmsg_subdev;
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 7ccdf64ff3ea1..a6327617868ea 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -330,7 +330,7 @@ static void *scp_da_to_va(struct rproc *rproc, u64 da, int len)
 		if (offset >= 0 && (offset + len) < scp->sram_size)
 			return (void __force *)scp->sram_base + offset;
 	} else {
-		offset = da - scp->phys_addr;
+		offset = da - scp->dma_addr;
 		if (offset >= 0 && (offset + len) < scp->dram_size)
 			return (void __force *)scp->cpu_addr + offset;
 	}
@@ -451,7 +451,7 @@ static int scp_map_memory_region(struct mtk_scp *scp)
 	/* Reserved SCP code size */
 	scp->dram_size = MAX_CODE_SIZE;
 	scp->cpu_addr = dma_alloc_coherent(scp->dev, scp->dram_size,
-					   &scp->phys_addr, GFP_KERNEL);
+					   &scp->dma_addr, GFP_KERNEL);
 	if (!scp->cpu_addr)
 		return -ENOMEM;
 
@@ -461,7 +461,7 @@ static int scp_map_memory_region(struct mtk_scp *scp)
 static void scp_unmap_memory_region(struct mtk_scp *scp)
 {
 	dma_free_coherent(scp->dev, scp->dram_size, scp->cpu_addr,
-			  scp->phys_addr);
+			  scp->dma_addr);
 	of_reserved_mem_device_release(scp->dev);
 }
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux