diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2015-04-14 18:45:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-14 19:49:01 -0400 |
commit | 9f25e6ad58e1fb3b4d441e4c55635c4598a6fa94 (patch) | |
tree | 166d29ab4fe109797e6f9613f6894e321176830b /arch | |
parent | f5d4547ad27737137fae8e67025e5664ecb8e790 (diff) |
arm64: 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.
ARM64_PGTABLE_LEVELS is renamed to PGTABLE_LEVELS and defined before
sourcing init/Kconfig: arch/Kconfig will define default value and it's
sourced from init/Kconfig.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.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')
-rw-r--r-- | arch/arm64/Kconfig | 14 | ||||
-rw-r--r-- | arch/arm64/include/asm/kvm_mmu.h | 4 | ||||
-rw-r--r-- | arch/arm64/include/asm/page.h | 4 | ||||
-rw-r--r-- | arch/arm64/include/asm/pgalloc.h | 8 | ||||
-rw-r--r-- | arch/arm64/include/asm/pgtable-hwdef.h | 6 | ||||
-rw-r--r-- | arch/arm64/include/asm/pgtable-types.h | 12 | ||||
-rw-r--r-- | arch/arm64/include/asm/pgtable.h | 8 | ||||
-rw-r--r-- | arch/arm64/include/asm/tlb.h | 4 | ||||
-rw-r--r-- | arch/arm64/mm/mmu.c | 4 |
9 files changed, 32 insertions, 32 deletions
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 1b8e97331ffb..3f2fba996bc2 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig | |||
@@ -143,6 +143,13 @@ config KERNEL_MODE_NEON | |||
143 | config FIX_EARLYCON_MEM | 143 | config FIX_EARLYCON_MEM |
144 | def_bool y | 144 | def_bool y |
145 | 145 | ||
146 | config PGTABLE_LEVELS | ||
147 | int | ||
148 | default 2 if ARM64_64K_PAGES && ARM64_VA_BITS_42 | ||
149 | default 3 if ARM64_64K_PAGES && ARM64_VA_BITS_48 | ||
150 | default 3 if ARM64_4K_PAGES && ARM64_VA_BITS_39 | ||
151 | default 4 if ARM64_4K_PAGES && ARM64_VA_BITS_48 | ||
152 | |||
146 | source "init/Kconfig" | 153 | source "init/Kconfig" |
147 | 154 | ||
148 | source "kernel/Kconfig.freezer" | 155 | source "kernel/Kconfig.freezer" |
@@ -413,13 +420,6 @@ config ARM64_VA_BITS | |||
413 | default 42 if ARM64_VA_BITS_42 | 420 | default 42 if ARM64_VA_BITS_42 |
414 | default 48 if ARM64_VA_BITS_48 | 421 | default 48 if ARM64_VA_BITS_48 |
415 | 422 | ||
416 | config ARM64_PGTABLE_LEVELS | ||
417 | int | ||
418 | default 2 if ARM64_64K_PAGES && ARM64_VA_BITS_42 | ||
419 | default 3 if ARM64_64K_PAGES && ARM64_VA_BITS_48 | ||
420 | default 3 if ARM64_4K_PAGES && ARM64_VA_BITS_39 | ||
421 | default 4 if ARM64_4K_PAGES && ARM64_VA_BITS_48 | ||
422 | |||
423 | config CPU_BIG_ENDIAN | 423 | config CPU_BIG_ENDIAN |
424 | bool "Build big-endian kernel" | 424 | bool "Build big-endian kernel" |
425 | help | 425 | help |
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h index bbfb600fa822..36250705dc4c 100644 --- a/arch/arm64/include/asm/kvm_mmu.h +++ b/arch/arm64/include/asm/kvm_mmu.h | |||
@@ -163,12 +163,12 @@ static inline bool kvm_s2pmd_readonly(pmd_t *pmd) | |||
163 | /* | 163 | /* |
164 | * If we are concatenating first level stage-2 page tables, we would have less | 164 | * If we are concatenating first level stage-2 page tables, we would have less |
165 | * than or equal to 16 pointers in the fake PGD, because that's what the | 165 | * than or equal to 16 pointers in the fake PGD, because that's what the |
166 | * architecture allows. In this case, (4 - CONFIG_ARM64_PGTABLE_LEVELS) | 166 | * architecture allows. In this case, (4 - CONFIG_PGTABLE_LEVELS) |
167 | * represents the first level for the host, and we add 1 to go to the next | 167 | * represents the first level for the host, and we add 1 to go to the next |
168 | * level (which uses contatenation) for the stage-2 tables. | 168 | * level (which uses contatenation) for the stage-2 tables. |
169 | */ | 169 | */ |
170 | #if PTRS_PER_S2_PGD <= 16 | 170 | #if PTRS_PER_S2_PGD <= 16 |
171 | #define KVM_PREALLOC_LEVEL (4 - CONFIG_ARM64_PGTABLE_LEVELS + 1) | 171 | #define KVM_PREALLOC_LEVEL (4 - CONFIG_PGTABLE_LEVELS + 1) |
172 | #else | 172 | #else |
173 | #define KVM_PREALLOC_LEVEL (0) | 173 | #define KVM_PREALLOC_LEVEL (0) |
174 | #endif | 174 | #endif |
diff --git a/arch/arm64/include/asm/page.h b/arch/arm64/include/asm/page.h index 22b16232bd60..8fc8fa280e92 100644 --- a/arch/arm64/include/asm/page.h +++ b/arch/arm64/include/asm/page.h | |||
@@ -36,9 +36,9 @@ | |||
36 | * for more information). | 36 | * for more information). |
37 | */ | 37 | */ |
38 | #ifdef CONFIG_ARM64_64K_PAGES | 38 | #ifdef CONFIG_ARM64_64K_PAGES |
39 | #define SWAPPER_PGTABLE_LEVELS (CONFIG_ARM64_PGTABLE_LEVELS) | 39 | #define SWAPPER_PGTABLE_LEVELS (CONFIG_PGTABLE_LEVELS) |
40 | #else | 40 | #else |
41 | #define SWAPPER_PGTABLE_LEVELS (CONFIG_ARM64_PGTABLE_LEVELS - 1) | 41 | #define SWAPPER_PGTABLE_LEVELS (CONFIG_PGTABLE_LEVELS - 1) |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | #define SWAPPER_DIR_SIZE (SWAPPER_PGTABLE_LEVELS * PAGE_SIZE) | 44 | #define SWAPPER_DIR_SIZE (SWAPPER_PGTABLE_LEVELS * PAGE_SIZE) |
diff --git a/arch/arm64/include/asm/pgalloc.h b/arch/arm64/include/asm/pgalloc.h index e20df38a8ff3..76420568d66a 100644 --- a/arch/arm64/include/asm/pgalloc.h +++ b/arch/arm64/include/asm/pgalloc.h | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | #define PGALLOC_GFP (GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT | __GFP_ZERO) | 29 | #define PGALLOC_GFP (GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT | __GFP_ZERO) |
30 | 30 | ||
31 | #if CONFIG_ARM64_PGTABLE_LEVELS > 2 | 31 | #if CONFIG_PGTABLE_LEVELS > 2 |
32 | 32 | ||
33 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) | 33 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) |
34 | { | 34 | { |
@@ -46,9 +46,9 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) | |||
46 | set_pud(pud, __pud(__pa(pmd) | PMD_TYPE_TABLE)); | 46 | set_pud(pud, __pud(__pa(pmd) | PMD_TYPE_TABLE)); |
47 | } | 47 | } |
48 | 48 | ||
49 | #endif /* CONFIG_ARM64_PGTABLE_LEVELS > 2 */ | 49 | #endif /* CONFIG_PGTABLE_LEVELS > 2 */ |
50 | 50 | ||
51 | #if CONFIG_ARM64_PGTABLE_LEVELS > 3 | 51 | #if CONFIG_PGTABLE_LEVELS > 3 |
52 | 52 | ||
53 | static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) | 53 | static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) |
54 | { | 54 | { |
@@ -66,7 +66,7 @@ static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud) | |||
66 | set_pgd(pgd, __pgd(__pa(pud) | PUD_TYPE_TABLE)); | 66 | set_pgd(pgd, __pgd(__pa(pud) | PUD_TYPE_TABLE)); |
67 | } | 67 | } |
68 | 68 | ||
69 | #endif /* CONFIG_ARM64_PGTABLE_LEVELS > 3 */ | 69 | #endif /* CONFIG_PGTABLE_LEVELS > 3 */ |
70 | 70 | ||
71 | extern pgd_t *pgd_alloc(struct mm_struct *mm); | 71 | extern pgd_t *pgd_alloc(struct mm_struct *mm); |
72 | extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); | 72 | extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); |
diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h index 5f930cc9ea83..80f3d241cff8 100644 --- a/arch/arm64/include/asm/pgtable-hwdef.h +++ b/arch/arm64/include/asm/pgtable-hwdef.h | |||
@@ -21,7 +21,7 @@ | |||
21 | /* | 21 | /* |
22 | * PMD_SHIFT determines the size a level 2 page table entry can map. | 22 | * PMD_SHIFT determines the size a level 2 page table entry can map. |
23 | */ | 23 | */ |
24 | #if CONFIG_ARM64_PGTABLE_LEVELS > 2 | 24 | #if CONFIG_PGTABLE_LEVELS > 2 |
25 | #define PMD_SHIFT ((PAGE_SHIFT - 3) * 2 + 3) | 25 | #define PMD_SHIFT ((PAGE_SHIFT - 3) * 2 + 3) |
26 | #define PMD_SIZE (_AC(1, UL) << PMD_SHIFT) | 26 | #define PMD_SIZE (_AC(1, UL) << PMD_SHIFT) |
27 | #define PMD_MASK (~(PMD_SIZE-1)) | 27 | #define PMD_MASK (~(PMD_SIZE-1)) |
@@ -31,7 +31,7 @@ | |||
31 | /* | 31 | /* |
32 | * PUD_SHIFT determines the size a level 1 page table entry can map. | 32 | * PUD_SHIFT determines the size a level 1 page table entry can map. |
33 | */ | 33 | */ |
34 | #if CONFIG_ARM64_PGTABLE_LEVELS > 3 | 34 | #if CONFIG_PGTABLE_LEVELS > 3 |
35 | #define PUD_SHIFT ((PAGE_SHIFT - 3) * 3 + 3) | 35 | #define PUD_SHIFT ((PAGE_SHIFT - 3) * 3 + 3) |
36 | #define PUD_SIZE (_AC(1, UL) << PUD_SHIFT) | 36 | #define PUD_SIZE (_AC(1, UL) << PUD_SHIFT) |
37 | #define PUD_MASK (~(PUD_SIZE-1)) | 37 | #define PUD_MASK (~(PUD_SIZE-1)) |
@@ -42,7 +42,7 @@ | |||
42 | * PGDIR_SHIFT determines the size a top-level page table entry can map | 42 | * PGDIR_SHIFT determines the size a top-level page table entry can map |
43 | * (depending on the configuration, this level can be 0, 1 or 2). | 43 | * (depending on the configuration, this level can be 0, 1 or 2). |
44 | */ | 44 | */ |
45 | #define PGDIR_SHIFT ((PAGE_SHIFT - 3) * CONFIG_ARM64_PGTABLE_LEVELS + 3) | 45 | #define PGDIR_SHIFT ((PAGE_SHIFT - 3) * CONFIG_PGTABLE_LEVELS + 3) |
46 | #define PGDIR_SIZE (_AC(1, UL) << PGDIR_SHIFT) | 46 | #define PGDIR_SIZE (_AC(1, UL) << PGDIR_SHIFT) |
47 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | 47 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) |
48 | #define PTRS_PER_PGD (1 << (VA_BITS - PGDIR_SHIFT)) | 48 | #define PTRS_PER_PGD (1 << (VA_BITS - PGDIR_SHIFT)) |
diff --git a/arch/arm64/include/asm/pgtable-types.h b/arch/arm64/include/asm/pgtable-types.h index ca9df80af896..2b1bd7e52c3b 100644 --- a/arch/arm64/include/asm/pgtable-types.h +++ b/arch/arm64/include/asm/pgtable-types.h | |||
@@ -38,13 +38,13 @@ typedef struct { pteval_t pte; } pte_t; | |||
38 | #define pte_val(x) ((x).pte) | 38 | #define pte_val(x) ((x).pte) |
39 | #define __pte(x) ((pte_t) { (x) } ) | 39 | #define __pte(x) ((pte_t) { (x) } ) |
40 | 40 | ||
41 | #if CONFIG_ARM64_PGTABLE_LEVELS > 2 | 41 | #if CONFIG_PGTABLE_LEVELS > 2 |
42 | typedef struct { pmdval_t pmd; } pmd_t; | 42 | typedef struct { pmdval_t pmd; } pmd_t; |
43 | #define pmd_val(x) ((x).pmd) | 43 | #define pmd_val(x) ((x).pmd) |
44 | #define __pmd(x) ((pmd_t) { (x) } ) | 44 | #define __pmd(x) ((pmd_t) { (x) } ) |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #if CONFIG_ARM64_PGTABLE_LEVELS > 3 | 47 | #if CONFIG_PGTABLE_LEVELS > 3 |
48 | typedef struct { pudval_t pud; } pud_t; | 48 | typedef struct { pudval_t pud; } pud_t; |
49 | #define pud_val(x) ((x).pud) | 49 | #define pud_val(x) ((x).pud) |
50 | #define __pud(x) ((pud_t) { (x) } ) | 50 | #define __pud(x) ((pud_t) { (x) } ) |
@@ -64,13 +64,13 @@ typedef pteval_t pte_t; | |||
64 | #define pte_val(x) (x) | 64 | #define pte_val(x) (x) |
65 | #define __pte(x) (x) | 65 | #define __pte(x) (x) |
66 | 66 | ||
67 | #if CONFIG_ARM64_PGTABLE_LEVELS > 2 | 67 | #if CONFIG_PGTABLE_LEVELS > 2 |
68 | typedef pmdval_t pmd_t; | 68 | typedef pmdval_t pmd_t; |
69 | #define pmd_val(x) (x) | 69 | #define pmd_val(x) (x) |
70 | #define __pmd(x) (x) | 70 | #define __pmd(x) (x) |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | #if CONFIG_ARM64_PGTABLE_LEVELS > 3 | 73 | #if CONFIG_PGTABLE_LEVELS > 3 |
74 | typedef pudval_t pud_t; | 74 | typedef pudval_t pud_t; |
75 | #define pud_val(x) (x) | 75 | #define pud_val(x) (x) |
76 | #define __pud(x) (x) | 76 | #define __pud(x) (x) |
@@ -86,9 +86,9 @@ typedef pteval_t pgprot_t; | |||
86 | 86 | ||
87 | #endif /* STRICT_MM_TYPECHECKS */ | 87 | #endif /* STRICT_MM_TYPECHECKS */ |
88 | 88 | ||
89 | #if CONFIG_ARM64_PGTABLE_LEVELS == 2 | 89 | #if CONFIG_PGTABLE_LEVELS == 2 |
90 | #include <asm-generic/pgtable-nopmd.h> | 90 | #include <asm-generic/pgtable-nopmd.h> |
91 | #elif CONFIG_ARM64_PGTABLE_LEVELS == 3 | 91 | #elif CONFIG_PGTABLE_LEVELS == 3 |
92 | #include <asm-generic/pgtable-nopud.h> | 92 | #include <asm-generic/pgtable-nopud.h> |
93 | #endif | 93 | #endif |
94 | 94 | ||
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 800ec0e87ed9..56283f8a675c 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h | |||
@@ -374,7 +374,7 @@ static inline pte_t *pmd_page_vaddr(pmd_t pmd) | |||
374 | */ | 374 | */ |
375 | #define mk_pte(page,prot) pfn_pte(page_to_pfn(page),prot) | 375 | #define mk_pte(page,prot) pfn_pte(page_to_pfn(page),prot) |
376 | 376 | ||
377 | #if CONFIG_ARM64_PGTABLE_LEVELS > 2 | 377 | #if CONFIG_PGTABLE_LEVELS > 2 |
378 | 378 | ||
379 | #define pmd_ERROR(pmd) __pmd_error(__FILE__, __LINE__, pmd_val(pmd)) | 379 | #define pmd_ERROR(pmd) __pmd_error(__FILE__, __LINE__, pmd_val(pmd)) |
380 | 380 | ||
@@ -409,9 +409,9 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr) | |||
409 | 409 | ||
410 | #define pud_page(pud) pfn_to_page(__phys_to_pfn(pud_val(pud) & PHYS_MASK)) | 410 | #define pud_page(pud) pfn_to_page(__phys_to_pfn(pud_val(pud) & PHYS_MASK)) |
411 | 411 | ||
412 | #endif /* CONFIG_ARM64_PGTABLE_LEVELS > 2 */ | 412 | #endif /* CONFIG_PGTABLE_LEVELS > 2 */ |
413 | 413 | ||
414 | #if CONFIG_ARM64_PGTABLE_LEVELS > 3 | 414 | #if CONFIG_PGTABLE_LEVELS > 3 |
415 | 415 | ||
416 | #define pud_ERROR(pud) __pud_error(__FILE__, __LINE__, pud_val(pud)) | 416 | #define pud_ERROR(pud) __pud_error(__FILE__, __LINE__, pud_val(pud)) |
417 | 417 | ||
@@ -445,7 +445,7 @@ static inline pud_t *pud_offset(pgd_t *pgd, unsigned long addr) | |||
445 | 445 | ||
446 | #define pgd_page(pgd) pfn_to_page(__phys_to_pfn(pgd_val(pgd) & PHYS_MASK)) | 446 | #define pgd_page(pgd) pfn_to_page(__phys_to_pfn(pgd_val(pgd) & PHYS_MASK)) |
447 | 447 | ||
448 | #endif /* CONFIG_ARM64_PGTABLE_LEVELS > 3 */ | 448 | #endif /* CONFIG_PGTABLE_LEVELS > 3 */ |
449 | 449 | ||
450 | #define pgd_ERROR(pgd) __pgd_error(__FILE__, __LINE__, pgd_val(pgd)) | 450 | #define pgd_ERROR(pgd) __pgd_error(__FILE__, __LINE__, pgd_val(pgd)) |
451 | 451 | ||
diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h index 53d9c354219f..3a0242c7eb8d 100644 --- a/arch/arm64/include/asm/tlb.h +++ b/arch/arm64/include/asm/tlb.h | |||
@@ -53,7 +53,7 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, | |||
53 | tlb_remove_entry(tlb, pte); | 53 | tlb_remove_entry(tlb, pte); |
54 | } | 54 | } |
55 | 55 | ||
56 | #if CONFIG_ARM64_PGTABLE_LEVELS > 2 | 56 | #if CONFIG_PGTABLE_LEVELS > 2 |
57 | static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, | 57 | static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, |
58 | unsigned long addr) | 58 | unsigned long addr) |
59 | { | 59 | { |
@@ -62,7 +62,7 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, | |||
62 | } | 62 | } |
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | #if CONFIG_ARM64_PGTABLE_LEVELS > 3 | 65 | #if CONFIG_PGTABLE_LEVELS > 3 |
66 | static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp, | 66 | static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp, |
67 | unsigned long addr) | 67 | unsigned long addr) |
68 | { | 68 | { |
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index c6daaf6c6f97..79e01163a981 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c | |||
@@ -550,10 +550,10 @@ void vmemmap_free(unsigned long start, unsigned long end) | |||
550 | #endif /* CONFIG_SPARSEMEM_VMEMMAP */ | 550 | #endif /* CONFIG_SPARSEMEM_VMEMMAP */ |
551 | 551 | ||
552 | static pte_t bm_pte[PTRS_PER_PTE] __page_aligned_bss; | 552 | static pte_t bm_pte[PTRS_PER_PTE] __page_aligned_bss; |
553 | #if CONFIG_ARM64_PGTABLE_LEVELS > 2 | 553 | #if CONFIG_PGTABLE_LEVELS > 2 |
554 | static pmd_t bm_pmd[PTRS_PER_PMD] __page_aligned_bss; | 554 | static pmd_t bm_pmd[PTRS_PER_PMD] __page_aligned_bss; |
555 | #endif | 555 | #endif |
556 | #if CONFIG_ARM64_PGTABLE_LEVELS > 3 | 556 | #if CONFIG_PGTABLE_LEVELS > 3 |
557 | static pud_t bm_pud[PTRS_PER_PUD] __page_aligned_bss; | 557 | static pud_t bm_pud[PTRS_PER_PUD] __page_aligned_bss; |
558 | #endif | 558 | #endif |
559 | 559 | ||