Revert "arm: mm: cpa: remove APIs no longer used"
Krishna Reddy [Fri, 8 Nov 2013 06:10:21 +0000 (22:10 -0800)]
This reverts commit 98ecd24717543e80280adfdbf4957e8f54e46a3a.

Change-Id: I2a8b9aeba150b3f8b7ad00258bf659421683f5b4
Reviewed-on: http://git-master/r/328095
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
Tested-by: Krishna Reddy <vdumpa@nvidia.com>

arch/arm/mm/pageattr.c

index 0472c79..0ea6676 100644 (file)
@@ -41,8 +41,6 @@ static inline void v7_flush_kern_cache_all_arg(void *arg)
        v7_flush_kern_cache_all();
 }
 
-#if defined(CONFIG_CPA)
-
 #if defined(CONFIG_NVMAP_CACHE_MAINT_BY_SET_WAYS)
 static void inner_flush_cache_all(void)
 {
@@ -54,6 +52,8 @@ static void inner_flush_cache_all(void)
 }
 #endif
 
+#if defined(CONFIG_CPA)
+
 /*
  * The arm kernel uses different cache policies(CPOLICY_WRITEBACK,
  * CPOLICY_WRITEALLOC, CPOLICY_WRITETHROUGH) based on architecture version
@@ -1081,6 +1081,61 @@ int set_pages_array_iwb(struct page **pages, int addrinarray)
                        L_PTE_MT_INNER_WB, L_PTE_MT_MASK);
 }
 EXPORT_SYMBOL(set_pages_array_iwb);
+
+#else /* CONFIG_CPA */
+
+void update_page_count(int level, unsigned long pages)
+{
+}
+
+static void flush_cache(struct page **pages, int numpages)
+{
+       unsigned int i;
+       bool flush_inner = true;
+       unsigned long base;
+
+#if defined(CONFIG_NVMAP_CACHE_MAINT_BY_SET_WAYS)
+       if (numpages >= (inner_cache_maint_threshold >> PAGE_SHIFT)) {
+               inner_flush_cache_all();
+               flush_inner = false;
+       }
+#endif
+
+       for (i = 0; i < numpages; i++) {
+               if (flush_inner)
+                       __flush_dcache_page(page_mapping(pages[i]), pages[i]);
+               base = page_to_phys(pages[i]);
+               outer_flush_range(base, base + PAGE_SIZE);
+       }
+}
+
+int set_pages_array_uc(struct page **pages, int addrinarray)
+{
+       flush_cache(pages, addrinarray);
+       return 0;
+}
+EXPORT_SYMBOL(set_pages_array_uc);
+
+int set_pages_array_wc(struct page **pages, int addrinarray)
+{
+       flush_cache(pages, addrinarray);
+       return 0;
+}
+EXPORT_SYMBOL(set_pages_array_wc);
+
+int set_pages_array_wb(struct page **pages, int addrinarray)
+{
+       return 0;
+}
+EXPORT_SYMBOL(set_pages_array_wb);
+
+int set_pages_array_iwb(struct page **pages, int addrinarray)
+{
+       flush_cache(pages, addrinarray);
+       return 0;
+}
+EXPORT_SYMBOL(set_pages_array_iwb);
+
 #endif
 
 static __init int init_cache_size(void)