perf cs-etm: Refactor enumeration cs_etm_sample_type
[linux/fpc-iii.git] / arch / csky / abiv1 / cacheflush.c
blob10af8b6fe322f28d21db8c1fa6b4b7f961109ee7
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
4 #include <linux/kernel.h>
5 #include <linux/mm.h>
6 #include <linux/fs.h>
7 #include <linux/syscalls.h>
8 #include <linux/spinlock.h>
9 #include <asm/page.h>
10 #include <asm/cache.h>
11 #include <asm/cacheflush.h>
12 #include <asm/cachectl.h>
14 void flush_dcache_page(struct page *page)
16 struct address_space *mapping = page_mapping(page);
17 unsigned long addr;
19 if (mapping && !mapping_mapped(mapping)) {
20 set_bit(PG_arch_1, &(page)->flags);
21 return;
25 * We could delay the flush for the !page_mapping case too. But that
26 * case is for exec env/arg pages and those are %99 certainly going to
27 * get faulted into the tlb (and thus flushed) anyways.
29 addr = (unsigned long) page_address(page);
30 dcache_wb_range(addr, addr + PAGE_SIZE);
33 void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
34 pte_t *pte)
36 unsigned long addr;
37 struct page *page;
38 unsigned long pfn;
40 pfn = pte_pfn(*pte);
41 if (unlikely(!pfn_valid(pfn)))
42 return;
44 page = pfn_to_page(pfn);
45 addr = (unsigned long) page_address(page);
47 if (vma->vm_flags & VM_EXEC ||
48 pages_do_alias(addr, address & PAGE_MASK))
49 cache_wbinv_all();
51 clear_bit(PG_arch_1, &(page)->flags);