Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
[sfrench/cifs-2.6.git] / arch / mips / mm / cache.c
index 1f954a238a6332b0d8aaa0a4dde2fc5903f4f225..81f925a9a731bbb20980ce13793f163932224ea1 100644 (file)
@@ -3,8 +3,11 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 1994 - 2003 by Ralf Baechle
+ * Copyright (C) 1994 - 2003, 07 by Ralf Baechle (ralf@linux-mips.org)
+ * Copyright (C) 2007 MIPS Technologies, Inc.
  */
+#include <linux/fs.h>
+#include <linux/fcntl.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -88,6 +91,19 @@ void __flush_dcache_page(struct page *page)
 
 EXPORT_SYMBOL(__flush_dcache_page);
 
+void __flush_anon_page(struct page *page, unsigned long vmaddr)
+{
+       if (pages_do_alias((unsigned long)page_address(page), vmaddr)) {
+               void *kaddr;
+
+               kaddr = kmap_coherent(page, vmaddr);
+               flush_data_cache_page((unsigned long)kaddr);
+               kunmap_coherent();
+       }
+}
+
+EXPORT_SYMBOL(__flush_anon_page);
+
 void __update_cache(struct vm_area_struct *vma, unsigned long address,
        pte_t pte)
 {
@@ -107,8 +123,6 @@ void __update_cache(struct vm_area_struct *vma, unsigned long address,
        }
 }
 
-#define __weak __attribute__((weak))
-
 static char cache_panic[] __initdata = "Yeee, unsupported cache architecture.";
 
 void __init cpu_cache_init(void)
@@ -152,3 +166,11 @@ void __init cpu_cache_init(void)
 
        panic(cache_panic);
 }
+
+int __weak __uncached_access(struct file *file, unsigned long addr)
+{
+       if (file->f_flags & O_SYNC)
+               return 1;
+
+       return addr >= __pa(high_memory);
+}