summary refs log tree commit diff
path: root/arch/score/mm
diff options
context:
space:
mode:
authorChen Liqin <liqin.chen@sunplusct.com>2009-11-18 13:22:33 +0800
committerChen Liqin <liqin.chen@sunplusct.com>2009-12-17 18:28:31 +0800
commit11ab3f3d3c2474d3ed6912443de74c3972bd6f23 (patch)
tree51b121a80494989c220b10dbef1f2c463882899f /arch/score/mm
parent718deb6b61e34c200c1f2b706176d9aac334cb2d (diff)
downloadlinux-11ab3f3d3c2474d3ed6912443de74c3972bd6f23.tar.gz
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
Diffstat (limited to 'arch/score/mm')
-rw-r--r--arch/score/mm/cache.c26
1 files changed, 24 insertions, 2 deletions
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 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/fs.h>
 
 #include <asm/mmu_context.h>
 
@@ -51,6 +52,27 @@ static void flush_data_cache_page(unsigned long addr)
 	}
 }
 
+void flush_dcache_page(struct page *page)
+{
+	struct address_space *mapping = page_mapping(page);
+	unsigned long addr;
+
+	if (PageHighMem(page))
+		return;
+	if (mapping && !mapping_mapped(mapping)) {
+		set_bit(PG_dcache_dirty, &(page)->flags);
+		return;
+	}
+
+	/*
+	 * We could delay the flush for the !page_mapping case too.  But that
+	 * case is for exec env/arg pages and those are %99 certainly going to
+	 * get faulted into the tlb (and thus flushed) anyways.
+	 */
+	addr = (unsigned long) page_address(page);
+	flush_data_cache_page(addr);
+}
+
 /* called by update_mmu_cache. */
 void __update_cache(struct vm_area_struct *vma, unsigned long address,
 		pte_t pte)
@@ -63,11 +85,11 @@ void __update_cache(struct vm_area_struct *vma, unsigned long address,
 	if (unlikely(!pfn_valid(pfn)))
 		return;
 	page = pfn_to_page(pfn);
-	if (page_mapping(page) && test_bit(PG_arch_1, &page->flags)) {
+	if (page_mapping(page) && test_bit(PG_dcache_dirty, &(page)->flags)) {
 		addr = (unsigned long) page_address(page);
 		if (exec)
 			flush_data_cache_page(addr);
-		clear_bit(PG_arch_1, &page->flags);
+		clear_bit(PG_dcache_dirty, &(page)->flags);
 	}
 }