1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
4 #include <linux/kernel.h>
7 #include <linux/syscalls.h>
8 #include <linux/spinlock.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
);
19 if (mapping
&& !mapping_mapped(mapping
)) {
20 set_bit(PG_arch_1
, &(page
)->flags
);
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
,
41 if (unlikely(!pfn_valid(pfn
)))
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
))
51 clear_bit(PG_arch_1
, &(page
)->flags
);