7c728b22ae924b0806402aa14665aab260033fac
[openwrt/staging/luka.git] /
1 From a45a0eb188581a6c1f57b7adc4f66f5754927ad3 Mon Sep 17 00:00:00 2001
2 From: Dan Pasanen <dan.pasanen@gmail.com>
3 Date: Thu, 21 Sep 2017 09:55:42 -0500
4 Subject: [PATCH 001/454] arm: partially revert
5 702b94bff3c50542a6e4ab9a4f4cef093262fe65
6
7 * Re-expose some dmi APIs for use in VCSM
8 ---
9 arch/arm/include/asm/cacheflush.h | 21 +++++++++++++++++++++
10 arch/arm/include/asm/glue-cache.h | 2 ++
11 arch/arm/mm/proc-macros.S | 2 ++
12 arch/arm/mm/proc-syms.c | 3 +++
13 4 files changed, 28 insertions(+)
14
15 --- a/arch/arm/include/asm/cacheflush.h
16 +++ b/arch/arm/include/asm/cacheflush.h
17 @@ -94,6 +94,21 @@
18 * DMA Cache Coherency
19 * ===================
20 *
21 + * dma_inv_range(start, end)
22 + *
23 + * Invalidate (discard) the specified virtual address range.
24 + * May not write back any entries. If 'start' or 'end'
25 + * are not cache line aligned, those lines must be written
26 + * back.
27 + * - start - virtual start address
28 + * - end - virtual end address
29 + *
30 + * dma_clean_range(start, end)
31 + *
32 + * Clean (write back) the specified virtual address range.
33 + * - start - virtual start address
34 + * - end - virtual end address
35 + *
36 * dma_flush_range(start, end)
37 *
38 * Clean and invalidate the specified virtual address range.
39 @@ -115,6 +130,8 @@ struct cpu_cache_fns {
40 void (*dma_map_area)(const void *, size_t, int);
41 void (*dma_unmap_area)(const void *, size_t, int);
42
43 + void (*dma_inv_range)(const void *, const void *);
44 + void (*dma_clean_range)(const void *, const void *);
45 void (*dma_flush_range)(const void *, const void *);
46 } __no_randomize_layout;
47
48 @@ -140,6 +157,8 @@ extern struct cpu_cache_fns cpu_cache;
49 * is visible to DMA, or data written by DMA to system memory is
50 * visible to the CPU.
51 */
52 +#define dmac_inv_range cpu_cache.dma_inv_range
53 +#define dmac_clean_range cpu_cache.dma_clean_range
54 #define dmac_flush_range cpu_cache.dma_flush_range
55
56 #else
57 @@ -159,6 +178,8 @@ extern void __cpuc_flush_dcache_area(voi
58 * is visible to DMA, or data written by DMA to system memory is
59 * visible to the CPU.
60 */
61 +extern void dmac_inv_range(const void *, const void *);
62 +extern void dmac_clean_range(const void *, const void *);
63 extern void dmac_flush_range(const void *, const void *);
64
65 #endif
66 --- a/arch/arm/include/asm/glue-cache.h
67 +++ b/arch/arm/include/asm/glue-cache.h
68 @@ -154,6 +154,8 @@ static inline void nop_dma_unmap_area(co
69 #define __cpuc_coherent_user_range __glue(_CACHE,_coherent_user_range)
70 #define __cpuc_flush_dcache_area __glue(_CACHE,_flush_kern_dcache_area)
71
72 +#define dmac_inv_range __glue(_CACHE,_dma_inv_range)
73 +#define dmac_clean_range __glue(_CACHE,_dma_clean_range)
74 #define dmac_flush_range __glue(_CACHE,_dma_flush_range)
75 #endif
76
77 --- a/arch/arm/mm/proc-macros.S
78 +++ b/arch/arm/mm/proc-macros.S
79 @@ -335,6 +335,8 @@ ENTRY(\name\()_cache_fns)
80 .long \name\()_flush_kern_dcache_area
81 .long \name\()_dma_map_area
82 .long \name\()_dma_unmap_area
83 + .long \name\()_dma_inv_range
84 + .long \name\()_dma_clean_range
85 .long \name\()_dma_flush_range
86 .size \name\()_cache_fns, . - \name\()_cache_fns
87 .endm
88 --- a/arch/arm/mm/proc-syms.c
89 +++ b/arch/arm/mm/proc-syms.c
90 @@ -30,6 +30,9 @@ EXPORT_SYMBOL(__cpuc_flush_user_all);
91 EXPORT_SYMBOL(__cpuc_flush_user_range);
92 EXPORT_SYMBOL(__cpuc_coherent_kern_range);
93 EXPORT_SYMBOL(__cpuc_flush_dcache_area);
94 +EXPORT_SYMBOL(dmac_inv_range);
95 +EXPORT_SYMBOL(dmac_clean_range);
96 +EXPORT_SYMBOL(dmac_flush_range);
97 #else
98 EXPORT_SYMBOL(cpu_cache);
99 #endif