1 --- a/arch/arm/include/asm/glue-cache.h
2 +++ b/arch/arm/include/asm/glue-cache.h
3 @@ -152,9 +152,15 @@ static inline void nop_dma_unmap_area(co
4 #define __cpuc_flush_user_range __glue(_CACHE,_flush_user_cache_range)
5 #define __cpuc_coherent_kern_range __glue(_CACHE,_coherent_kern_range)
6 #define __cpuc_coherent_user_range __glue(_CACHE,_coherent_user_range)
7 -#define __cpuc_flush_dcache_area __glue(_CACHE,_flush_kern_dcache_area)
9 -#define dmac_flush_range __glue(_CACHE,_dma_flush_range)
10 +#ifndef CONFIG_DMA_CACHE_FIQ_BROADCAST
11 +# define __cpuc_flush_dcache_area __glue(_CACHE,_flush_kern_dcache_area)
12 +# define dmac_flush_range __glue(_CACHE,_dma_flush_range)
14 +# define __cpuc_flush_dcache_area __glue(fiq,_flush_kern_dcache_area)
15 +# define dmac_flush_range __glue(fiq,_dma_flush_range)
21 --- a/arch/arm/mm/Kconfig
22 +++ b/arch/arm/mm/Kconfig
23 @@ -873,6 +873,17 @@ config DMA_CACHE_RWFO
24 in hardware, other workarounds are needed (e.g. cache
25 maintenance broadcasting in software via FIQ).
27 +config DMA_CACHE_FIQ_BROADCAST
28 + bool "Enable fiq broadcast DMA cache maintenance"
29 + depends on CPU_V6K && SMP
32 + The Snoop Control Unit on ARM11MPCore does not detect the
33 + cache maintenance operations and the dma_{map,unmap}_area()
34 + functions may leave stale cache entries on other CPUs. By
35 + enabling this option, fiq broadcast in the ARMv6
36 + DMA cache maintenance functions is performed.
41 --- a/arch/arm/mm/flush.c
42 +++ b/arch/arm/mm/flush.c
43 @@ -319,6 +319,7 @@ void __sync_icache_dcache(pte_t pteval)
44 void flush_dcache_page(struct page *page)
46 struct address_space *mapping;
47 + bool skip_broadcast = true;
50 * The zero page is never written to, so never has any dirty
51 @@ -329,7 +330,10 @@ void flush_dcache_page(struct page *page
53 mapping = page_mapping(page);
55 - if (!cache_ops_need_broadcast() &&
56 +#ifndef CONFIG_DMA_CACHE_FIQ_BROADCAST
57 + skip_broadcast = !cache_ops_need_broadcast();
59 + if (skip_broadcast &&
60 mapping && !page_mapcount(page))
61 clear_bit(PG_dcache_clean, &page->flags);
63 --- a/arch/arm/mm/dma.h
64 +++ b/arch/arm/mm/dma.h
66 #include <asm/glue-cache.h>
69 -#define dmac_map_area __glue(_CACHE,_dma_map_area)
70 -#define dmac_unmap_area __glue(_CACHE,_dma_unmap_area)
71 +#ifndef CONFIG_DMA_CACHE_FIQ_BROADCAST
72 +# define dmac_map_area __glue(_CACHE,_dma_map_area)
73 +# define dmac_unmap_area __glue(_CACHE,_dma_unmap_area)
75 +# define dmac_map_area __glue(fiq,_dma_map_area)
76 +# define dmac_unmap_area __glue(fiq,_dma_unmap_area)
80 * These are private to the dma-mapping API. Do not use directly.