diff options
-rw-r--r-- | arch/powerpc/include/asm/hugetlb.h | 19 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_64.c | 10 | ||||
-rw-r--r-- | arch/powerpc/mm/hugetlbpage.c | 8 |
3 files changed, 28 insertions, 9 deletions
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index 273acfad65ae..555044c310b2 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h | |||
@@ -5,7 +5,6 @@ | |||
5 | #include <asm/page.h> | 5 | #include <asm/page.h> |
6 | 6 | ||
7 | extern struct kmem_cache *hugepte_cache; | 7 | extern struct kmem_cache *hugepte_cache; |
8 | extern void __init reserve_hugetlb_gpages(void); | ||
9 | 8 | ||
10 | static inline pte_t *hugepd_page(hugepd_t hpd) | 9 | static inline pte_t *hugepd_page(hugepd_t hpd) |
11 | { | 10 | { |
@@ -153,14 +152,24 @@ static inline void arch_release_hugepage(struct page *page) | |||
153 | } | 152 | } |
154 | 153 | ||
155 | #else /* ! CONFIG_HUGETLB_PAGE */ | 154 | #else /* ! CONFIG_HUGETLB_PAGE */ |
156 | static inline void reserve_hugetlb_gpages(void) | ||
157 | { | ||
158 | pr_err("Cannot reserve gpages without hugetlb enabled\n"); | ||
159 | } | ||
160 | static inline void flush_hugetlb_page(struct vm_area_struct *vma, | 155 | static inline void flush_hugetlb_page(struct vm_area_struct *vma, |
161 | unsigned long vmaddr) | 156 | unsigned long vmaddr) |
162 | { | 157 | { |
163 | } | 158 | } |
159 | #endif /* CONFIG_HUGETLB_PAGE */ | ||
160 | |||
161 | |||
162 | /* | ||
163 | * FSL Book3E platforms require special gpage handling - the gpages | ||
164 | * are reserved early in the boot process by memblock instead of via | ||
165 | * the .dts as on IBM platforms. | ||
166 | */ | ||
167 | #if defined(CONFIG_HUGETLB_PAGE) && defined(CONFIG_PPC_FSL_BOOK3E) | ||
168 | extern void __init reserve_hugetlb_gpages(void); | ||
169 | #else | ||
170 | static inline void reserve_hugetlb_gpages(void) | ||
171 | { | ||
172 | } | ||
164 | #endif | 173 | #endif |
165 | 174 | ||
166 | #endif /* _ASM_POWERPC_HUGETLB_H */ | 175 | #endif /* _ASM_POWERPC_HUGETLB_H */ |
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index fb9bb46e7e88..4cb8f1e9d044 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -35,6 +35,8 @@ | |||
35 | #include <linux/pci.h> | 35 | #include <linux/pci.h> |
36 | #include <linux/lockdep.h> | 36 | #include <linux/lockdep.h> |
37 | #include <linux/memblock.h> | 37 | #include <linux/memblock.h> |
38 | #include <linux/hugetlb.h> | ||
39 | |||
38 | #include <asm/io.h> | 40 | #include <asm/io.h> |
39 | #include <asm/kdump.h> | 41 | #include <asm/kdump.h> |
40 | #include <asm/prom.h> | 42 | #include <asm/prom.h> |
@@ -64,6 +66,7 @@ | |||
64 | #include <asm/mmu_context.h> | 66 | #include <asm/mmu_context.h> |
65 | #include <asm/code-patching.h> | 67 | #include <asm/code-patching.h> |
66 | #include <asm/kvm_ppc.h> | 68 | #include <asm/kvm_ppc.h> |
69 | #include <asm/hugetlb.h> | ||
67 | 70 | ||
68 | #include "setup.h" | 71 | #include "setup.h" |
69 | 72 | ||
@@ -217,6 +220,13 @@ void __init early_setup(unsigned long dt_ptr) | |||
217 | /* Initialize the hash table or TLB handling */ | 220 | /* Initialize the hash table or TLB handling */ |
218 | early_init_mmu(); | 221 | early_init_mmu(); |
219 | 222 | ||
223 | /* | ||
224 | * Reserve any gigantic pages requested on the command line. | ||
225 | * memblock needs to have been initialized by the time this is | ||
226 | * called since this will reserve memory. | ||
227 | */ | ||
228 | reserve_hugetlb_gpages(); | ||
229 | |||
220 | DBG(" <- early_setup()\n"); | 230 | DBG(" <- early_setup()\n"); |
221 | } | 231 | } |
222 | 232 | ||
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 7c7cb9797270..79c575d3dd63 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c | |||
@@ -28,10 +28,10 @@ unsigned int HPAGE_SHIFT; | |||
28 | 28 | ||
29 | /* | 29 | /* |
30 | * Tracks gpages after the device tree is scanned and before the | 30 | * Tracks gpages after the device tree is scanned and before the |
31 | * huge_boot_pages list is ready. On 64-bit implementations, this is | 31 | * huge_boot_pages list is ready. On non-Freescale implementations, this is |
32 | * just used to track 16G pages and so is a single array. 32-bit | 32 | * just used to track 16G pages and so is a single array. FSL-based |
33 | * implementations may have more than one gpage size due to limitations | 33 | * implementations may have more than one gpage size, so we need multiple |
34 | * of the memory allocators, so we need multiple arrays | 34 | * arrays |
35 | */ | 35 | */ |
36 | #ifdef CONFIG_PPC_FSL_BOOK3E | 36 | #ifdef CONFIG_PPC_FSL_BOOK3E |
37 | #define MAX_NUMBER_GPAGES 128 | 37 | #define MAX_NUMBER_GPAGES 128 |