mm: export symbol dependencies of is_zero_pfn()
[firefly-linux-kernel-4.4.55.git] / arch / mips / mm / init.c
index 6e4413330e362d99bbf9365385a8174b82b7c219..f42e35e42790fdcd7bc2a6e310ef9a3197a72879 100644 (file)
@@ -53,6 +53,7 @@
  */
 unsigned long empty_zero_page, zero_page_mask;
 EXPORT_SYMBOL_GPL(empty_zero_page);
+EXPORT_SYMBOL(zero_page_mask);
 
 /*
  * Not static inline because used by IP27 special magic initialization code
@@ -325,6 +326,38 @@ static inline void mem_init_free_highmem(void)
 #endif
 }
 
+unsigned __weak platform_maar_init(unsigned num_maars)
+{
+       return 0;
+}
+
+static void maar_init(void)
+{
+       unsigned num_maars, used, i;
+
+       if (!cpu_has_maar)
+               return;
+
+       /* Detect the number of MAARs */
+       write_c0_maari(~0);
+       back_to_back_c0_hazard();
+       num_maars = read_c0_maari() + 1;
+
+       /* MAARs should be in pairs */
+       WARN_ON(num_maars % 2);
+
+       /* Configure the required MAARs */
+       used = platform_maar_init(num_maars / 2);
+
+       /* Disable any further MAARs */
+       for (i = (used * 2); i < num_maars; i++) {
+               write_c0_maari(i);
+               back_to_back_c0_hazard();
+               write_c0_maar(0);
+               back_to_back_c0_hazard();
+       }
+}
+
 void __init mem_init(void)
 {
 #ifdef CONFIG_HIGHMEM
@@ -337,6 +370,7 @@ void __init mem_init(void)
 #endif
        high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
 
+       maar_init();
        free_all_bootmem();
        setup_zero_pages();     /* Setup zeroed pages.  */
        mem_init_free_highmem();