arm64: Remove __flush_dcache_page()
[firefly-linux-kernel-4.4.55.git] / arch / arm64 / mm / flush.c
index 88611c3a421aecd15391e734e9646089ee6ce54d..e4193e3adc7f9dbbbe57c63eac0ee60b32aaa3e5 100644 (file)
@@ -70,23 +70,16 @@ void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
 #endif
 }
 
-void __flush_dcache_page(struct page *page)
-{
-       __flush_dcache_area(page_address(page), PAGE_SIZE);
-}
-
 void __sync_icache_dcache(pte_t pte, unsigned long addr)
 {
-       unsigned long pfn;
-       struct page *page;
+       struct page *page = pte_page(pte);
 
-       pfn = pte_pfn(pte);
-       if (!pfn_valid(pfn))
+       /* no flushing needed for anonymous pages */
+       if (!page_mapping(page))
                return;
 
-       page = pfn_to_page(pfn);
        if (!test_and_set_bit(PG_dcache_clean, &page->flags)) {
-               __flush_dcache_page(page);
+               __flush_dcache_area(page_address(page), PAGE_SIZE);
                __flush_icache_all();
        } else if (icache_is_aivivt()) {
                __flush_icache_all();
@@ -94,28 +87,14 @@ void __sync_icache_dcache(pte_t pte, unsigned long addr)
 }
 
 /*
- * Ensure cache coherency between kernel mapping and userspace mapping of this
- * page.
+ * This function is called when a page has been modified by the kernel. Mark
+ * it as dirty for later flushing when mapped in user space (if executable,
+ * see __sync_icache_dcache).
  */
 void flush_dcache_page(struct page *page)
 {
-       struct address_space *mapping;
-
-       /*
-        * The zero page is never written to, so never has any dirty cache
-        * lines, and therefore never needs to be flushed.
-        */
-       if (page == ZERO_PAGE(0))
-               return;
-
-       mapping = page_mapping(page);
-       if (mapping && mapping_mapped(mapping)) {
-               __flush_dcache_page(page);
-               __flush_icache_all();
-               set_bit(PG_dcache_clean, &page->flags);
-       } else {
+       if (test_bit(PG_dcache_clean, &page->flags))
                clear_bit(PG_dcache_clean, &page->flags);
-       }
 }
 EXPORT_SYMBOL(flush_dcache_page);