forked from mirrors/linux
		
	Add linux/cacheflush.h
Many architectures do not include asm-generic/cacheflush.h, so turn
the includes on their head and add linux/cacheflush.h which includes
asm/cacheflush.h.
Move the flush_dcache_folio() declaration from asm-generic/cacheflush.h
to linux/cacheflush.h and change linux/highmem.h to include
linux/cacheflush.h instead of asm/cacheflush.h so that all necessary
places will see flush_dcache_folio().
More functions should have their default implementations moved in the
future, but those are for follow-on patches.  This fixes csky, sparc and
sparc64 which were missed in the commit which added flush_dcache_folio().
Fixes: 08b0b0059b ("mm: Add flush_dcache_folio()")
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
			
			
This commit is contained in:
		
							parent
							
								
									8ab7745879
								
							
						
					
					
						commit
						522a0032af
					
				
					 12 changed files with 19 additions and 20 deletions
				
			
		|  | @ -36,7 +36,6 @@ void __flush_dcache_page(phys_addr_t paddr, unsigned long vaddr); | ||||||
| #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | ||||||
| 
 | 
 | ||||||
| void flush_dcache_page(struct page *page); | void flush_dcache_page(struct page *page); | ||||||
| void flush_dcache_folio(struct folio *folio); |  | ||||||
| 
 | 
 | ||||||
| void dma_cache_wback_inv(phys_addr_t start, unsigned long sz); | void dma_cache_wback_inv(phys_addr_t start, unsigned long sz); | ||||||
| void dma_cache_inv(phys_addr_t start, unsigned long sz); | void dma_cache_inv(phys_addr_t start, unsigned long sz); | ||||||
|  |  | ||||||
|  | @ -290,7 +290,6 @@ extern void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr | ||||||
|  */ |  */ | ||||||
| #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | ||||||
| extern void flush_dcache_page(struct page *); | extern void flush_dcache_page(struct page *); | ||||||
| void flush_dcache_folio(struct folio *folio); |  | ||||||
| 
 | 
 | ||||||
| #define ARCH_IMPLEMENTS_FLUSH_KERNEL_VMAP_RANGE 1 | #define ARCH_IMPLEMENTS_FLUSH_KERNEL_VMAP_RANGE 1 | ||||||
| static inline void flush_kernel_vmap_range(void *addr, int size) | static inline void flush_kernel_vmap_range(void *addr, int size) | ||||||
|  |  | ||||||
|  | @ -250,7 +250,6 @@ static inline void __flush_page_to_ram(void *vaddr) | ||||||
| 
 | 
 | ||||||
| #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | ||||||
| #define flush_dcache_page(page)		__flush_page_to_ram(page_address(page)) | #define flush_dcache_page(page)		__flush_page_to_ram(page_address(page)) | ||||||
| void flush_dcache_folio(struct folio *folio); |  | ||||||
| #define flush_dcache_mmap_lock(mapping)		do { } while (0) | #define flush_dcache_mmap_lock(mapping)		do { } while (0) | ||||||
| #define flush_dcache_mmap_unlock(mapping)	do { } while (0) | #define flush_dcache_mmap_unlock(mapping)	do { } while (0) | ||||||
| #define flush_icache_page(vma, page)	__flush_page_to_ram(page_address(page)) | #define flush_icache_page(vma, page)	__flush_page_to_ram(page_address(page)) | ||||||
|  |  | ||||||
|  | @ -61,8 +61,6 @@ static inline void flush_dcache_page(struct page *page) | ||||||
| 		SetPageDcacheDirty(page); | 		SetPageDcacheDirty(page); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void flush_dcache_folio(struct folio *folio); |  | ||||||
| 
 |  | ||||||
| #define flush_dcache_mmap_lock(mapping)		do { } while (0) | #define flush_dcache_mmap_lock(mapping)		do { } while (0) | ||||||
| #define flush_dcache_mmap_unlock(mapping)	do { } while (0) | #define flush_dcache_mmap_unlock(mapping)	do { } while (0) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -27,7 +27,6 @@ void flush_cache_vunmap(unsigned long start, unsigned long end); | ||||||
| 
 | 
 | ||||||
| #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | ||||||
| void flush_dcache_page(struct page *page); | void flush_dcache_page(struct page *page); | ||||||
| void flush_dcache_folio(struct folio *folio); |  | ||||||
| void copy_to_user_page(struct vm_area_struct *vma, struct page *page, | void copy_to_user_page(struct vm_area_struct *vma, struct page *page, | ||||||
| 		       unsigned long vaddr, void *dst, void *src, int len); | 		       unsigned long vaddr, void *dst, void *src, int len); | ||||||
| void copy_from_user_page(struct vm_area_struct *vma, struct page *page, | void copy_from_user_page(struct vm_area_struct *vma, struct page *page, | ||||||
|  |  | ||||||
|  | @ -29,7 +29,6 @@ extern void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, | ||||||
| 	unsigned long pfn); | 	unsigned long pfn); | ||||||
| #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | ||||||
| void flush_dcache_page(struct page *page); | void flush_dcache_page(struct page *page); | ||||||
| void flush_dcache_folio(struct folio *folio); |  | ||||||
| 
 | 
 | ||||||
| extern void flush_icache_range(unsigned long start, unsigned long end); | extern void flush_icache_range(unsigned long start, unsigned long end); | ||||||
| extern void flush_icache_page(struct vm_area_struct *vma, struct page *page); | extern void flush_icache_page(struct vm_area_struct *vma, struct page *page); | ||||||
|  |  | ||||||
|  | @ -50,7 +50,6 @@ void invalidate_kernel_vmap_range(void *vaddr, int size); | ||||||
| 
 | 
 | ||||||
