[PATCH rtems-libbsd 5/7] busdma: Don't sync nocache memory on ARM

Christian Mauderer christian.mauderer at embedded-brains.de
Fri Jul 17 05:56:18 UTC 2020


The busdma shouldn't try to flush or invalidate cache in a nocache area.
---
 rtemsbsd/rtems/rtems-kernel-bus-dma.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/rtemsbsd/rtems/rtems-kernel-bus-dma.c b/rtemsbsd/rtems/rtems-kernel-bus-dma.c
index 4dc634f3..bda4f3d7 100644
--- a/rtemsbsd/rtems/rtems-kernel-bus-dma.c
+++ b/rtemsbsd/rtems/rtems-kernel-bus-dma.c
@@ -48,6 +48,8 @@
 #include <machine/rtems-bsd-kernel-space.h>
 #include <machine/rtems-bsd-cache.h>
 #include <machine/rtems-bsd-bus-dma.h>
+#include <bsp.h>
+#include <bsp/linker-symbols.h>
 
 #include <rtems/malloc.h>
 
@@ -400,6 +402,12 @@ bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op)
 	uintptr_t size = map->buffer_size;
 	uintptr_t begin = (uintptr_t) map->buffer_begin;
 	uintptr_t end = begin + size;
+#ifdef __arm__
+	if (begin >= (uintptr_t)bsp_section_nocache_begin &&
+	    end <= (uintptr_t)bsp_section_nocachenoload_end) {
+		return;
+	}
+#endif
 
 	if ((map->flags & DMAMAP_CACHE_ALIGNED) != 0) {
 		begin &= ~CLMASK;
-- 
2.26.2



More information about the devel mailing list