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