fb7547f96bbd4998470e348d8ffdf6f264da8fb1
[openwrt.git] / target / linux / oxnas / patches-4.0 / 010-arm_introduce-dma-fiq-irq-broadcast.patch
1 Index: linux-3.18-rc4/arch/arm/include/asm/glue-cache.h
2 ===================================================================
3 --- linux-3.18-rc4.orig/arch/arm/include/asm/glue-cache.h
4 +++ linux-3.18-rc4/arch/arm/include/asm/glue-cache.h
5 @@ -156,11 +156,19 @@ static inline void nop_dma_unmap_area(co
6  #define __cpuc_flush_user_range                __glue(_CACHE,_flush_user_cache_range)
7  #define __cpuc_coherent_kern_range     __glue(_CACHE,_coherent_kern_range)
8  #define __cpuc_coherent_user_range     __glue(_CACHE,_coherent_user_range)
9 +#ifndef CONFIG_DMA_CACHE_FIQ_BROADCAST
10  #define __cpuc_flush_dcache_area       __glue(_CACHE,_flush_kern_dcache_area)
11  
12  #define dmac_map_area                  __glue(_CACHE,_dma_map_area)
13  #define dmac_unmap_area                        __glue(_CACHE,_dma_unmap_area)
14  #define dmac_flush_range               __glue(_CACHE,_dma_flush_range)
15 +#else
16 +#define __cpuc_flush_dcache_area       __glue(fiq,_flush_kern_dcache_area)
17 +
18 +#define dmac_map_area                  __glue(fiq,_dma_map_area)
19 +#define dmac_unmap_area                        __glue(fiq,_dma_unmap_area)
20 +#define dmac_flush_range               __glue(fiq,_dma_flush_range)
21 +#endif /* CONFIG_DMA_CACHE_FIQ_BROADCAST */
22  #endif
23  
24  #endif
25 Index: linux-3.18-rc4/arch/arm/mm/Kconfig
26 ===================================================================
27 --- linux-3.18-rc4.orig/arch/arm/mm/Kconfig
28 +++ linux-3.18-rc4/arch/arm/mm/Kconfig
29 @@ -843,6 +843,17 @@ config DMA_CACHE_RWFO
30           in hardware, other workarounds are needed (e.g. cache
31           maintenance broadcasting in software via FIQ).
32  
33 +config DMA_CACHE_FIQ_BROADCAST
34 +       bool "Enable fiq broadcast DMA cache maintenance"
35 +       depends on CPU_V6K && SMP
36 +       select FIQ
37 +       help
38 +         The Snoop Control Unit on ARM11MPCore does not detect the
39 +         cache maintenance operations and the dma_{map,unmap}_area()
40 +         functions may leave stale cache entries on other CPUs. By
41 +         enabling this option, fiq broadcast in the ARMv6
42 +         DMA cache maintenance functions is performed.
43 +
44  config OUTER_CACHE
45         bool
46  
47 Index: linux-3.18-rc4/arch/arm/mm/flush.c
48 ===================================================================
49 --- linux-3.18-rc4.orig/arch/arm/mm/flush.c
50 +++ linux-3.18-rc4/arch/arm/mm/flush.c
51 @@ -314,7 +314,11 @@ void flush_dcache_page(struct page *page
52  
53         mapping = page_mapping(page);
54  
55 +#ifndef CONFIG_DMA_CACHE_FIQ_BROADCAST
56         if (!cache_ops_need_broadcast() &&
57 +#else
58 +       if (
59 +#endif
60             mapping && !page_mapped(page))
61                 clear_bit(PG_dcache_clean, &page->flags);
62         else {