Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Christoph Hellwig | 92a73bd | 2020-06-07 21:41:39 -0700 | [diff] [blame] | 2 | #ifndef _ASM_GENERIC_CACHEFLUSH_H |
| 3 | #define _ASM_GENERIC_CACHEFLUSH_H |
Arnd Bergmann | 5c01b46 | 2009-05-13 22:56:36 +0000 | [diff] [blame] | 4 | |
Arnd Bergmann | 5c01b46 | 2009-05-13 22:56:36 +0000 | [diff] [blame] | 5 | /* |
| 6 | * The cache doesn't need to be flushed when TLB entries change when |
| 7 | * the cache is mapped to physical memory, not virtual memory |
| 8 | */ |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 9 | #ifndef flush_cache_all |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 10 | static inline void flush_cache_all(void) |
| 11 | { |
| 12 | } |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 13 | #endif |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 14 | |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 15 | #ifndef flush_cache_mm |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 16 | static inline void flush_cache_mm(struct mm_struct *mm) |
| 17 | { |
| 18 | } |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 19 | #endif |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 20 | |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 21 | #ifndef flush_cache_dup_mm |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 22 | static inline void flush_cache_dup_mm(struct mm_struct *mm) |
| 23 | { |
| 24 | } |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 25 | #endif |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 26 | |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 27 | #ifndef flush_cache_range |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 28 | static inline void flush_cache_range(struct vm_area_struct *vma, |
| 29 | unsigned long start, |
| 30 | unsigned long end) |
| 31 | { |
| 32 | } |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 33 | #endif |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 34 | |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 35 | #ifndef flush_cache_page |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 36 | static inline void flush_cache_page(struct vm_area_struct *vma, |
| 37 | unsigned long vmaddr, |
| 38 | unsigned long pfn) |
| 39 | { |
| 40 | } |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 41 | #endif |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 42 | |
Christoph Hellwig | 76b3b58 | 2020-06-07 21:41:45 -0700 | [diff] [blame] | 43 | #ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 44 | static inline void flush_dcache_page(struct page *page) |
| 45 | { |
| 46 | } |
Christoph Hellwig | 76b3b58 | 2020-06-07 21:41:45 -0700 | [diff] [blame] | 47 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 48 | #endif |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 49 | |
Christoph Hellwig | 76b3b58 | 2020-06-07 21:41:45 -0700 | [diff] [blame] | 50 | |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 51 | #ifndef flush_dcache_mmap_lock |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 52 | static inline void flush_dcache_mmap_lock(struct address_space *mapping) |
| 53 | { |
| 54 | } |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 55 | #endif |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 56 | |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 57 | #ifndef flush_dcache_mmap_unlock |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 58 | static inline void flush_dcache_mmap_unlock(struct address_space *mapping) |
| 59 | { |
| 60 | } |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 61 | #endif |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 62 | |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 63 | #ifndef flush_icache_range |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 64 | static inline void flush_icache_range(unsigned long start, unsigned long end) |
| 65 | { |
| 66 | } |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 67 | #endif |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 68 | |
Christoph Hellwig | 1268c33 | 2020-06-07 21:42:26 -0700 | [diff] [blame] | 69 | #ifndef flush_icache_user_range |
| 70 | #define flush_icache_user_range flush_icache_range |
| 71 | #endif |
| 72 | |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 73 | #ifndef flush_icache_page |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 74 | static inline void flush_icache_page(struct vm_area_struct *vma, |
| 75 | struct page *page) |
| 76 | { |
| 77 | } |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 78 | #endif |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 79 | |
Christoph Hellwig | 885f7f8 | 2020-06-07 21:42:22 -0700 | [diff] [blame] | 80 | #ifndef flush_icache_user_page |
| 81 | static inline void flush_icache_user_page(struct vm_area_struct *vma, |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 82 | struct page *page, |
| 83 | unsigned long addr, int len) |
| 84 | { |
| 85 | } |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 86 | #endif |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 87 | |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 88 | #ifndef flush_cache_vmap |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 89 | static inline void flush_cache_vmap(unsigned long start, unsigned long end) |
| 90 | { |
| 91 | } |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 92 | #endif |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 93 | |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 94 | #ifndef flush_cache_vunmap |
Qian Cai | c296d4d | 2019-07-16 16:27:06 -0700 | [diff] [blame] | 95 | static inline void flush_cache_vunmap(unsigned long start, unsigned long end) |
| 96 | { |
| 97 | } |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 98 | #endif |
Arnd Bergmann | 5c01b46 | 2009-05-13 22:56:36 +0000 | [diff] [blame] | 99 | |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 100 | #ifndef copy_to_user_page |
| 101 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ |
Mike Frysinger | f68aa5b | 2011-05-24 17:12:53 -0700 | [diff] [blame] | 102 | do { \ |
| 103 | memcpy(dst, src, len); \ |
Christoph Hellwig | 885f7f8 | 2020-06-07 21:42:22 -0700 | [diff] [blame] | 104 | flush_icache_user_page(vma, page, vaddr, len); \ |
Mike Frysinger | f68aa5b | 2011-05-24 17:12:53 -0700 | [diff] [blame] | 105 | } while (0) |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 106 | #endif |
| 107 | |
| 108 | #ifndef copy_from_user_page |
Arnd Bergmann | 5c01b46 | 2009-05-13 22:56:36 +0000 | [diff] [blame] | 109 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ |
| 110 | memcpy(dst, src, len) |
Mike Rapoport | 4f0bd80 | 2019-12-23 13:00:03 +0200 | [diff] [blame] | 111 | #endif |
Arnd Bergmann | 5c01b46 | 2009-05-13 22:56:36 +0000 | [diff] [blame] | 112 | |
Christoph Hellwig | 92a73bd | 2020-06-07 21:41:39 -0700 | [diff] [blame] | 113 | #endif /* _ASM_GENERIC_CACHEFLUSH_H */ |