Pull button into test branch
[sfrench/cifs-2.6.git] / arch / mips / mm / init.c
index 9e29ba9205f0c187925edd51214849f4567d89f5..30245c09d0258e224475b0ceeb9e50d7c6c797a1 100644 (file)
@@ -203,6 +203,31 @@ static inline void kunmap_coherent(struct page *page)
        preempt_check_resched();
 }
 
+void copy_user_highpage(struct page *to, struct page *from,
+       unsigned long vaddr, struct vm_area_struct *vma)
+{
+       void *vfrom, *vto;
+
+       vto = kmap_atomic(to, KM_USER1);
+       if (cpu_has_dc_aliases) {
+               vfrom = kmap_coherent(from, vaddr);
+               copy_page(vto, vfrom);
+               kunmap_coherent(from);
+       } else {
+               vfrom = kmap_atomic(from, KM_USER0);
+               copy_page(vto, vfrom);
+               kunmap_atomic(vfrom, KM_USER0);
+       }
+       if (((vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc) ||
+           pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK))
+               flush_data_cache_page((unsigned long)vto);
+       kunmap_atomic(vto, KM_USER1);
+       /* Make sure this page is cleared on other CPU's too before using it */
+       smp_wmb();
+}
+
+EXPORT_SYMBOL(copy_user_highpage);
+
 void copy_to_user_page(struct vm_area_struct *vma,
        struct page *page, unsigned long vaddr, void *dst, const void *src,
        unsigned long len)
@@ -316,7 +341,7 @@ static int __init page_is_ram(unsigned long pagenr)
 void __init paging_init(void)
 {
        unsigned long zones_size[MAX_NR_ZONES] = { 0, };
-       unsigned long max_dma, high, low;
+       unsigned long max_dma, low;
 #ifndef CONFIG_FLATMEM
        unsigned long zholes_size[MAX_NR_ZONES] = { 0, };
        unsigned long i, j, pfn;
@@ -331,7 +356,6 @@ void __init paging_init(void)
 
        max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
        low = max_low_pfn;
-       high = highend_pfn;
 
 #ifdef CONFIG_ISA
        if (low < max_dma)
@@ -344,13 +368,13 @@ void __init paging_init(void)
        zones_size[ZONE_DMA] = low;
 #endif
 #ifdef CONFIG_HIGHMEM
-       if (cpu_has_dc_aliases) {
-               printk(KERN_WARNING "This processor doesn't support highmem.");
-               if (high - low)
-                       printk(" %ldk highmem ignored", high - low);
-               printk("\n");
-       } else
-               zones_size[ZONE_HIGHMEM] = high - low;
+       zones_size[ZONE_HIGHMEM] = highend_pfn - highstart_pfn;
+
+       if (cpu_has_dc_aliases && zones_size[ZONE_HIGHMEM]) {
+               printk(KERN_WARNING "This processor doesn't support highmem."
+                      " %ldk highmem ignored\n", zones_size[ZONE_HIGHMEM]);
+               zones_size[ZONE_HIGHMEM] = 0;
+       }
 #endif
 
 #ifdef CONFIG_FLATMEM