This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 6711f28b93b7adea75bcb0e5bd1019bb1f16325b
Author: liaoao <[email protected]>
AuthorDate: Thu May 29 14:37:49 2025 +0800

    rpmsg_port: align the queue buffers to the cache line for SPI DMA
    
    rpmsg_port_create_queue() allocated the TX/RX buffer area with
    kmm_malloc(), which only guarantees the heap's natural alignment. On SPI
    ports these buffers are transferred by DMA, and the cache maintenance
    around a DMA transfer works on whole cache lines, so a buffer that shares
    a line with neighbouring data can have that data corrupted or the DMA
    result lost. Allocate the area with kmm_memalign(64, ...).
    
    Signed-off-by: liaoao <[email protected]>
---
 drivers/rpmsg/rpmsg_port.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rpmsg/rpmsg_port.c b/drivers/rpmsg/rpmsg_port.c
index 7fa3cd0e1ea..8277e4ac263 100644
--- a/drivers/rpmsg/rpmsg_port.c
+++ b/drivers/rpmsg/rpmsg_port.c
@@ -166,7 +166,7 @@ static int rpmsg_port_create_queue(FAR struct 
rpmsg_port_queue_s *queue,
 
   if (buf == NULL)
     {
-      buf = kmm_malloc(count * len);
+      buf = kmm_memalign(64, count * len);
       if (buf == NULL)
         {
           kmm_free(queue->node);

Reply via email to