cancel
Showing results for 
Search instead for 
Did you mean: 

RPMSG SDB cached buffer

mishuk
Associate III

We follow this: https://wiki.st.com/stm32mpu/wiki/How_to_exchange_large_data_buffers_with_the_coprocessor_-_principle and this: https://wiki.st.com/stm32mpu/wiki/How_to_exchange_large_data_buffers_with_the_coprocessor_-_example#Linux_drivers

articles for exchanging M4-A7 except for DMA : in our case we write from M4 directly into DDR without DMA transfer.

Every time A7 needs new portion of data, it sends request via rpmsg and polls on eventfd for ready data from M4. It works fine for a number of runs but very soon we get old data. We have checked buffers on M4 side and correctness of poll-read on A7 side. For me it looks like coherence issue. So, my question is : how can I mark mmaped region as non-cacheable area ?

PS. As far as I know linux UIO driver maps non-cached memory region, RPMSG SDB - not.

1 ACCEPTED SOLUTION

Accepted Solutions
ArnaudP
Senior

Hello,

Do you try to use dma_alloc_coherent/dma_free_coherent instead of dma_alloc_wc/dma_free_wc in the rpmsg sdb driver?

For more information on DMA mapping APIs, you can refer to following documentation: https://www.kernel.org/doc/Documentation/DMA-API-HOWTO.txt

View solution in original post

4 REPLIES 4
ArnaudP
Senior

Hello,

Do you try to use dma_alloc_coherent/dma_free_coherent instead of dma_alloc_wc/dma_free_wc in the rpmsg sdb driver?

For more information on DMA mapping APIs, you can refer to following documentation: https://www.kernel.org/doc/Documentation/DMA-API-HOWTO.txt

mishuk
Associate III

Great ! It works !

Does it make sense for passing pgprot_noncached(vma->vm_page_prot)

instead of vma->vm_page_prot for the last parameter in remap_pfn_range() like it is done in UIO driver ?

ArnaudP
Senior

Not enough expert to give you a definitive answer but seems that it would be the same for the stm32mp1 regarding the code:

https://elixir.bootlin.com/linux/latest/source/arch/arm/include/asm/pgtable-nommu.h#L56

That said, the uio driver is upstreamed so it makes sense to be inspired by it.

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.