18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _ASM_GENERIC_CACHEFLUSH_H 38c2ecf20Sopenharmony_ci#define _ASM_GENERIC_CACHEFLUSH_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_cistruct mm_struct; 68c2ecf20Sopenharmony_cistruct vm_area_struct; 78c2ecf20Sopenharmony_cistruct page; 88c2ecf20Sopenharmony_cistruct address_space; 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/* 118c2ecf20Sopenharmony_ci * The cache doesn't need to be flushed when TLB entries change when 128c2ecf20Sopenharmony_ci * the cache is mapped to physical memory, not virtual memory 138c2ecf20Sopenharmony_ci */ 148c2ecf20Sopenharmony_ci#ifndef flush_cache_all 158c2ecf20Sopenharmony_cistatic inline void flush_cache_all(void) 168c2ecf20Sopenharmony_ci{ 178c2ecf20Sopenharmony_ci} 188c2ecf20Sopenharmony_ci#endif 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#ifndef flush_cache_mm 218c2ecf20Sopenharmony_cistatic inline void flush_cache_mm(struct mm_struct *mm) 228c2ecf20Sopenharmony_ci{ 238c2ecf20Sopenharmony_ci} 248c2ecf20Sopenharmony_ci#endif 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#ifndef flush_cache_dup_mm 278c2ecf20Sopenharmony_cistatic inline void flush_cache_dup_mm(struct mm_struct *mm) 288c2ecf20Sopenharmony_ci{ 298c2ecf20Sopenharmony_ci} 308c2ecf20Sopenharmony_ci#endif 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#ifndef flush_cache_range 338c2ecf20Sopenharmony_cistatic inline void flush_cache_range(struct vm_area_struct *vma, 348c2ecf20Sopenharmony_ci unsigned long start, 358c2ecf20Sopenharmony_ci unsigned long end) 368c2ecf20Sopenharmony_ci{ 378c2ecf20Sopenharmony_ci} 388c2ecf20Sopenharmony_ci#endif 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#ifndef flush_cache_page 418c2ecf20Sopenharmony_cistatic inline void flush_cache_page(struct vm_area_struct *vma, 428c2ecf20Sopenharmony_ci unsigned long vmaddr, 438c2ecf20Sopenharmony_ci unsigned long pfn) 448c2ecf20Sopenharmony_ci{ 458c2ecf20Sopenharmony_ci} 468c2ecf20Sopenharmony_ci#endif 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 498c2ecf20Sopenharmony_cistatic inline void flush_dcache_page(struct page *page) 508c2ecf20Sopenharmony_ci{ 518c2ecf20Sopenharmony_ci} 528c2ecf20Sopenharmony_ci#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 538c2ecf20Sopenharmony_ci#endif 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci#ifndef flush_dcache_mmap_lock 578c2ecf20Sopenharmony_cistatic inline void flush_dcache_mmap_lock(struct address_space *mapping) 588c2ecf20Sopenharmony_ci{ 598c2ecf20Sopenharmony_ci} 608c2ecf20Sopenharmony_ci#endif 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#ifndef flush_dcache_mmap_unlock 638c2ecf20Sopenharmony_cistatic inline void flush_dcache_mmap_unlock(struct address_space *mapping) 648c2ecf20Sopenharmony_ci{ 658c2ecf20Sopenharmony_ci} 668c2ecf20Sopenharmony_ci#endif 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci#ifndef flush_icache_range 698c2ecf20Sopenharmony_cistatic inline void flush_icache_range(unsigned long start, unsigned long end) 708c2ecf20Sopenharmony_ci{ 718c2ecf20Sopenharmony_ci} 728c2ecf20Sopenharmony_ci#endif 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci#ifndef flush_icache_user_range 758c2ecf20Sopenharmony_ci#define flush_icache_user_range flush_icache_range 768c2ecf20Sopenharmony_ci#endif 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci#ifndef flush_icache_page 798c2ecf20Sopenharmony_cistatic inline void flush_icache_page(struct vm_area_struct *vma, 808c2ecf20Sopenharmony_ci struct page *page) 818c2ecf20Sopenharmony_ci{ 828c2ecf20Sopenharmony_ci} 838c2ecf20Sopenharmony_ci#endif 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci#ifndef flush_icache_user_page 868c2ecf20Sopenharmony_cistatic inline void flush_icache_user_page(struct vm_area_struct *vma, 878c2ecf20Sopenharmony_ci struct page *page, 888c2ecf20Sopenharmony_ci unsigned long addr, int len) 898c2ecf20Sopenharmony_ci{ 908c2ecf20Sopenharmony_ci} 918c2ecf20Sopenharmony_ci#endif 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci#ifndef flush_cache_vmap 948c2ecf20Sopenharmony_cistatic inline void flush_cache_vmap(unsigned long start, unsigned long end) 958c2ecf20Sopenharmony_ci{ 968c2ecf20Sopenharmony_ci} 978c2ecf20Sopenharmony_ci#endif 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci#ifndef flush_cache_vunmap 1008c2ecf20Sopenharmony_cistatic inline void flush_cache_vunmap(unsigned long start, unsigned long end) 1018c2ecf20Sopenharmony_ci{ 1028c2ecf20Sopenharmony_ci} 1038c2ecf20Sopenharmony_ci#endif 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci#ifndef copy_to_user_page 1068c2ecf20Sopenharmony_ci#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 1078c2ecf20Sopenharmony_ci do { \ 1088c2ecf20Sopenharmony_ci memcpy(dst, src, len); \ 1098c2ecf20Sopenharmony_ci flush_icache_user_page(vma, page, vaddr, len); \ 1108c2ecf20Sopenharmony_ci } while (0) 1118c2ecf20Sopenharmony_ci#endif 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci#ifndef copy_from_user_page 1148c2ecf20Sopenharmony_ci#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ 1158c2ecf20Sopenharmony_ci memcpy(dst, src, len) 1168c2ecf20Sopenharmony_ci#endif 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci#endif /* _ASM_GENERIC_CACHEFLUSH_H */ 119