| #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | ||||||
| void flush_dcache_page(struct page *page); | void flush_dcache_page(struct page *page); | ||||||
| void flush_dcache_folio(struct folio *folio); |  | ||||||
| 
 | 
 | ||||||
| #define flush_dcache_mmap_lock(mapping)		xa_lock_irq(&mapping->i_pages) | #define flush_dcache_mmap_lock(mapping)		xa_lock_irq(&mapping->i_pages) | ||||||
| #define flush_dcache_mmap_unlock(mapping)	xa_unlock_irq(&mapping->i_pages) | #define flush_dcache_mmap_unlock(mapping)	xa_unlock_irq(&mapping->i_pages) | ||||||
|  |  | ||||||
|  | @ -43,7 +43,6 @@ extern void flush_cache_range(struct vm_area_struct *vma, | ||||||
| 				 unsigned long start, unsigned long end); | 				 unsigned long start, unsigned long end); | ||||||
| #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | ||||||
| void flush_dcache_page(struct page *page); | void flush_dcache_page(struct page *page); | ||||||
| void flush_dcache_folio(struct folio *folio); |  | ||||||
| extern void flush_icache_range(unsigned long start, unsigned long end); | extern void flush_icache_range(unsigned long start, unsigned long end); | ||||||
| #define flush_icache_user_range flush_icache_range | #define flush_icache_user_range flush_icache_range | ||||||
| extern void flush_icache_page(struct vm_area_struct *vma, | extern void flush_icache_page(struct vm_area_struct *vma, | ||||||
|  |  | ||||||
|  | @ -121,7 +121,6 @@ void flush_cache_page(struct vm_area_struct*, | ||||||
| 
 | 
 | ||||||
| #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | ||||||
| void flush_dcache_page(struct page *); | void flush_dcache_page(struct page *); | ||||||
| void flush_dcache_folio(struct folio *); |  | ||||||
| 
 | 
 | ||||||
| void local_flush_cache_range(struct vm_area_struct *vma, | void local_flush_cache_range(struct vm_area_struct *vma, | ||||||
| 		unsigned long start, unsigned long end); | 		unsigned long start, unsigned long end); | ||||||
|  | @ -138,9 +137,7 @@ void local_flush_cache_page(struct vm_area_struct *vma, | ||||||
| #define flush_cache_vunmap(start,end)			do { } while (0) | #define flush_cache_vunmap(start,end)			do { } while (0) | ||||||
| 
 | 
 | ||||||
| #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 | ||||||
| #define ARCH_IMPLEMENTS_FLUSH_DCACHE_FOLIO |  | ||||||
| #define flush_dcache_page(page)				do { } while (0) | #define flush_dcache_page(page)				do { } while (0) | ||||||
| static inline void flush_dcache_folio(struct folio *folio) { } |  | ||||||
| 
 | 
 | ||||||
| #define flush_icache_range local_flush_icache_range | #define flush_icache_range local_flush_icache_range | ||||||
| #define flush_cache_page(vma, addr, pfn)		do { } while (0) | #define flush_cache_page(vma, addr, pfn)		do { } while (0) | ||||||
|  |  | ||||||
|  | @ -50,13 +50,7 @@ static inline void flush_dcache_page(struct page *page) | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static inline void flush_dcache_folio(struct folio *folio) { } |  | ||||||
| #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 | ||||||
| #define ARCH_IMPLEMENTS_FLUSH_DCACHE_FOLIO |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| #ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_FOLIO |  | ||||||
| void flush_dcache_folio(struct folio *folio); |  | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #ifndef flush_dcache_mmap_lock | #ifndef flush_dcache_mmap_lock | ||||||
|  |  | ||||||
							
								
								
									
										18
									
								
								include/linux/cacheflush.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								include/linux/cacheflush.h
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | ||||||
|  | /* SPDX-License-Identifier: GPL-2.0 */ | ||||||
|  | #ifndef _LINUX_CACHEFLUSH_H | ||||||
|  | #define _LINUX_CACHEFLUSH_H | ||||||
|  | 
 | ||||||
|  | #include <asm/cacheflush.h> | ||||||
|  | 
 | ||||||
|  | #if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE | ||||||
|  | #ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_FOLIO | ||||||
|  | void flush_dcache_folio(struct folio *folio); | ||||||
|  | #endif | ||||||
|  | #else | ||||||
|  | static inline void flush_dcache_folio(struct folio *folio) | ||||||
|  | { | ||||||
|  | } | ||||||
|  | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_FOLIO 0 | ||||||
|  | #endif /* ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE */ | ||||||
|  | 
 | ||||||
|  | #endif /* _LINUX_CACHEFLUSH_H */ | ||||||
|  | @ -5,12 +5,11 @@ | ||||||
| #include <linux/fs.h> | #include <linux/fs.h> | ||||||
| #include <linux/kernel.h> | #include <linux/kernel.h> | ||||||
| #include <linux/bug.h> | #include <linux/bug.h> | ||||||
|  | #include <linux/cacheflush.h> | ||||||
| #include <linux/mm.h> | #include <linux/mm.h> | ||||||
| #include <linux/uaccess.h> | #include <linux/uaccess.h> | ||||||
| #include <linux/hardirq.h> | #include <linux/hardirq.h> | ||||||
| 
 | 
 | ||||||
| #include <asm/cacheflush.h> |  | ||||||
| 
 |  | ||||||
| #include "highmem-internal.h" | #include "highmem-internal.h" | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Matthew Wilcox (Oracle)
						Matthew Wilcox (Oracle)