Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: rationalise flush_icache_pages() and flush_icache_page()

Move the default (no-op) implementation of flush_icache_pages() to
<linux/cacheflush.h> from <asm-generic/cacheflush.h>. Remove the
flush_icache_page() wrapper from each architecture into
<linux/cacheflush.h>.

Link: https://lkml.kernel.org/r/20230802151406.3735276-32-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
203b7b6a 29269ad9

+14 -56
+1 -4
arch/alpha/include/asm/cacheflush.h
··· 53 53 #define flush_icache_user_page flush_icache_user_page 54 54 #endif /* CONFIG_SMP */ 55 55 56 - /* This is used only in __do_fault and do_swap_page. */ 57 - #define flush_icache_page(vma, page) \ 58 - flush_icache_user_page((vma), (page), 0, 0) 59 - 60 56 /* 61 57 * Both implementations of flush_icache_user_page flush the entire 62 58 * address space, so one call, no matter how many pages. ··· 62 66 { 63 67 flush_icache_user_page(vma, page, 0, 0); 64 68 } 69 + #define flush_icache_pages flush_icache_pages 65 70 66 71 #include <asm-generic/cacheflush.h> 67 72
-9
arch/arc/include/asm/cacheflush.h
··· 18 18 #include <linux/mm.h> 19 19 #include <asm/shmparam.h> 20 20 21 - /* 22 - * Semantically we need this because icache doesn't snoop dcache/dma. 23 - * However ARC Cache flush requires paddr as well as vaddr, latter not available 24 - * in the flush_icache_page() API. So we no-op it but do the equivalent work 25 - * in update_mmu_cache() 26 - */ 27 - #define flush_icache_page(vma, page) 28 - #define flush_icache_pages(vma, page, nr) 29 - 30 21 void flush_cache_all(void); 31 22 32 23 void flush_icache_range(unsigned long kstart, unsigned long kend);
-7
arch/arm/include/asm/cacheflush.h
··· 322 322 #define flush_dcache_mmap_unlock(mapping) xa_unlock_irq(&mapping->i_pages) 323 323 324 324 /* 325 - * We don't appear to need to do anything here. In fact, if we did, we'd 326 - * duplicate cache flushing elsewhere performed by flush_dcache_page(). 327 - */ 328 - #define flush_icache_page(vma,page) do { } while (0) 329 - #define flush_icache_pages(vma, page, nr) do { } while (0) 330 - 331 - /* 332 325 * flush_cache_vmap() is used when creating mappings (eg, via vmap, 333 326 * vmalloc, ioremap etc) in kernel space for pages. On non-VIPT 334 327 * caches, since the direct-mappings of these pages may contain cached
-1
arch/csky/abiv1/inc/abi/cacheflush.h
··· 45 45 #define flush_cache_vmap(start, end) cache_wbinv_all() 46 46 #define flush_cache_vunmap(start, end) cache_wbinv_all() 47 47 48 - #define flush_icache_page(vma, page) do {} while (0); 49 48 #define flush_icache_range(start, end) cache_wbinv_range(start, end) 50 49 #define flush_icache_mm_range(mm, start, end) cache_wbinv_range(start, end) 51 50 #define flush_icache_deferred(mm) do {} while (0);
-1
arch/csky/abiv2/inc/abi/cacheflush.h
··· 33 33 34 34 #define flush_dcache_mmap_lock(mapping) do { } while (0) 35 35 #define flush_dcache_mmap_unlock(mapping) do { } while (0) 36 - #define flush_icache_page(vma, page) do { } while (0) 37 36 38 37 #define flush_icache_range(start, end) cache_wbinv_range(start, end) 39 38
+1 -1
arch/hexagon/include/asm/cacheflush.h
··· 18 18 * - flush_cache_range(vma, start, end) flushes a range of pages 19 19 * - flush_icache_range(start, end) flush a range of instructions 20 20 * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache 21 - * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache 21 + * - flush_icache_pages(vma, pg, nr) flushes(invalidates) nr pages for icache 22 22 * 23 23 * Need to doublecheck which one is really needed for ptrace stuff to work. 24 24 */
-2
arch/loongarch/include/asm/cacheflush.h
··· 46 46 #define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 47 47 #define flush_cache_vmap(start, end) do { } while (0) 48 48 #define flush_cache_vunmap(start, end) do { } while (0) 49 - #define flush_icache_page(vma, page) do { } while (0) 50 - #define flush_icache_pages(vma, page) do { } while (0) 51 49 #define flush_icache_user_page(vma, page, addr, len) do { } while (0) 52 50 #define flush_dcache_page(page) do { } while (0) 53 51 #define flush_dcache_mmap_lock(mapping) do { } while (0)
-1
arch/m68k/include/asm/cacheflush_mm.h
··· 261 261 #define flush_dcache_mmap_unlock(mapping) do { } while (0) 262 262 #define flush_icache_pages(vma, page, nr) \ 263 263 __flush_pages_to_ram(page_address(page), nr) 264 - #define flush_icache_page(vma, page) flush_icache_pages(vma, page, 1) 265 264 266 265 extern void flush_icache_user_page(struct vm_area_struct *vma, struct page *page, 267 266 unsigned long addr, int len);
-6
arch/mips/include/asm/cacheflush.h
··· 82 82 __flush_anon_page(page, vmaddr); 83 83 } 84 84 85 - static inline void flush_icache_pages(struct vm_area_struct *vma, 86 - struct page *page, unsigned int nr) 87 - { 88 - } 89 - #define flush_icache_page(vma, page) flush_icache_pages(vma, page, 1) 90 - 91 85 extern void (*flush_icache_range)(unsigned long start, unsigned long end); 92 86 extern void (*local_flush_icache_range)(unsigned long start, unsigned long end); 93 87 extern void (*__flush_icache_user_range)(unsigned long start,
+1 -1
arch/nios2/include/asm/cacheflush.h
··· 35 35 extern void flush_icache_range(unsigned long start, unsigned long end); 36 36 void flush_icache_pages(struct vm_area_struct *vma, struct page *page, 37 37 unsigned int nr); 38 - #define flush_icache_page(vma, page) flush_icache_pages(vma, page, 1); 38 + #define flush_icache_pages flush_icache_pages 39 39 40 40 #define flush_cache_vmap(start, end) flush_dcache_range(start, end) 41 41 #define flush_cache_vunmap(start, end) flush_dcache_range(start, end)
+1 -1
arch/parisc/include/asm/cacheflush.h
··· 60 60 61 61 void flush_icache_pages(struct vm_area_struct *vma, struct page *page, 62 62 unsigned int nr); 63 - #define flush_icache_page(vma, page) flush_icache_pages(vma, page, 1) 63 + #define flush_icache_pages flush_icache_pages 64 64 65 65 #define flush_icache_range(s,e) do { \ 66 66 flush_kernel_dcache_range_asm(s,e); \
+1 -1
arch/sh/include/asm/cacheflush.h
··· 53 53 #define flush_icache_user_range flush_icache_range 54 54 void flush_icache_pages(struct vm_area_struct *vma, struct page *page, 55 55 unsigned int nr); 56 - #define flush_icache_page(vma, page) flush_icache_pages(vma, page, 1) 56 + #define flush_icache_pages flush_icache_pages 57 57 extern void flush_cache_sigtramp(unsigned long address); 58 58 59 59 struct flusher_data {
-2
arch/sparc/include/asm/cacheflush_32.h
··· 16 16 #define flush_cache_page(vma,addr,pfn) \ 17 17 sparc32_cachetlb_ops->cache_page(vma, addr) 18 18 #define flush_icache_range(start, end) do { } while (0) 19 - #define flush_icache_page(vma, pg) do { } while (0) 20 - #define flush_icache_pages(vma, pg, nr) do { } while (0) 21 19 22 20 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 23 21 do { \
-3
arch/sparc/include/asm/cacheflush_64.h
··· 53 53 flush_dcache_folio(page_folio(page)); 54 54 } 55 55 56 - #define flush_icache_page(vma, pg) do { } while(0) 57 - #define flush_icache_pages(vma, pg, nr) do { } while(0) 58 - 59 56 void flush_ptrace_access(struct vm_area_struct *, struct page *, 60 57 unsigned long uaddr, void *kaddr, 61 58 unsigned long len, int write);
-4
arch/xtensa/include/asm/cacheflush.h
··· 160 160 __invalidate_icache_range(start,(end) - (start)); \ 161 161 } while (0) 162 162 163 - /* This is not required, see Documentation/core-api/cachetlb.rst */ 164 - #define flush_icache_page(vma,page) do { } while (0) 165 - #define flush_icache_pages(vma, page, nr) do { } while (0) 166 - 167 163 #define flush_dcache_mmap_lock(mapping) do { } while (0) 168 164 #define flush_dcache_mmap_unlock(mapping) do { } while (0) 169 165
-12
include/asm-generic/cacheflush.h
··· 77 77 #define flush_icache_user_range flush_icache_range 78 78 #endif 79 79 80 - #ifndef flush_icache_page 81 - static inline void flush_icache_pages(struct vm_area_struct *vma, 82 - struct page *page, unsigned int nr) 83 - { 84 - } 85 - 86 - static inline void flush_icache_page(struct vm_area_struct *vma, 87 - struct page *page) 88 - { 89 - } 90 - #endif 91 - 92 80 #ifndef flush_icache_user_page 93 81 static inline void flush_icache_user_page(struct vm_area_struct *vma, 94 82 struct page *page,
+9
include/linux/cacheflush.h
··· 17 17 #define flush_dcache_folio flush_dcache_folio 18 18 #endif /* ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE */ 19 19 20 + #ifndef flush_icache_pages 21 + static inline void flush_icache_pages(struct vm_area_struct *vma, 22 + struct page *page, unsigned int nr) 23 + { 24 + } 25 + #endif 26 + 27 + #define flush_icache_page(vma, page) flush_icache_pages(vma, page, 1) 28 + 20 29 #endif /* _LINUX_CACHEFLUSH_H */