diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-10 10:24:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-10 10:24:14 -0400 |
commit | 6019958d146a4f127dae727a930f902c92531e6e (patch) | |
tree | 126cfbdafb7008ce9701dd2ccc27c54cab2d36f4 /arch/arc/include/asm/cacheflush.h | |
parent | 977b58e1dd6fc2a751fb427798bfb8256476c93e (diff) | |
parent | e7d5bab5efb94a82d80cab3ad68c357ce73ea596 (diff) |
Merge tag 'arc-v3.10-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc
Pull second set of arc arch updates from Vineet Gupta:
"Aliasing VIPT dcache support for ARC
I'm satisified with testing, specially with fuse which has
historically given grief to VIPT arches (ARM/PARISC...)"
* tag 'arc-v3.10-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc:
ARC: [TB10x] Remove GENERIC_GPIO
ARC: [mm] Aliasing VIPT dcache support 4/4
ARC: [mm] Aliasing VIPT dcache support 3/4
ARC: [mm] Aliasing VIPT dcache support 2/4
ARC: [mm] Aliasing VIPT dcache support 1/4
ARC: [mm] refactor the core (i|d)cache line ops loops
ARC: [mm] serious bug in vaddr based icache flush
Diffstat (limited to 'arch/arc/include/asm/cacheflush.h')
-rw-r--r-- | arch/arc/include/asm/cacheflush.h | 58 |
1 files changed, 49 insertions, 9 deletions
diff --git a/arch/arc/include/asm/cacheflush.h b/arch/arc/include/asm/cacheflush.h index ee1f6eae82d2..9f841af41092 100644 --- a/arch/arc/include/asm/cacheflush.h +++ b/arch/arc/include/asm/cacheflush.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #define _ASM_CACHEFLUSH_H | 19 | #define _ASM_CACHEFLUSH_H |
20 | 20 | ||
21 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
22 | #include <asm/shmparam.h> | ||
22 | 23 | ||
23 | /* | 24 | /* |
24 | * Semantically we need this because icache doesn't snoop dcache/dma. | 25 | * Semantically we need this because icache doesn't snoop dcache/dma. |
@@ -33,7 +34,9 @@ void flush_cache_all(void); | |||
33 | void flush_icache_range(unsigned long start, unsigned long end); | 34 | void flush_icache_range(unsigned long start, unsigned long end); |
34 | void __sync_icache_dcache(unsigned long paddr, unsigned long vaddr, int len); | 35 | void __sync_icache_dcache(unsigned long paddr, unsigned long vaddr, int len); |
35 | void __inv_icache_page(unsigned long paddr, unsigned long vaddr); | 36 | void __inv_icache_page(unsigned long paddr, unsigned long vaddr); |
36 | void __flush_dcache_page(unsigned long paddr); | 37 | void ___flush_dcache_page(unsigned long paddr, unsigned long vaddr); |
38 | #define __flush_dcache_page(p, v) \ | ||
39 | ___flush_dcache_page((unsigned long)p, (unsigned long)v) | ||
37 | 40 | ||
38 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | 41 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 |
39 | 42 | ||
@@ -50,18 +53,55 @@ void dma_cache_wback(unsigned long start, unsigned long sz); | |||
50 | #define flush_cache_vmap(start, end) flush_cache_all() | 53 | #define flush_cache_vmap(start, end) flush_cache_all() |
51 | #define flush_cache_vunmap(start, end) flush_cache_all() | 54 | #define flush_cache_vunmap(start, end) flush_cache_all() |
52 | 55 | ||
53 | /* | 56 | #define flush_cache_dup_mm(mm) /* called on fork (VIVT only) */ |
54 | * VM callbacks when entire/range of user-space V-P mappings are | 57 | |
55 | * torn-down/get-invalidated | 58 | #ifndef CONFIG_ARC_CACHE_VIPT_ALIASING |
56 | * | 59 | |
57 | * Currently we don't support D$ aliasing configs for our VIPT caches | ||
58 | * NOPS for VIPT Cache with non-aliasing D$ configurations only | ||
59 | */ | ||
60 | #define flush_cache_dup_mm(mm) /* called on fork */ | ||
61 | #define flush_cache_mm(mm) /* called on munmap/exit */ | 60 | #define flush_cache_mm(mm) /* called on munmap/exit */ |
62 | #define flush_cache_range(mm, u_vstart, u_vend) | 61 | #define flush_cache_range(mm, u_vstart, u_vend) |
63 | #define flush_cache_page(vma, u_vaddr, pfn) /* PF handling/COW-break */ | 62 | #define flush_cache_page(vma, u_vaddr, pfn) /* PF handling/COW-break */ |
64 | 63 | ||
64 | #else /* VIPT aliasing dcache */ | ||
65 | |||
66 | /* To clear out stale userspace mappings */ | ||
67 | void flush_cache_mm(struct mm_struct *mm); | ||
68 | void flush_cache_range(struct vm_area_struct *vma, | ||
69 | unsigned long start,unsigned long end); | ||
70 | void flush_cache_page(struct vm_area_struct *vma, | ||
71 | unsigned long user_addr, unsigned long page); | ||
72 | |||
73 | /* | ||
74 | * To make sure that userspace mapping is flushed to memory before | ||
75 | * get_user_pages() uses a kernel mapping to access the page | ||
76 | */ | ||
77 | #define ARCH_HAS_FLUSH_ANON_PAGE | ||
78 | void flush_anon_page(struct vm_area_struct *vma, | ||
79 | struct page *page, unsigned long u_vaddr); | ||
80 | |||
81 | #endif /* CONFIG_ARC_CACHE_VIPT_ALIASING */ | ||
82 | |||
83 | /* | ||
84 | * Simple wrapper over config option | ||
85 | * Bootup code ensures that hardware matches kernel configuration | ||
86 | */ | ||
87 | static inline int cache_is_vipt_aliasing(void) | ||
88 | { | ||
89 | #ifdef CONFIG_ARC_CACHE_VIPT_ALIASING | ||
90 | return 1; | ||
91 | #else | ||
92 | return 0; | ||
93 | #endif | ||
94 | } | ||
95 | |||
96 | #define CACHE_COLOR(addr) (((unsigned long)(addr) >> (PAGE_SHIFT)) & 3) | ||
97 | |||
98 | /* | ||
99 | * checks if two addresses (after page aligning) index into same cache set | ||
100 | */ | ||
101 | #define addr_not_cache_congruent(addr1, addr2) \ | ||
102 | cache_is_vipt_aliasing() ? \ | ||
103 | (CACHE_COLOR(addr1) != CACHE_COLOR(addr2)) : 0 \ | ||
104 | |||
65 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | 105 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ |
66 | do { \ | 106 | do { \ |
67 | memcpy(dst, src, len); \ | 107 | memcpy(dst, src, len); \ |