diff options
| author | Chen Liqin <liqin.chen@sunplusct.com> | 2009-11-18 00:22:33 -0500 |
|---|---|---|
| committer | Chen Liqin <liqin.chen@sunplusct.com> | 2009-12-17 05:28:31 -0500 |
| commit | 11ab3f3d3c2474d3ed6912443de74c3972bd6f23 (patch) | |
| tree | 51b121a80494989c220b10dbef1f2c463882899f | |
| parent | 718deb6b61e34c200c1f2b706176d9aac334cb2d (diff) | |
score: add flush_dcahce_page and PG_dcache_dirty define
Signed-off-by: Cui Bixiong <bixiong@sunnorth.com.cn>
Signed-off-by: Chen Liqin <liqin.chen@sunplusct.com>
modified: arch/score/include/asm/cacheflush.h
modified: arch/score/mm/cache.c
| -rw-r--r-- | arch/score/include/asm/cacheflush.h | 4 | ||||
| -rw-r--r-- | arch/score/mm/cache.c | 26 |
2 files changed, 27 insertions, 3 deletions
diff --git a/arch/score/include/asm/cacheflush.h b/arch/score/include/asm/cacheflush.h index caaba24036e3..1d545d0ce206 100644 --- a/arch/score/include/asm/cacheflush.h +++ b/arch/score/include/asm/cacheflush.h | |||
| @@ -14,10 +14,12 @@ extern void flush_cache_sigtramp(unsigned long addr); | |||
| 14 | extern void flush_icache_all(void); | 14 | extern void flush_icache_all(void); |
| 15 | extern void flush_icache_range(unsigned long start, unsigned long end); | 15 | extern void flush_icache_range(unsigned long start, unsigned long end); |
| 16 | extern void flush_dcache_range(unsigned long start, unsigned long end); | 16 | extern void flush_dcache_range(unsigned long start, unsigned long end); |
| 17 | extern void flush_dcache_page(struct page *page); | ||
| 18 | |||
| 19 | #define PG_dcache_dirty PG_arch_1 | ||
| 17 | 20 | ||
| 18 | #define flush_cache_dup_mm(mm) do {} while (0) | 21 | #define flush_cache_dup_mm(mm) do {} while (0) |
| 19 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 | 22 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 |
| 20 | #define flush_dcache_page(page) do {} while (0) | ||
| 21 | #define flush_dcache_mmap_lock(mapping) do {} while (0) | 23 | #define flush_dcache_mmap_lock(mapping) do {} while (0) |
| 22 | #define flush_dcache_mmap_unlock(mapping) do {} while (0) | 24 | #define flush_dcache_mmap_unlock(mapping) do {} while (0) |
| 23 | #define flush_cache_vmap(start, end) do {} while (0) | 25 | #define flush_cache_vmap(start, end) do {} while (0) |
diff --git a/arch/score/mm/cache.c b/arch/score/mm/cache.c index dbac9d9dfddd..b25e95743600 100644 --- a/arch/score/mm/cache.c +++ b/arch/score/mm/cache.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/mm.h> | 29 | #include <linux/mm.h> |
| 30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
| 31 | #include <linux/sched.h> | 31 | #include <linux/sched.h> |
| 32 | #include <linux/fs.h> | ||
| 32 | 33 | ||
| 33 | #include <asm/mmu_context.h> | 34 | #include <asm/mmu_context.h> |
| 34 | 35 | ||
| @@ -51,6 +52,27 @@ static void flush_data_cache_page(unsigned long addr) | |||
| 51 | } | 52 | } |
| 52 | } | 53 | } |
| 53 | 54 | ||
| 55 | void flush_dcache_page(struct page *page) | ||
| 56 | { | ||
| 57 | struct address_space *mapping = page_mapping(page); | ||
| 58 | unsigned long addr; | ||
| 59 | |||
| 60 | if (PageHighMem(page)) | ||
| 61 | return; | ||
| 62 | if (mapping && !mapping_mapped(mapping)) { | ||
| 63 | set_bit(PG_dcache_dirty, &(page)->flags); | ||
| 64 | return; | ||
| 65 | } | ||
| 66 | |||
| 67 | /* | ||
| 68 | * We could delay the flush for the !page_mapping case too. But that | ||
| 69 | * case is for exec env/arg pages and those are %99 certainly going to | ||
| 70 | * get faulted into the tlb (and thus flushed) anyways. | ||
| 71 | */ | ||
| 72 | addr = (unsigned long) page_address(page); | ||
| 73 | flush_data_cache_page(addr); | ||
| 74 | } | ||
| 75 | |||
| 54 | /* called by update_mmu_cache. */ | 76 | /* called by update_mmu_cache. */ |
| 55 | void __update_cache(struct vm_area_struct *vma, unsigned long address, | 77 | void __update_cache(struct vm_area_struct *vma, unsigned long address, |
| 56 | pte_t pte) | 78 | pte_t pte) |
| @@ -63,11 +85,11 @@ void __update_cache(struct vm_area_struct *vma, unsigned long address, | |||
| 63 | if (unlikely(!pfn_valid(pfn))) | 85 | if (unlikely(!pfn_valid(pfn))) |
| 64 | return; | 86 | return; |
| 65 | page = pfn_to_page(pfn); | 87 | page = pfn_to_page(pfn); |
| 66 | if (page_mapping(page) && test_bit(PG_arch_1, &page->flags)) { | 88 | if (page_mapping(page) && test_bit(PG_dcache_dirty, &(page)->flags)) { |
| 67 | addr = (unsigned long) page_address(page); | 89 | addr = (unsigned long) page_address(page); |
| 68 | if (exec) | 90 | if (exec) |
| 69 | flush_data_cache_page(addr); | 91 | flush_data_cache_page(addr); |
| 70 | clear_bit(PG_arch_1, &page->flags); | 92 | clear_bit(PG_dcache_dirty, &(page)->flags); |
| 71 | } | 93 | } |
| 72 | } | 94 | } |
| 73 | 95 | ||
