Commit 9849a569 authored by Kirill A. Shutemov's avatar Kirill A. Shutemov Committed by Linus Torvalds

arch, mm: convert all architectures to use 5level-fixup.h

If an architecture uses 4level-fixup.h we don't need to do anything as
it includes 5level-fixup.h.

If an architecture uses pgtable-nop*d.h, define __ARCH_USE_5LEVEL_HACK
before inclusion of the header. It makes asm-generic code to use
5level-fixup.h.

If an architecture has 4-level paging or folds levels on its own,
include 5level-fixup.h directly.
Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 30ec8426
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#define _ASM_ARC_HUGEPAGE_H #define _ASM_ARC_HUGEPAGE_H
#include <linux/types.h> #include <linux/types.h>
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
static inline pte_t pmd_pte(pmd_t pmd) static inline pte_t pmd_pte(pmd_t pmd)
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <asm/page.h> #include <asm/page.h>
#include <asm/mmu.h> #include <asm/mmu.h>
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
#include <linux/const.h> #include <linux/const.h>
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#else #else
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopud.h> #include <asm-generic/pgtable-nopud.h>
#include <asm/memory.h> #include <asm/memory.h>
#include <asm/pgtable-hwdef.h> #include <asm/pgtable-hwdef.h>
......
...@@ -55,9 +55,13 @@ typedef struct { pteval_t pgprot; } pgprot_t; ...@@ -55,9 +55,13 @@ typedef struct { pteval_t pgprot; } pgprot_t;
#define __pgprot(x) ((pgprot_t) { (x) } ) #define __pgprot(x) ((pgprot_t) { (x) } )
#if CONFIG_PGTABLE_LEVELS == 2 #if CONFIG_PGTABLE_LEVELS == 2
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
#elif CONFIG_PGTABLE_LEVELS == 3 #elif CONFIG_PGTABLE_LEVELS == 3
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopud.h> #include <asm-generic/pgtable-nopud.h>
#elif CONFIG_PGTABLE_LEVELS == 4
#include <asm-generic/5level-fixup.h>
#endif #endif
#endif /* __ASM_PGTABLE_TYPES_H */ #endif /* __ASM_PGTABLE_TYPES_H */
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#ifndef __ASM_AVR32_PGTABLE_2LEVEL_H #ifndef __ASM_AVR32_PGTABLE_2LEVEL_H
#define __ASM_AVR32_PGTABLE_2LEVEL_H #define __ASM_AVR32_PGTABLE_2LEVEL_H
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
/* /*
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define _CRIS_PGTABLE_H #define _CRIS_PGTABLE_H
#include <asm/page.h> #include <asm/page.h>
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#ifndef _ASM_PGTABLE_H #ifndef _ASM_PGTABLE_H
#define _ASM_PGTABLE_H #define _ASM_PGTABLE_H
#include <asm-generic/5level-fixup.h>
#include <asm/mem-layout.h> #include <asm/mem-layout.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/processor.h> #include <asm/processor.h>
......
#ifndef _H8300_PGTABLE_H #ifndef _H8300_PGTABLE_H
#define _H8300_PGTABLE_H #define _H8300_PGTABLE_H
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopud.h> #include <asm-generic/pgtable-nopud.h>
#include <asm-generic/pgtable.h> #include <asm-generic/pgtable.h>
#define pgtable_cache_init() do { } while (0) #define pgtable_cache_init() do { } while (0)
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
*/ */
#include <linux/swap.h> #include <linux/swap.h>
#include <asm/page.h> #include <asm/page.h>
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
/* A handy thing to have if one has the RAM. Declared in head.S */ /* A handy thing to have if one has the RAM. Declared in head.S */
......
...@@ -587,8 +587,10 @@ extern struct page *zero_page_memmap_ptr; ...@@ -587,8 +587,10 @@ extern struct page *zero_page_memmap_ptr;
#if CONFIG_PGTABLE_LEVELS == 3 #if CONFIG_PGTABLE_LEVELS == 3
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopud.h> #include <asm-generic/pgtable-nopud.h>
#endif #endif
#include <asm-generic/5level-fixup.h>
#include <asm-generic/pgtable.h> #include <asm-generic/pgtable.h>
#endif /* _ASM_IA64_PGTABLE_H */ #endif /* _ASM_IA64_PGTABLE_H */
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define _METAG_PGTABLE_H #define _METAG_PGTABLE_H
#include <asm/pgtable-bits.h> #include <asm/pgtable-bits.h>
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
/* Invalid regions on Meta: 0x00000000-0x001FFFFF and 0xFFFF0000-0xFFFFFFFF */ /* Invalid regions on Meta: 0x00000000-0x001FFFFF and 0xFFFF0000-0xFFFFFFFF */
......
...@@ -95,7 +95,8 @@ typedef struct { unsigned long pgd; } pgd_t; ...@@ -95,7 +95,8 @@ typedef struct { unsigned long pgd; } pgd_t;
# else /* CONFIG_MMU */ # else /* CONFIG_MMU */
typedef struct { unsigned long ste[64]; } pmd_t; typedef struct { unsigned long ste[64]; } pmd_t;
typedef struct { pmd_t pue[1]; } pud_t; typedef struct { pmd_t pue[1]; } pud_t;
typedef struct { pud_t pge[1]; } pgd_t; typedef struct { pud_t p4e[1]; } p4d_t;
typedef struct { p4d_t pge[1]; } pgd_t;
# endif /* CONFIG_MMU */ # endif /* CONFIG_MMU */
# define pte_val(x) ((x).pte) # define pte_val(x) ((x).pte)
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <asm/cachectl.h> #include <asm/cachectl.h>
#include <asm/fixmap.h> #include <asm/fixmap.h>
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
extern int temp_tlb_entry; extern int temp_tlb_entry;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <asm/cachectl.h> #include <asm/cachectl.h>
#include <asm/fixmap.h> #include <asm/fixmap.h>
#define __ARCH_USE_5LEVEL_HACK
#if defined(CONFIG_PAGE_SIZE_64KB) && !defined(CONFIG_MIPS_VA_BITS_48) #if defined(CONFIG_PAGE_SIZE_64KB) && !defined(CONFIG_MIPS_VA_BITS_48)
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
#else #else
......
...@@ -57,6 +57,7 @@ typedef struct page *pgtable_t; ...@@ -57,6 +57,7 @@ typedef struct page *pgtable_t;
#define __pgd(x) ((pgd_t) { (x) }) #define __pgd(x) ((pgd_t) { (x) })
#define __pgprot(x) ((pgprot_t) { (x) }) #define __pgprot(x) ((pgprot_t) { (x) })
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
#include <asm/pgtable-bits.h> #include <asm/pgtable-bits.h>
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
#define FIRST_USER_ADDRESS 0UL #define FIRST_USER_ADDRESS 0UL
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#ifndef __ASM_OPENRISC_PGTABLE_H #ifndef __ASM_OPENRISC_PGTABLE_H
#define __ASM_OPENRISC_PGTABLE_H #define __ASM_OPENRISC_PGTABLE_H
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
......
#ifndef _ASM_POWERPC_BOOK3S_32_PGTABLE_H #ifndef _ASM_POWERPC_BOOK3S_32_PGTABLE_H
#define _ASM_POWERPC_BOOK3S_32_PGTABLE_H #define _ASM_POWERPC_BOOK3S_32_PGTABLE_H
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
#include <asm/book3s/32/hash.h> #include <asm/book3s/32/hash.h>
......
#ifndef _ASM_POWERPC_BOOK3S_64_PGTABLE_H_ #ifndef _ASM_POWERPC_BOOK3S_64_PGTABLE_H_
#define _ASM_POWERPC_BOOK3S_64_PGTABLE_H_ #define _ASM_POWERPC_BOOK3S_64_PGTABLE_H_
#include <asm-generic/5level-fixup.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <linux/mmdebug.h> #include <linux/mmdebug.h>
#endif #endif
/* /*
* Common bits between hash and Radix page table * Common bits between hash and Radix page table
*/ */
......
#ifndef _ASM_POWERPC_NOHASH_32_PGTABLE_H #ifndef _ASM_POWERPC_NOHASH_32_PGTABLE_H
#define _ASM_POWERPC_NOHASH_32_PGTABLE_H #define _ASM_POWERPC_NOHASH_32_PGTABLE_H
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
......
#ifndef _ASM_POWERPC_NOHASH_64_PGTABLE_4K_H #ifndef _ASM_POWERPC_NOHASH_64_PGTABLE_4K_H
#define _ASM_POWERPC_NOHASH_64_PGTABLE_4K_H #define _ASM_POWERPC_NOHASH_64_PGTABLE_4K_H
#include <asm-generic/5level-fixup.h>
/* /*
* Entries per page directory level. The PTE level must use a 64b record * Entries per page directory level. The PTE level must use a 64b record
* for each page table entry. The PMD and PGD level use a 32b record for * for each page table entry. The PMD and PGD level use a 32b record for
......
#ifndef _ASM_POWERPC_NOHASH_64_PGTABLE_64K_H #ifndef _ASM_POWERPC_NOHASH_64_PGTABLE_64K_H
#define _ASM_POWERPC_NOHASH_64_PGTABLE_64K_H #define _ASM_POWERPC_NOHASH_64_PGTABLE_64K_H
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopud.h> #include <asm-generic/pgtable-nopud.h>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* the S390 page table tree. * the S390 page table tree.
*/ */
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <asm-generic/5level-fixup.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/mm_types.h> #include <linux/mm_types.h>
#include <linux/page-flags.h> #include <linux/page-flags.h>
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define _ASM_SCORE_PGTABLE_H #define _ASM_SCORE_PGTABLE_H
#include <linux/const.h> #include <linux/const.h>
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
#include <asm/fixmap.h> #include <asm/fixmap.h>
......
#ifndef __ASM_SH_PGTABLE_2LEVEL_H #ifndef __ASM_SH_PGTABLE_2LEVEL_H
#define __ASM_SH_PGTABLE_2LEVEL_H #define __ASM_SH_PGTABLE_2LEVEL_H
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
/* /*
......
#ifndef __ASM_SH_PGTABLE_3LEVEL_H #ifndef __ASM_SH_PGTABLE_3LEVEL_H
#define __ASM_SH_PGTABLE_3LEVEL_H #define __ASM_SH_PGTABLE_3LEVEL_H
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopud.h> #include <asm-generic/pgtable-nopud.h>
/* /*
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
* the SpitFire page tables. * the SpitFire page tables.
*/ */
#include <asm-generic/5level-fixup.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/const.h> #include <linux/const.h>
#include <asm/types.h> #include <asm/types.h>
......
...@@ -74,6 +74,7 @@ extern unsigned long VMALLOC_RESERVE /* = CONFIG_VMALLOC_RESERVE */; ...@@ -74,6 +74,7 @@ extern unsigned long VMALLOC_RESERVE /* = CONFIG_VMALLOC_RESERVE */;
#define MAXMEM (_VMALLOC_START - PAGE_OFFSET) #define MAXMEM (_VMALLOC_START - PAGE_OFFSET)
/* We have no pmd or pud since we are strictly a two-level page table */ /* We have no pmd or pud since we are strictly a two-level page table */
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
static inline int pud_huge_page(pud_t pud) { return 0; } static inline int pud_huge_page(pud_t pud) { return 0; }
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
/* We have no pud since we are a three-level page table. */ /* We have no pud since we are a three-level page table. */
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopud.h> #include <asm-generic/pgtable-nopud.h>
/* /*
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#ifndef __UM_PGTABLE_2LEVEL_H #ifndef __UM_PGTABLE_2LEVEL_H
#define __UM_PGTABLE_2LEVEL_H #define __UM_PGTABLE_2LEVEL_H
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
/* PGDIR_SHIFT determines what a third-level page table entry can map */ /* PGDIR_SHIFT determines what a third-level page table entry can map */
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#ifndef __UM_PGTABLE_3LEVEL_H #ifndef __UM_PGTABLE_3LEVEL_H
#define __UM_PGTABLE_3LEVEL_H #define __UM_PGTABLE_3LEVEL_H
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopud.h> #include <asm-generic/pgtable-nopud.h>
/* PGDIR_SHIFT determines what a third-level page table entry can map */ /* PGDIR_SHIFT determines what a third-level page table entry can map */
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#ifndef __UNICORE_PGTABLE_H__ #ifndef __UNICORE_PGTABLE_H__
#define __UNICORE_PGTABLE_H__ #define __UNICORE_PGTABLE_H__
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
#include <asm/cpu-single.h> #include <asm/cpu-single.h>
......
...@@ -273,6 +273,8 @@ static inline pgdval_t pgd_flags(pgd_t pgd) ...@@ -273,6 +273,8 @@ static inline pgdval_t pgd_flags(pgd_t pgd)
} }
#if CONFIG_PGTABLE_LEVELS > 3 #if CONFIG_PGTABLE_LEVELS > 3
#include <asm-generic/5level-fixup.h>
typedef struct { pudval_t pud; } pud_t; typedef struct { pudval_t pud; } pud_t;
static inline pud_t native_make_pud(pmdval_t val) static inline pud_t native_make_pud(pmdval_t val)
...@@ -285,6 +287,7 @@ static inline pudval_t native_pud_val(pud_t pud) ...@@ -285,6 +287,7 @@ static inline pudval_t native_pud_val(pud_t pud)
return pud.pud; return pud.pud;
} }
#else #else
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopud.h> #include <asm-generic/pgtable-nopud.h>
static inline pudval_t native_pud_val(pud_t pud) static inline pudval_t native_pud_val(pud_t pud)
...@@ -306,6 +309,7 @@ static inline pmdval_t native_pmd_val(pmd_t pmd) ...@@ -306,6 +309,7 @@ static inline pmdval_t native_pmd_val(pmd_t pmd)
return pmd.pmd; return pmd.pmd;
} }
#else #else
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
static inline pmdval_t native_pmd_val(pmd_t pmd) static inline pmdval_t native_pmd_val(pmd_t pmd)
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#ifndef _XTENSA_PGTABLE_H #ifndef _XTENSA_PGTABLE_H
#define _XTENSA_PGTABLE_H #define _XTENSA_PGTABLE_H
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/kmem_layout.h> #include <asm/kmem_layout.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment