1 // SPDX-License-Identifier: GPL-2.0 2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. 3 4 #include <linux/cache.h> 5 #include <linux/highmem.h> 6 #include <linux/mm.h> 7 #include <asm/cache.h> 8 9 void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, 10 pte_t *pte) 11 { 12 unsigned long addr; 13 struct page *page; 14 15 page = pfn_to_page(pte_pfn(*pte)); 16 if (page == ZERO_PAGE(0)) 17 return; 18 19 if (test_and_set_bit(PG_dcache_clean, &page->flags)) 20 return; 21 22 addr = (unsigned long) kmap_atomic(page); 23 24 dcache_wb_range(addr, addr + PAGE_SIZE); 25 26 if (vma->vm_flags & VM_EXEC) 27 icache_inv_range(addr, addr + PAGE_SIZE); 28 29 kunmap_atomic((void *) addr); 30 } 31