diff options
author | Becky Bruce <beckyb@kernel.crashing.org> | 2011-10-10 06:50:40 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-12-07 00:26:22 -0500 |
commit | 881fde1db591628db0494e77cd9002b0ba8b04b7 (patch) | |
tree | 0281839c8a9d248236645f07bcb4dcd45e6ed992 /arch/powerpc | |
parent | a1cd54198811e3c35fcaabdb94767b307f7ad1db (diff) |
powerpc: hugetlb: modify include usage for FSL BookE code
The original 32-bit hugetlb implementation used PPC64 vs PPC32 to
determine which code path to take. However, the final hugetlb
implementation for 64-bit FSL ended up shared with the FSL
32-bit code so the actual check needs to be FSL_BOOK3E vs
everything else. This patch changes the include protections to
reflect this.
There are also a couple of related comment fixes.
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/include/asm/hugetlb.h | 6 | ||||
-rw-r--r-- | arch/powerpc/mm/hugetlbpage.c | 54 | ||||
-rw-r--r-- | arch/powerpc/mm/tlb_nohash.c | 2 |
3 files changed, 29 insertions, 33 deletions
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index 70f9885f5c0f..273acfad65ae 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h | |||
@@ -22,14 +22,14 @@ static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr, | |||
22 | unsigned pdshift) | 22 | unsigned pdshift) |
23 | { | 23 | { |
24 | /* | 24 | /* |
25 | * On 32-bit, we have multiple higher-level table entries that point to | 25 | * On FSL BookE, we have multiple higher-level table entries that |
26 | * the same hugepte. Just use the first one since they're all | 26 | * point to the same hugepte. Just use the first one since they're all |
27 | * identical. So for that case, idx=0. | 27 | * identical. So for that case, idx=0. |
28 | */ | 28 | */ |
29 | unsigned long idx = 0; | 29 | unsigned long idx = 0; |
30 | 30 | ||
31 | pte_t *dir = hugepd_page(*hpdp); | 31 | pte_t *dir = hugepd_page(*hpdp); |
32 | #ifdef CONFIG_PPC64 | 32 | #ifndef CONFIG_PPC_FSL_BOOK3E |
33 | idx = (addr & ((1UL << pdshift) - 1)) >> hugepd_shift(*hpdp); | 33 | idx = (addr & ((1UL << pdshift) - 1)) >> hugepd_shift(*hpdp); |
34 | #endif | 34 | #endif |
35 | 35 | ||
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 96178e8fb046..7c7cb9797270 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c | |||
@@ -33,17 +33,17 @@ unsigned int HPAGE_SHIFT; | |||
33 | * implementations may have more than one gpage size due to limitations | 33 | * implementations may have more than one gpage size due to limitations |
34 | * of the memory allocators, so we need multiple arrays | 34 | * of the memory allocators, so we need multiple arrays |
35 | */ | 35 | */ |
36 | #ifdef CONFIG_PPC64 | 36 | #ifdef CONFIG_PPC_FSL_BOOK3E |
37 | #define MAX_NUMBER_GPAGES 1024 | ||
38 | static u64 gpage_freearray[MAX_NUMBER_GPAGES]; | ||
39 | static unsigned nr_gpages; | ||
40 | #else | ||
41 | #define MAX_NUMBER_GPAGES 128 | 37 | #define MAX_NUMBER_GPAGES 128 |
42 | struct psize_gpages { | 38 | struct psize_gpages { |
43 | u64 gpage_list[MAX_NUMBER_GPAGES]; | 39 | u64 gpage_list[MAX_NUMBER_GPAGES]; |
44 | unsigned int nr_gpages; | 40 | unsigned int nr_gpages; |
45 | }; | 41 | }; |
46 | static struct psize_gpages gpage_freearray[MMU_PAGE_COUNT]; | 42 | static struct psize_gpages gpage_freearray[MMU_PAGE_COUNT]; |
43 | #else | ||
44 | #define MAX_NUMBER_GPAGES 1024 | ||
45 | static u64 gpage_freearray[MAX_NUMBER_GPAGES]; | ||
46 | static unsigned nr_gpages; | ||
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | static inline int shift_to_mmu_psize(unsigned int shift) | 49 | static inline int shift_to_mmu_psize(unsigned int shift) |
@@ -114,12 +114,12 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, | |||
114 | struct kmem_cache *cachep; | 114 | struct kmem_cache *cachep; |
115 | pte_t *new; | 115 | pte_t *new; |
116 | 116 | ||
117 | #ifdef CONFIG_PPC64 | 117 | #ifdef CONFIG_PPC_FSL_BOOK3E |
118 | cachep = PGT_CACHE(pdshift - pshift); | ||
119 | #else | ||
120 | int i; | 118 | int i; |
121 | int num_hugepd = 1 << (pshift - pdshift); | 119 | int num_hugepd = 1 << (pshift - pdshift); |
122 | cachep = hugepte_cache; | 120 | cachep = hugepte_cache; |
121 | #else | ||
122 | cachep = PGT_CACHE(pdshift - pshift); | ||
123 | #endif | 123 | #endif |
124 | 124 | ||
125 | new = kmem_cache_zalloc(cachep, GFP_KERNEL|__GFP_REPEAT); | 125 | new = kmem_cache_zalloc(cachep, GFP_KERNEL|__GFP_REPEAT); |
@@ -131,12 +131,7 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, | |||
131 | return -ENOMEM; | 131 | return -ENOMEM; |
132 | 132 | ||
133 | spin_lock(&mm->page_table_lock); | 133 | spin_lock(&mm->page_table_lock); |
134 | #ifdef CONFIG_PPC64 | 134 | #ifdef CONFIG_PPC_FSL_BOOK3E |
135 | if (!hugepd_none(*hpdp)) | ||
136 | kmem_cache_free(cachep, new); | ||
137 | else | ||
138 | hpdp->pd = ((unsigned long)new & ~PD_HUGE) | pshift; | ||
139 | #else | ||
140 | /* | 135 | /* |
141 | * We have multiple higher-level entries that point to the same | 136 | * We have multiple higher-level entries that point to the same |
142 | * actual pte location. Fill in each as we go and backtrack on error. | 137 | * actual pte location. Fill in each as we go and backtrack on error. |
@@ -215,7 +210,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz | |||
215 | return hugepte_offset(hpdp, addr, pdshift); | 210 | return hugepte_offset(hpdp, addr, pdshift); |
216 | } | 211 | } |
217 | 212 | ||
218 | #ifdef CONFIG_PPC32 | 213 | #ifdef CONFIG_PPC_FSL_BOOK3E |
219 | /* Build list of addresses of gigantic pages. This function is used in early | 214 | /* Build list of addresses of gigantic pages. This function is used in early |
220 | * boot before the buddy or bootmem allocator is setup. | 215 | * boot before the buddy or bootmem allocator is setup. |
221 | */ | 216 | */ |
@@ -335,7 +330,7 @@ void __init reserve_hugetlb_gpages(void) | |||
335 | } | 330 | } |
336 | } | 331 | } |
337 | 332 | ||
338 | #else /* PPC64 */ | 333 | #else /* !PPC_FSL_BOOK3E */ |
339 | 334 | ||
340 | /* Build list of addresses of gigantic pages. This function is used in early | 335 | /* Build list of addresses of gigantic pages. This function is used in early |
341 | * boot before the buddy or bootmem allocator is setup. | 336 | * boot before the buddy or bootmem allocator is setup. |
@@ -373,7 +368,7 @@ int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep) | |||
373 | return 0; | 368 | return 0; |
374 | } | 369 | } |
375 | 370 | ||
376 | #ifdef CONFIG_PPC32 | 371 | #ifdef CONFIG_PPC_FSL_BOOK3E |
377 | #define HUGEPD_FREELIST_SIZE \ | 372 | #define HUGEPD_FREELIST_SIZE \ |
378 | ((PAGE_SIZE - sizeof(struct hugepd_freelist)) / sizeof(pte_t)) | 373 | ((PAGE_SIZE - sizeof(struct hugepd_freelist)) / sizeof(pte_t)) |
379 | 374 | ||
@@ -433,11 +428,11 @@ static void free_hugepd_range(struct mmu_gather *tlb, hugepd_t *hpdp, int pdshif | |||
433 | unsigned long pdmask = ~((1UL << pdshift) - 1); | 428 | unsigned long pdmask = ~((1UL << pdshift) - 1); |
434 | unsigned int num_hugepd = 1; | 429 | unsigned int num_hugepd = 1; |
435 | 430 | ||
436 | #ifdef CONFIG_PPC64 | 431 | #ifdef CONFIG_PPC_FSL_BOOK3E |
437 | unsigned int shift = hugepd_shift(*hpdp); | 432 | /* Note: On fsl the hpdp may be the first of several */ |
438 | #else | ||
439 | /* Note: On 32-bit the hpdp may be the first of several */ | ||
440 | num_hugepd = (1 << (hugepd_shift(*hpdp) - pdshift)); | 433 | num_hugepd = (1 << (hugepd_shift(*hpdp) - pdshift)); |
434 | #else | ||
435 | unsigned int shift = hugepd_shift(*hpdp); | ||
441 | #endif | 436 | #endif |
442 | 437 | ||
443 | start &= pdmask; | 438 | start &= pdmask; |
@@ -455,10 +450,11 @@ static void free_hugepd_range(struct mmu_gather *tlb, hugepd_t *hpdp, int pdshif | |||
455 | hpdp->pd = 0; | 450 | hpdp->pd = 0; |
456 | 451 | ||
457 | tlb->need_flush = 1; | 452 | tlb->need_flush = 1; |
458 | #ifdef CONFIG_PPC64 | 453 | |
459 | pgtable_free_tlb(tlb, hugepte, pdshift - shift); | 454 | #ifdef CONFIG_PPC_FSL_BOOK3E |
460 | #else | ||
461 | hugepd_free(tlb, hugepte); | 455 | hugepd_free(tlb, hugepte); |
456 | #else | ||
457 | pgtable_free_tlb(tlb, hugepte, pdshift - shift); | ||
462 | #endif | 458 | #endif |
463 | } | 459 | } |
464 | 460 | ||
@@ -590,12 +586,12 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb, | |||
590 | continue; | 586 | continue; |
591 | hugetlb_free_pud_range(tlb, pgd, addr, next, floor, ceiling); | 587 | hugetlb_free_pud_range(tlb, pgd, addr, next, floor, ceiling); |
592 | } else { | 588 | } else { |
593 | #ifdef CONFIG_PPC32 | 589 | #ifdef CONFIG_PPC_FSL_BOOK3E |
594 | /* | 590 | /* |
595 | * Increment next by the size of the huge mapping since | 591 | * Increment next by the size of the huge mapping since |
596 | * on 32-bit there may be more than one entry at the pgd | 592 | * there may be more than one entry at the pgd level |
597 | * level for a single hugepage, but all of them point to | 593 | * for a single hugepage, but all of them point to the |
598 | * the same kmem cache that holds the hugepte. | 594 | * same kmem cache that holds the hugepte. |
599 | */ | 595 | */ |
600 | next = addr + (1 << hugepd_shift(*(hugepd_t *)pgd)); | 596 | next = addr + (1 << hugepd_shift(*(hugepd_t *)pgd)); |
601 | #endif | 597 | #endif |
@@ -817,7 +813,7 @@ static int __init hugepage_setup_sz(char *str) | |||
817 | } | 813 | } |
818 | __setup("hugepagesz=", hugepage_setup_sz); | 814 | __setup("hugepagesz=", hugepage_setup_sz); |
819 | 815 | ||
820 | #ifdef CONFIG_FSL_BOOKE | 816 | #ifdef CONFIG_PPC_FSL_BOOK3E |
821 | struct kmem_cache *hugepte_cache; | 817 | struct kmem_cache *hugepte_cache; |
822 | static int __init hugetlbpage_init(void) | 818 | static int __init hugetlbpage_init(void) |
823 | { | 819 | { |
diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c index 4e13d6f9023e..b2c65c660852 100644 --- a/arch/powerpc/mm/tlb_nohash.c +++ b/arch/powerpc/mm/tlb_nohash.c | |||
@@ -52,7 +52,7 @@ | |||
52 | * indirect page table entries. | 52 | * indirect page table entries. |
53 | */ | 53 | */ |
54 | #ifdef CONFIG_PPC_BOOK3E_MMU | 54 | #ifdef CONFIG_PPC_BOOK3E_MMU |
55 | #ifdef CONFIG_FSL_BOOKE | 55 | #ifdef CONFIG_PPC_FSL_BOOK3E |
56 | struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT] = { | 56 | struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT] = { |
57 | [MMU_PAGE_4K] = { | 57 | [MMU_PAGE_4K] = { |
58 | .shift = 12, | 58 | .shift = 12, |