diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2015-04-13 10:03:32 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-04-13 10:03:32 -0400 |
commit | 3e20a26b02bd4f24945c87407df51948dd488620 (patch) | |
tree | f466d3b2a47a98ec2910724e17ee2f3a93c1a49e /arch/mips/include/asm/cacheflush.h | |
parent | 98b0429b7abd5c05efdb23f3eba02ec3f696748e (diff) | |
parent | 5306a5450824691e27d68f711758515debedeeac (diff) |
Merge branch '4.0-fixes' into mips-for-linux-next
Diffstat (limited to 'arch/mips/include/asm/cacheflush.h')
-rw-r--r-- | arch/mips/include/asm/cacheflush.h | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/arch/mips/include/asm/cacheflush.h b/arch/mips/include/asm/cacheflush.h index e08381a37f8b..723229f4cf27 100644 --- a/arch/mips/include/asm/cacheflush.h +++ b/arch/mips/include/asm/cacheflush.h | |||
@@ -29,6 +29,20 @@ | |||
29 | * - flush_icache_all() flush the entire instruction cache | 29 | * - flush_icache_all() flush the entire instruction cache |
30 | * - flush_data_cache_page() flushes a page from the data cache | 30 | * - flush_data_cache_page() flushes a page from the data cache |
31 | */ | 31 | */ |
32 | |||
33 | /* | ||
34 | * This flag is used to indicate that the page pointed to by a pte | ||
35 | * is dirty and requires cleaning before returning it to the user. | ||
36 | */ | ||
37 | #define PG_dcache_dirty PG_arch_1 | ||
38 | |||
39 | #define Page_dcache_dirty(page) \ | ||
40 | test_bit(PG_dcache_dirty, &(page)->flags) | ||
41 | #define SetPageDcacheDirty(page) \ | ||
42 | set_bit(PG_dcache_dirty, &(page)->flags) | ||
43 | #define ClearPageDcacheDirty(page) \ | ||
44 | clear_bit(PG_dcache_dirty, &(page)->flags) | ||
45 | |||
32 | extern void (*flush_cache_all)(void); | 46 | extern void (*flush_cache_all)(void); |
33 | extern void (*__flush_cache_all)(void); | 47 | extern void (*__flush_cache_all)(void); |
34 | extern void (*flush_cache_mm)(struct mm_struct *mm); | 48 | extern void (*flush_cache_mm)(struct mm_struct *mm); |
@@ -37,13 +51,15 @@ extern void (*flush_cache_range)(struct vm_area_struct *vma, | |||
37 | unsigned long start, unsigned long end); | 51 | unsigned long start, unsigned long end); |
38 | extern void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, unsigned long pfn); | 52 | extern void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, unsigned long pfn); |
39 | extern void __flush_dcache_page(struct page *page); | 53 | extern void __flush_dcache_page(struct page *page); |
54 | extern void __flush_icache_page(struct vm_area_struct *vma, struct page *page); | ||
40 | 55 | ||
41 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | 56 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 |
42 | static inline void flush_dcache_page(struct page *page) | 57 | static inline void flush_dcache_page(struct page *page) |
43 | { | 58 | { |
44 | if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc) | 59 | if (cpu_has_dc_aliases) |
45 | __flush_dcache_page(page); | 60 | __flush_dcache_page(page); |
46 | 61 | else if (!cpu_has_ic_fills_f_dc) | |
62 | SetPageDcacheDirty(page); | ||
47 | } | 63 | } |
48 | 64 | ||
49 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | 65 | #define flush_dcache_mmap_lock(mapping) do { } while (0) |
@@ -61,6 +77,11 @@ static inline void flush_anon_page(struct vm_area_struct *vma, | |||
61 | static inline void flush_icache_page(struct vm_area_struct *vma, | 77 | static inline void flush_icache_page(struct vm_area_struct *vma, |
62 | struct page *page) | 78 | struct page *page) |
63 | { | 79 | { |
80 | if (!cpu_has_ic_fills_f_dc && (vma->vm_flags & VM_EXEC) && | ||
81 | Page_dcache_dirty(page)) { | ||
82 | __flush_icache_page(vma, page); | ||
83 | ClearPageDcacheDirty(page); | ||
84 | } | ||
64 | } | 85 | } |
65 | 86 | ||
66 | extern void (*flush_icache_range)(unsigned long start, unsigned long end); | 87 | extern void (*flush_icache_range)(unsigned long start, unsigned long end); |
@@ -95,19 +116,6 @@ extern void (*flush_icache_all)(void); | |||
95 | extern void (*local_flush_data_cache_page)(void * addr); | 116 | extern void (*local_flush_data_cache_page)(void * addr); |
96 | extern void (*flush_data_cache_page)(unsigned long addr); | 117 | extern void (*flush_data_cache_page)(unsigned long addr); |
97 | 118 | ||
98 | /* | ||
99 | * This flag is used to indicate that the page pointed to by a pte | ||
100 | * is dirty and requires cleaning before returning it to the user. | ||
101 | */ | ||
102 | #define PG_dcache_dirty PG_arch_1 | ||
103 | |||
104 | #define Page_dcache_dirty(page) \ | ||
105 | test_bit(PG_dcache_dirty, &(page)->flags) | ||
106 | #define SetPageDcacheDirty(page) \ | ||
107 | set_bit(PG_dcache_dirty, &(page)->flags) | ||
108 | #define ClearPageDcacheDirty(page) \ | ||
109 | clear_bit(PG_dcache_dirty, &(page)->flags) | ||
110 | |||
111 | /* Run kernel code uncached, useful for cache probing functions. */ | 119 | /* Run kernel code uncached, useful for cache probing functions. */ |
112 | unsigned long run_uncached(void *func); | 120 | unsigned long run_uncached(void *func); |
113 | 121 | ||