Patch "firmware: raspberrypi: Use correct device for DMA mappings" has been added to the 4.19-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

    firmware: raspberrypi: Use correct device for DMA mappings

to the 4.19-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:
     firmware-raspberrypi-use-correct-device-for-dma-mapp.patch
and it can be found in the queue-4.19 subdirectory.

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



commit 8f234e96dd5c9d97a197cf9e0d72a110694b5c11
Author: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
Date:   Tue Mar 26 21:58:06 2024 +0200

    firmware: raspberrypi: Use correct device for DMA mappings
    
    [ Upstream commit df518a0ae1b982a4dcf2235464016c0c4576a34d ]
    
    The buffer used to transfer data over the mailbox interface is mapped
    using the client's device. This is incorrect, as the device performing
    the DMA transfer is the mailbox itself. Fix it by using the mailbox
    controller device instead.
    
    This requires including the mailbox_controller.h header to dereference
    the mbox_chan and mbox_controller structures. The header is not meant to
    be included by clients. This could be fixed by extending the client API
    with a function to access the controller's device.
    
    Fixes: 4e3d60656a72 ("ARM: bcm2835: Add the Raspberry Pi firmware driver")
    Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
    Reviewed-by: Stefan Wahren <wahrenst@xxxxxxx>
    Tested-by: Ivan T. Ivanov <iivanov@xxxxxxx>
    Link: https://lore.kernel.org/r/20240326195807.15163-3-laurent.pinchart@xxxxxxxxxxxxxxxx
    Signed-off-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c
index 44eb99807e337..ea3975b94d6a1 100644
--- a/drivers/firmware/raspberrypi.c
+++ b/drivers/firmware/raspberrypi.c
@@ -11,6 +11,7 @@
 
 #include <linux/dma-mapping.h>
 #include <linux/mailbox_client.h>
+#include <linux/mailbox_controller.h>
 #include <linux/module.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
@@ -91,8 +92,8 @@ int rpi_firmware_property_list(struct rpi_firmware *fw,
 	if (size & 3)
 		return -EINVAL;
 
-	buf = dma_alloc_coherent(fw->cl.dev, PAGE_ALIGN(size), &bus_addr,
-				 GFP_ATOMIC);
+	buf = dma_alloc_coherent(fw->chan->mbox->dev, PAGE_ALIGN(size),
+				 &bus_addr, GFP_ATOMIC);
 	if (!buf)
 		return -ENOMEM;
 
@@ -120,7 +121,7 @@ int rpi_firmware_property_list(struct rpi_firmware *fw,
 		ret = -EINVAL;
 	}
 
-	dma_free_coherent(fw->cl.dev, PAGE_ALIGN(size), buf, bus_addr);
+	dma_free_coherent(fw->chan->mbox->dev, PAGE_ALIGN(size), buf, bus_addr);
 
 	return ret;
 }




[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