diff options
| author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2015-04-14 18:46:14 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-14 19:49:02 -0400 |
| commit | 982333683385343d8d2db9a1df69c98406f42687 (patch) | |
| tree | 2ce273cf325bcad64d032090344778fb0267f59a /arch/x86/include | |
| parent | 6b8ce2a1a464526335672c33cbf3cb9fc638efff (diff) | |
x86: expose number of page table levels on Kconfig level
We would want to use number of page table level to define mm_struct.
Let's expose it as CONFIG_PGTABLE_LEVELS.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/include')
| -rw-r--r-- | arch/x86/include/asm/paravirt.h | 8 | ||||
| -rw-r--r-- | arch/x86/include/asm/paravirt_types.h | 8 | ||||
| -rw-r--r-- | arch/x86/include/asm/pgalloc.h | 8 | ||||
| -rw-r--r-- | arch/x86/include/asm/pgtable-2level_types.h | 1 | ||||
| -rw-r--r-- | arch/x86/include/asm/pgtable-3level_types.h | 2 | ||||
| -rw-r--r-- | arch/x86/include/asm/pgtable.h | 8 | ||||
| -rw-r--r-- | arch/x86/include/asm/pgtable_64_types.h | 1 | ||||
| -rw-r--r-- | arch/x86/include/asm/pgtable_types.h | 4 |
8 files changed, 18 insertions, 22 deletions
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index 5f6051d5d139..8957810ad7d1 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h | |||
| @@ -545,7 +545,7 @@ static inline void set_pmd(pmd_t *pmdp, pmd_t pmd) | |||
| 545 | PVOP_VCALL2(pv_mmu_ops.set_pmd, pmdp, val); | 545 | PVOP_VCALL2(pv_mmu_ops.set_pmd, pmdp, val); |
| 546 | } | 546 | } |
| 547 | 547 | ||
| 548 | #if PAGETABLE_LEVELS >= 3 | 548 | #if CONFIG_PGTABLE_LEVELS >= 3 |
| 549 | static inline pmd_t __pmd(pmdval_t val) | 549 | static inline pmd_t __pmd(pmdval_t val) |
| 550 | { | 550 | { |
| 551 | pmdval_t ret; | 551 | pmdval_t ret; |
| @@ -585,7 +585,7 @@ static inline void set_pud(pud_t *pudp, pud_t pud) | |||
| 585 | PVOP_VCALL2(pv_mmu_ops.set_pud, pudp, | 585 | PVOP_VCALL2(pv_mmu_ops.set_pud, pudp, |
| 586 | val); | 586 | val); |
| 587 | } | 587 | } |
| 588 | #if PAGETABLE_LEVELS == 4 | 588 | #if CONFIG_PGTABLE_LEVELS == 4 |
| 589 | static inline pud_t __pud(pudval_t val) | 589 | static inline pud_t __pud(pudval_t val) |
| 590 | { | 590 | { |
| 591 | pudval_t ret; | 591 | pudval_t ret; |
| @@ -636,9 +636,9 @@ static inline void pud_clear(pud_t *pudp) | |||
| 636 | set_pud(pudp, __pud(0)); | 636 | set_pud(pudp, __pud(0)); |
| 637 | } | 637 | } |
| 638 | 638 | ||
| 639 | #endif /* PAGETABLE_LEVELS == 4 */ | 639 | #endif /* CONFIG_PGTABLE_LEVELS == 4 */ |
| 640 | 640 | ||
| 641 | #endif /* PAGETABLE_LEVELS >= 3 */ | 641 | #endif /* CONFIG_PGTABLE_LEVELS >= 3 */ |
| 642 | 642 | ||
| 643 | #ifdef CONFIG_X86_PAE | 643 | #ifdef CONFIG_X86_PAE |
| 644 | /* Special-case pte-setting operations for PAE, which can't update a | 644 | /* Special-case pte-setting operations for PAE, which can't update a |
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h index 7549b8b369e4..f7b0b5c112f2 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm/paravirt_types.h | |||
| @@ -294,7 +294,7 @@ struct pv_mmu_ops { | |||
| 294 | struct paravirt_callee_save pgd_val; | 294 | struct paravirt_callee_save pgd_val; |
| 295 | struct paravirt_callee_save make_pgd; | 295 | struct paravirt_callee_save make_pgd; |
| 296 | 296 | ||
| 297 | #if PAGETABLE_LEVELS >= 3 | 297 | #if CONFIG_PGTABLE_LEVELS >= 3 |
| 298 | #ifdef CONFIG_X86_PAE | 298 | #ifdef CONFIG_X86_PAE |
| 299 | void (*set_pte_atomic)(pte_t *ptep, pte_t pteval); | 299 | void (*set_pte_atomic)(pte_t *ptep, pte_t pteval); |
| 300 | void (*pte_clear)(struct mm_struct *mm, unsigned long addr, | 300 | void (*pte_clear)(struct mm_struct *mm, unsigned long addr, |
| @@ -308,13 +308,13 @@ struct pv_mmu_ops { | |||
| 308 | struct paravirt_callee_save pmd_val; | 308 | struct paravirt_callee_save pmd_val; |
| 309 | struct paravirt_callee_save make_pmd; | 309 | struct paravirt_callee_save make_pmd; |
| 310 | 310 | ||
| 311 | #if PAGETABLE_LEVELS == 4 | 311 | #if CONFIG_PGTABLE_LEVELS == 4 |
| 312 | struct paravirt_callee_save pud_val; | 312 | struct paravirt_callee_save pud_val; |
| 313 | struct paravirt_callee_save make_pud; | 313 | struct paravirt_callee_save make_pud; |
| 314 | 314 | ||
| 315 | void (*set_pgd)(pgd_t *pudp, pgd_t pgdval); | 315 | void (*set_pgd)(pgd_t *pudp, pgd_t pgdval); |
| 316 | #endif /* PAGETABLE_LEVELS == 4 */ | 316 | #endif /* CONFIG_PGTABLE_LEVELS == 4 */ |
| 317 | #endif /* PAGETABLE_LEVELS >= 3 */ | 317 | #endif /* CONFIG_PGTABLE_LEVELS >= 3 */ |
| 318 | 318 | ||
| 319 | struct pv_lazy_ops lazy_mode; | 319 | struct pv_lazy_ops lazy_mode; |
| 320 | 320 | ||
diff --git a/arch/x86/include/asm/pgalloc.h b/arch/x86/include/asm/pgalloc.h index c4412e972bbd..bf7f8b55b0f9 100644 --- a/arch/x86/include/asm/pgalloc.h +++ b/arch/x86/include/asm/pgalloc.h | |||
| @@ -77,7 +77,7 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, | |||
| 77 | 77 | ||
| 78 | #define pmd_pgtable(pmd) pmd_page(pmd) | 78 | #define pmd_pgtable(pmd) pmd_page(pmd) |
| 79 | 79 | ||
| 80 | #if PAGETABLE_LEVELS > 2 | 80 | #if CONFIG_PGTABLE_LEVELS > 2 |
| 81 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) | 81 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) |
| 82 | { | 82 | { |
| 83 | struct page *page; | 83 | struct page *page; |
| @@ -116,7 +116,7 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) | |||
| 116 | } | 116 | } |
| 117 | #endif /* CONFIG_X86_PAE */ | 117 | #endif /* CONFIG_X86_PAE */ |
| 118 | 118 | ||
| 119 | #if PAGETABLE_LEVELS > 3 | 119 | #if CONFIG_PGTABLE_LEVELS > 3 |
| 120 | static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud) | 120 | static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud) |
| 121 | { | 121 | { |
| 122 | paravirt_alloc_pud(mm, __pa(pud) >> PAGE_SHIFT); | 122 | paravirt_alloc_pud(mm, __pa(pud) >> PAGE_SHIFT); |
| @@ -142,7 +142,7 @@ static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pud, | |||
| 142 | ___pud_free_tlb(tlb, pud); | 142 | ___pud_free_tlb(tlb, pud); |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | #endif /* PAGETABLE_LEVELS > 3 */ | 145 | #endif /* CONFIG_PGTABLE_LEVELS > 3 */ |
| 146 | #endif /* PAGETABLE_LEVELS > 2 */ | 146 | #endif /* CONFIG_PGTABLE_LEVELS > 2 */ |
| 147 | 147 | ||
| 148 | #endif /* _ASM_X86_PGALLOC_H */ | 148 | #endif /* _ASM_X86_PGALLOC_H */ |
diff --git a/arch/x86/include/asm/pgtable-2level_types.h b/arch/x86/include/asm/pgtable-2level_types.h index daacc23e3fb9..392576433e77 100644 --- a/arch/x86/include/asm/pgtable-2level_types.h +++ b/arch/x86/include/asm/pgtable-2level_types.h | |||
| @@ -17,7 +17,6 @@ typedef union { | |||
| 17 | #endif /* !__ASSEMBLY__ */ | 17 | #endif /* !__ASSEMBLY__ */ |
| 18 | 18 | ||
| 19 | #define SHARED_KERNEL_PMD 0 | 19 | #define SHARED_KERNEL_PMD 0 |
| 20 | #define PAGETABLE_LEVELS 2 | ||
| 21 | 20 | ||
| 22 | /* | 21 | /* |
| 23 | * traditional i386 two-level paging structure: | 22 | * traditional i386 two-level paging structure: |
diff --git a/arch/x86/include/asm/pgtable-3level_types.h b/arch/x86/include/asm/pgtable-3level_types.h index 1bd5876c8649..bcc89625ebe5 100644 --- a/arch/x86/include/asm/pgtable-3level_types.h +++ b/arch/x86/include/asm/pgtable-3level_types.h | |||
| @@ -24,8 +24,6 @@ typedef union { | |||
| 24 | #define SHARED_KERNEL_PMD 1 | 24 | #define SHARED_KERNEL_PMD 1 |
| 25 | #endif | 25 | #endif |
| 26 | 26 | ||
| 27 | #define PAGETABLE_LEVELS 3 | ||
| 28 | |||
| 29 | /* | 27 | /* |
| 30 | * PGDIR_SHIFT determines what a top-level page table entry can map | 28 | * PGDIR_SHIFT determines what a top-level page table entry can map |
| 31 | */ | 29 | */ |
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index a0c35bf6cb92..fe57e7a98839 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
| @@ -551,7 +551,7 @@ static inline unsigned long pages_to_mb(unsigned long npg) | |||
| 551 | return npg >> (20 - PAGE_SHIFT); | 551 | return npg >> (20 - PAGE_SHIFT); |
| 552 | } | 552 | } |
| 553 | 553 | ||
| 554 | #if PAGETABLE_LEVELS > 2 | 554 | #if CONFIG_PGTABLE_LEVELS > 2 |
| 555 | static inline int pud_none(pud_t pud) | 555 | static inline int pud_none(pud_t pud) |
| 556 | { | 556 | { |
| 557 | return native_pud_val(pud) == 0; | 557 | return native_pud_val(pud) == 0; |
| @@ -594,9 +594,9 @@ static inline int pud_large(pud_t pud) | |||
| 594 | { | 594 | { |
| 595 | return 0; | 595 | return 0; |
| 596 | } | 596 | } |
| 597 | #endif /* PAGETABLE_LEVELS > 2 */ | 597 | #endif /* CONFIG_PGTABLE_LEVELS > 2 */ |
| 598 | 598 | ||
| 599 | #if PAGETABLE_LEVELS > 3 | 599 | #if CONFIG_PGTABLE_LEVELS > 3 |
| 600 | static inline int pgd_present(pgd_t pgd) | 600 | static inline int pgd_present(pgd_t pgd) |
| 601 | { | 601 | { |
| 602 | return pgd_flags(pgd) & _PAGE_PRESENT; | 602 | return pgd_flags(pgd) & _PAGE_PRESENT; |
| @@ -633,7 +633,7 @@ static inline int pgd_none(pgd_t pgd) | |||
| 633 | { | 633 | { |
| 634 | return !native_pgd_val(pgd); | 634 | return !native_pgd_val(pgd); |
| 635 | } | 635 | } |
| 636 | #endif /* PAGETABLE_LEVELS > 3 */ | 636 | #endif /* CONFIG_PGTABLE_LEVELS > 3 */ |
| 637 | 637 | ||
| 638 | #endif /* __ASSEMBLY__ */ | 638 | #endif /* __ASSEMBLY__ */ |
| 639 | 639 | ||
diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h index 602b6028c5b6..e6844dfb4471 100644 --- a/arch/x86/include/asm/pgtable_64_types.h +++ b/arch/x86/include/asm/pgtable_64_types.h | |||
| @@ -20,7 +20,6 @@ typedef struct { pteval_t pte; } pte_t; | |||
| 20 | #endif /* !__ASSEMBLY__ */ | 20 | #endif /* !__ASSEMBLY__ */ |
| 21 | 21 | ||
| 22 | #define SHARED_KERNEL_PMD 0 | 22 | #define SHARED_KERNEL_PMD 0 |
| 23 | #define PAGETABLE_LEVELS 4 | ||
| 24 | 23 | ||
| 25 | /* | 24 | /* |
| 26 | * PGDIR_SHIFT determines what a top-level page table entry can map | 25 | * PGDIR_SHIFT determines what a top-level page table entry can map |
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h index 8c7c10802e9c..78f0c8cbe316 100644 --- a/arch/x86/include/asm/pgtable_types.h +++ b/arch/x86/include/asm/pgtable_types.h | |||
| @@ -234,7 +234,7 @@ static inline pgdval_t pgd_flags(pgd_t pgd) | |||
| 234 | return native_pgd_val(pgd) & PTE_FLAGS_MASK; | 234 | return native_pgd_val(pgd) & PTE_FLAGS_MASK; |
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | #if PAGETABLE_LEVELS > 3 | 237 | #if CONFIG_PGTABLE_LEVELS > 3 |
| 238 | typedef struct { pudval_t pud; } pud_t; | 238 | typedef struct { pudval_t pud; } pud_t; |
| 239 | 239 | ||
| 240 | static inline pud_t native_make_pud(pmdval_t val) | 240 | static inline pud_t native_make_pud(pmdval_t val) |
| @@ -255,7 +255,7 @@ static inline pudval_t native_pud_val(pud_t pud) | |||
| 255 | } | 255 | } |
| 256 | #endif | 256 | #endif |
| 257 | 257 | ||
| 258 | #if PAGETABLE_LEVELS > 2 | 258 | #if CONFIG_PGTABLE_LEVELS > 2 |
| 259 | typedef struct { pmdval_t pmd; } pmd_t; | 259 | typedef struct { pmdval_t pmd; } pmd_t; |
| 260 | 260 | ||
| 261 | static inline pmd_t native_make_pmd(pmdval_t val) | 261 | static inline pmd_t native_make_pmd(pmdval_t val) |
