1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 292a73bd2SChristoph Hellwig #ifndef _ASM_GENERIC_CACHEFLUSH_H 392a73bd2SChristoph Hellwig #define _ASM_GENERIC_CACHEFLUSH_H 45c01b46bSArnd Bergmann 55c01b46bSArnd Bergmann /* 65c01b46bSArnd Bergmann * The cache doesn't need to be flushed when TLB entries change when 75c01b46bSArnd Bergmann * the cache is mapped to physical memory, not virtual memory 85c01b46bSArnd Bergmann */ 94f0bd808SMike Rapoport #ifndef flush_cache_all 10c296d4dcSQian Cai static inline void flush_cache_all(void) 11c296d4dcSQian Cai { 12c296d4dcSQian Cai } 134f0bd808SMike Rapoport #endif 14c296d4dcSQian Cai 154f0bd808SMike Rapoport #ifndef flush_cache_mm 16c296d4dcSQian Cai static inline void flush_cache_mm(struct mm_struct *mm) 17c296d4dcSQian Cai { 18c296d4dcSQian Cai } 194f0bd808SMike Rapoport #endif 20c296d4dcSQian Cai 214f0bd808SMike Rapoport #ifndef flush_cache_dup_mm 22c296d4dcSQian Cai static inline void flush_cache_dup_mm(struct mm_struct *mm) 23c296d4dcSQian Cai { 24c296d4dcSQian Cai } 254f0bd808SMike Rapoport #endif 26c296d4dcSQian Cai 274f0bd808SMike Rapoport #ifndef flush_cache_range 28c296d4dcSQian Cai static inline void flush_cache_range(struct vm_area_struct *vma, 29c296d4dcSQian Cai unsigned long start, 30c296d4dcSQian Cai unsigned long end) 31c296d4dcSQian Cai { 32c296d4dcSQian Cai } 334f0bd808SMike Rapoport #endif 34c296d4dcSQian Cai 354f0bd808SMike Rapoport #ifndef flush_cache_page 36c296d4dcSQian Cai static inline void flush_cache_page(struct vm_area_struct *vma, 37c296d4dcSQian Cai unsigned long vmaddr, 38c296d4dcSQian Cai unsigned long pfn) 39c296d4dcSQian Cai { 40c296d4dcSQian Cai } 414f0bd808SMike Rapoport #endif 42c296d4dcSQian Cai 4376b3b58fSChristoph Hellwig #ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 44c296d4dcSQian Cai static inline void flush_dcache_page(struct page *page) 45c296d4dcSQian Cai { 46c296d4dcSQian Cai } 4776b3b58fSChristoph Hellwig #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 484f0bd808SMike Rapoport #endif 49c296d4dcSQian Cai 5076b3b58fSChristoph Hellwig 514f0bd808SMike Rapoport #ifndef flush_dcache_mmap_lock 52c296d4dcSQian Cai static inline void flush_dcache_mmap_lock(struct address_space *mapping) 53c296d4dcSQian Cai { 54c296d4dcSQian Cai } 554f0bd808SMike Rapoport #endif 56c296d4dcSQian Cai 574f0bd808SMike Rapoport #ifndef flush_dcache_mmap_unlock 58c296d4dcSQian Cai static inline void flush_dcache_mmap_unlock(struct address_space *mapping) 59c296d4dcSQian Cai { 60c296d4dcSQian Cai } 614f0bd808SMike Rapoport #endif 62c296d4dcSQian Cai 634f0bd808SMike Rapoport #ifndef flush_icache_range 64c296d4dcSQian Cai static inline void flush_icache_range(unsigned long start, unsigned long end) 65c296d4dcSQian Cai { 66c296d4dcSQian Cai } 674f0bd808SMike Rapoport #endif 68c296d4dcSQian Cai 694f0bd808SMike Rapoport #ifndef flush_icache_page 70c296d4dcSQian Cai static inline void flush_icache_page(struct vm_area_struct *vma, 71c296d4dcSQian Cai struct page *page) 72c296d4dcSQian Cai { 73c296d4dcSQian Cai } 744f0bd808SMike Rapoport #endif 75c296d4dcSQian Cai 76*885f7f8eSChristoph Hellwig #ifndef flush_icache_user_page 77*885f7f8eSChristoph Hellwig static inline void flush_icache_user_page(struct vm_area_struct *vma, 78c296d4dcSQian Cai struct page *page, 79c296d4dcSQian Cai unsigned long addr, int len) 80c296d4dcSQian Cai { 81c296d4dcSQian Cai } 824f0bd808SMike Rapoport #endif 83c296d4dcSQian Cai 844f0bd808SMike Rapoport #ifndef flush_cache_vmap 85c296d4dcSQian Cai static inline void flush_cache_vmap(unsigned long start, unsigned long end) 86c296d4dcSQian Cai { 87c296d4dcSQian Cai } 884f0bd808SMike Rapoport #endif 89c296d4dcSQian Cai 904f0bd808SMike Rapoport #ifndef flush_cache_vunmap 91c296d4dcSQian Cai static inline void flush_cache_vunmap(unsigned long start, unsigned long end) 92c296d4dcSQian Cai { 93c296d4dcSQian Cai } 944f0bd808SMike Rapoport #endif 955c01b46bSArnd Bergmann 964f0bd808SMike Rapoport #ifndef copy_to_user_page 975c01b46bSArnd Bergmann #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 98f68aa5b4SMike Frysinger do { \ 99f68aa5b4SMike Frysinger memcpy(dst, src, len); \ 100*885f7f8eSChristoph Hellwig flush_icache_user_page(vma, page, vaddr, len); \ 101f68aa5b4SMike Frysinger } while (0) 1024f0bd808SMike Rapoport #endif 1034f0bd808SMike Rapoport 1044f0bd808SMike Rapoport #ifndef copy_from_user_page 1055c01b46bSArnd Bergmann #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ 1065c01b46bSArnd Bergmann memcpy(dst, src, len) 1074f0bd808SMike Rapoport #endif 1085c01b46bSArnd Bergmann 10992a73bd2SChristoph Hellwig #endif /* _ASM_GENERIC_CACHEFLUSH_H */ 110