diff options
Diffstat (limited to 'arch/sh/include/asm/cacheflush.h')
-rw-r--r-- | arch/sh/include/asm/cacheflush.h | 114 |
1 files changed, 65 insertions, 49 deletions
diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h index 4c5462daa74c..c29918f3c819 100644 --- a/arch/sh/include/asm/cacheflush.h +++ b/arch/sh/include/asm/cacheflush.h | |||
@@ -3,45 +3,65 @@ | |||
3 | 3 | ||
4 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
5 | 5 | ||
6 | #ifdef CONFIG_CACHE_OFF | 6 | #include <linux/mm.h> |
7 | |||
7 | /* | 8 | /* |
8 | * Nothing to do when the cache is disabled, initial flush and explicit | 9 | * Cache flushing: |
9 | * disabling is handled at CPU init time. | 10 | * |
11 | * - flush_cache_all() flushes entire cache | ||
12 | * - flush_cache_mm(mm) flushes the specified mm context's cache lines | ||
13 | * - flush_cache_dup mm(mm) handles cache flushing when forking | ||
14 | * - flush_cache_page(mm, vmaddr, pfn) flushes a single page | ||
15 | * - flush_cache_range(vma, start, end) flushes a range of pages | ||
10 | * | 16 | * |
11 | * See arch/sh/kernel/cpu/init.c:cache_init(). | 17 | * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache |
18 | * - flush_icache_range(start, end) flushes(invalidates) a range for icache | ||
19 | * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache | ||
20 | * - flush_cache_sigtramp(vaddr) flushes the signal trampoline | ||
12 | */ | 21 | */ |
13 | #define p3_cache_init() do { } while (0) | 22 | extern void (*local_flush_cache_all)(void *args); |
14 | #define flush_cache_all() do { } while (0) | 23 | extern void (*local_flush_cache_mm)(void *args); |
15 | #define flush_cache_mm(mm) do { } while (0) | 24 | extern void (*local_flush_cache_dup_mm)(void *args); |
16 | #define flush_cache_dup_mm(mm) do { } while (0) | 25 | extern void (*local_flush_cache_page)(void *args); |
17 | #define flush_cache_range(vma, start, end) do { } while (0) | 26 | extern void (*local_flush_cache_range)(void *args); |
18 | #define flush_cache_page(vma, vmaddr, pfn) do { } while (0) | 27 | extern void (*local_flush_dcache_page)(void *args); |
19 | #define flush_dcache_page(page) do { } while (0) | 28 | extern void (*local_flush_icache_range)(void *args); |
20 | #define flush_icache_range(start, end) do { } while (0) | 29 | extern void (*local_flush_icache_page)(void *args); |
21 | #define flush_icache_page(vma,pg) do { } while (0) | 30 | extern void (*local_flush_cache_sigtramp)(void *args); |
22 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | ||
23 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | ||
24 | #define flush_cache_sigtramp(vaddr) do { } while (0) | ||
25 | #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) | ||
26 | #define __flush_wback_region(start, size) do { (void)(start); } while (0) | ||
27 | #define __flush_purge_region(start, size) do { (void)(start); } while (0) | ||
28 | #define __flush_invalidate_region(start, size) do { (void)(start); } while (0) | ||
29 | #else | ||
30 | #include <cpu/cacheflush.h> | ||
31 | 31 | ||
32 | /* | 32 | static inline void cache_noop(void *args) { } |
33 | * Consistent DMA requires that the __flush_xxx() primitives must be set | 33 | |
34 | * for any of the enabled non-coherent caches (most of the UP CPUs), | 34 | extern void (*__flush_wback_region)(void *start, int size); |
35 | * regardless of PIPT or VIPT cache configurations. | 35 | extern void (*__flush_purge_region)(void *start, int size); |
36 | */ | 36 | extern void (*__flush_invalidate_region)(void *start, int size); |
37 | |||
38 | extern void flush_cache_all(void); | ||
39 | extern void flush_cache_mm(struct mm_struct *mm); | ||
40 | extern void flush_cache_dup_mm(struct mm_struct *mm); | ||
41 | extern void flush_cache_page(struct vm_area_struct *vma, | ||
42 | unsigned long addr, unsigned long pfn); | ||
43 | extern void flush_cache_range(struct vm_area_struct *vma, | ||
44 | unsigned long start, unsigned long end); | ||
45 | extern void flush_dcache_page(struct page *page); | ||
46 | extern void flush_icache_range(unsigned long start, unsigned long end); | ||
47 | extern void flush_icache_page(struct vm_area_struct *vma, | ||
48 | struct page *page); | ||
49 | extern void flush_cache_sigtramp(unsigned long address); | ||
50 | |||
51 | struct flusher_data { | ||
52 | struct vm_area_struct *vma; | ||
53 | unsigned long addr1, addr2; | ||
54 | }; | ||
37 | 55 | ||
38 | /* Flush (write-back only) a region (smaller than a page) */ | 56 | #define ARCH_HAS_FLUSH_ANON_PAGE |
39 | extern void __flush_wback_region(void *start, int size); | 57 | extern void __flush_anon_page(struct page *page, unsigned long); |
40 | /* Flush (write-back & invalidate) a region (smaller than a page) */ | 58 | |
41 | extern void __flush_purge_region(void *start, int size); | 59 | static inline void flush_anon_page(struct vm_area_struct *vma, |
42 | /* Flush (invalidate only) a region (smaller than a page) */ | 60 | struct page *page, unsigned long vmaddr) |
43 | extern void __flush_invalidate_region(void *start, int size); | 61 | { |
44 | #endif | 62 | if (boot_cpu_data.dcache.n_aliases && PageAnon(page)) |
63 | __flush_anon_page(page, vmaddr); | ||
64 | } | ||
45 | 65 | ||
46 | #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE | 66 | #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE |
47 | static inline void flush_kernel_dcache_page(struct page *page) | 67 | static inline void flush_kernel_dcache_page(struct page *page) |
@@ -49,7 +69,6 @@ static inline void flush_kernel_dcache_page(struct page *page) | |||
49 | flush_dcache_page(page); | 69 | flush_dcache_page(page); |
50 | } | 70 | } |
51 | 71 | ||
52 | #if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF) | ||
53 | extern void copy_to_user_page(struct vm_area_struct *vma, | 72 | extern void copy_to_user_page(struct vm_area_struct *vma, |
54 | struct page *page, unsigned long vaddr, void *dst, const void *src, | 73 | struct page *page, unsigned long vaddr, void *dst, const void *src, |
55 | unsigned long len); | 74 | unsigned long len); |
@@ -57,23 +76,20 @@ extern void copy_to_user_page(struct vm_area_struct *vma, | |||
57 | extern void copy_from_user_page(struct vm_area_struct *vma, | 76 | extern void copy_from_user_page(struct vm_area_struct *vma, |
58 | struct page *page, unsigned long vaddr, void *dst, const void *src, | 77 | struct page *page, unsigned long vaddr, void *dst, const void *src, |
59 | unsigned long len); | 78 | unsigned long len); |
60 | #else | ||
61 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | ||
62 | do { \ | ||
63 | flush_cache_page(vma, vaddr, page_to_pfn(page));\ | ||
64 | memcpy(dst, src, len); \ | ||
65 | flush_icache_user_range(vma, page, vaddr, len); \ | ||
66 | } while (0) | ||
67 | |||
68 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | ||
69 | do { \ | ||
70 | flush_cache_page(vma, vaddr, page_to_pfn(page));\ | ||
71 | memcpy(dst, src, len); \ | ||
72 | } while (0) | ||
73 | #endif | ||
74 | 79 | ||
75 | #define flush_cache_vmap(start, end) flush_cache_all() | 80 | #define flush_cache_vmap(start, end) flush_cache_all() |
76 | #define flush_cache_vunmap(start, end) flush_cache_all() | 81 | #define flush_cache_vunmap(start, end) flush_cache_all() |
77 | 82 | ||
83 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | ||
84 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | ||
85 | |||
86 | void kmap_coherent_init(void); | ||
87 | void *kmap_coherent(struct page *page, unsigned long addr); | ||
88 | void kunmap_coherent(void *kvaddr); | ||
89 | |||
90 | #define PG_dcache_dirty PG_arch_1 | ||
91 | |||
92 | void cpu_cache_init(void); | ||
93 | |||
78 | #endif /* __KERNEL__ */ | 94 | #endif /* __KERNEL__ */ |
79 | #endif /* __ASM_SH_CACHEFLUSH_H */ | 95 | #endif /* __ASM_SH_CACHEFLUSH_H */ |