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

kmap: consolidate kmap_prot definitions

Most architectures define kmap_prot to be PAGE_KERNEL.

Let sparc and xtensa define there own and define PAGE_KERNEL as the
default if not overridden.

[akpm@linux-foundation.org: coding style fixes]
Suggested-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Christian König <christian.koenig@amd.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Helge Deller <deller@gmx.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20200507150004.1423069-16-ira.weiny@intel.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Ira Weiny and committed by
Linus Torvalds
090e77e1 db6f1785

+6 -18
-3
arch/arc/include/asm/highmem.h
··· 25 25 #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) 26 26 #define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT) 27 27 28 - #define kmap_prot PAGE_KERNEL 29 - 30 - 31 28 #include <asm/cacheflush.h> 32 29 33 30 extern void kmap_init(void);
-2
arch/arm/include/asm/highmem.h
··· 10 10 #define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT) 11 11 #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) 12 12 13 - #define kmap_prot PAGE_KERNEL 14 - 15 13 #define flush_cache_kmaps() \ 16 14 do { \ 17 15 if (cache_is_vivt()) \
-2
arch/csky/include/asm/highmem.h
··· 38 38 39 39 extern void kmap_init(void); 40 40 41 - #define kmap_prot PAGE_KERNEL 42 - 43 41 #endif /* __KERNEL__ */ 44 42 45 43 #endif /* __ASM_CSKY_HIGHMEM_H */
-1
arch/microblaze/include/asm/highmem.h
··· 25 25 #include <linux/uaccess.h> 26 26 #include <asm/fixmap.h> 27 27 28 - #define kmap_prot PAGE_KERNEL 29 28 extern pte_t *kmap_pte; 30 29 extern pte_t *pkmap_page_table; 31 30
-2
arch/mips/include/asm/highmem.h
··· 54 54 55 55 extern void kmap_init(void); 56 56 57 - #define kmap_prot PAGE_KERNEL 58 - 59 57 #endif /* __KERNEL__ */ 60 58 61 59 #endif /* _ASM_HIGHMEM_H */
-1
arch/nds32/include/asm/highmem.h
··· 32 32 #define LAST_PKMAP_MASK (LAST_PKMAP - 1) 33 33 #define PKMAP_NR(virt) (((virt) - (PKMAP_BASE)) >> PAGE_SHIFT) 34 34 #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) 35 - #define kmap_prot PAGE_KERNEL 36 35 37 36 static inline void flush_cache_kmaps(void) 38 37 {
-1
arch/powerpc/include/asm/highmem.h
··· 29 29 #include <asm/page.h> 30 30 #include <asm/fixmap.h> 31 31 32 - #define kmap_prot PAGE_KERNEL 33 32 extern pte_t *kmap_pte; 34 33 extern pte_t *pkmap_page_table; 35 34
+2 -1
arch/sparc/include/asm/highmem.h
··· 25 25 #include <asm/vaddrs.h> 26 26 #include <asm/kmap_types.h> 27 27 #include <asm/pgtable.h> 28 + #include <asm/pgtsrmmu.h> 28 29 29 30 /* declarations for highmem.c */ 30 31 extern unsigned long highstart_pfn, highend_pfn; 31 32 32 - extern pgprot_t kmap_prot; 33 + #define kmap_prot __pgprot(SRMMU_ET_PTE | SRMMU_PRIV | SRMMU_CACHE) 33 34 extern pte_t *pkmap_page_table; 34 35 35 36 void kmap_init(void) __init;
-4
arch/sparc/mm/highmem.c
··· 32 32 #include <asm/pgalloc.h> 33 33 #include <asm/vaddrs.h> 34 34 35 - pgprot_t kmap_prot; 36 - EXPORT_SYMBOL(kmap_prot); 37 - 38 35 static pte_t *kmap_pte; 39 36 40 37 void __init kmap_init(void) ··· 48 51 49 52 /* cache the first kmap pte */ 50 53 kmap_pte = pte_offset_kernel(dir, address); 51 - kmap_prot = __pgprot(SRMMU_ET_PTE | SRMMU_PRIV | SRMMU_CACHE); 52 54 } 53 55 54 56 void *kmap_atomic_high_prot(struct page *page, pgprot_t prot)
-1
arch/x86/include/asm/fixmap.h
··· 152 152 extern int fixmaps_set; 153 153 154 154 extern pte_t *kmap_pte; 155 - #define kmap_prot PAGE_KERNEL 156 155 extern pte_t *pkmap_page_table; 157 156 158 157 void __native_set_fixmap(enum fixed_addresses idx, pte_t pte);
+4
include/linux/highmem.h
··· 40 40 static inline void kmap_flush_tlb(unsigned long addr) { } 41 41 #endif 42 42 43 + #ifndef kmap_prot 44 + #define kmap_prot PAGE_KERNEL 45 + #endif 46 + 43 47 void *kmap_high(struct page *page); 44 48 static inline void *kmap(struct page *page) 45 49 {