diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2009-10-26 15:24:31 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-10-30 02:20:58 -0400 |
commit | a4fe3ce7699bfe1bd88f816b55d42d8fe1dac655 (patch) | |
tree | b72c982ffbb9f05d78a952288d60c4dc2d31a4d9 /arch/powerpc/include/asm/mmu-hash64.h | |
parent | a0668cdc154e54bf0c85182e0535eea237d53146 (diff) |
powerpc/mm: Allow more flexible layouts for hugepage pagetables
Currently each available hugepage size uses a slightly different
pagetable layout: that is, the bottem level table of pointers to
hugepages is a different size, and may branch off from the normal page
tables at a different level. Every hugepage aware path that needs to
walk the pagetables must therefore look up the hugepage size from the
slice info first, and work out the correct way to walk the pagetables
accordingly. Future hardware is likely to add more possible hugepage
sizes, more layout options and more mess.
This patch, therefore reworks the handling of hugepage pagetables to
reduce this complexity. In the new scheme, instead of having to
consult the slice mask, pagetable walking code can check a flag in the
PGD/PUD/PMD entries to see where to branch off to hugepage pagetables,
and the entry also contains the information (eseentially hugepage
shift) necessary to then interpret that table without recourse to the
slice mask. This scheme can be extended neatly to handle multiple
levels of self-describing "special" hugepage pagetables, although for
now we assume only one level exists.
This approach means that only the pagetable allocation path needs to
know how the pagetables should be set out. All other (hugepage)
pagetable walking paths can just interpret the structure as they go.
There already was a flag bit in PGD/PUD/PMD entries for hugepage
directory pointers, but it was only used for debug. We alter that
flag bit to instead be a 0 in the MSB to indicate a hugepage pagetable
pointer (normally it would be 1 since the pointer lies in the linear
mapping). This means that asm pagetable walking can test for (and
punt on) hugepage pointers with the same test that checks for
unpopulated page directory entries (beq becomes bge), since hugepage
pointers will always be positive, and normal pointers always negative.
While we're at it, we get rid of the confusing (and grep defeating)
#defining of hugepte_shift to be the same thing as mmu_huge_psizes.
Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include/asm/mmu-hash64.h')
-rw-r--r-- | arch/powerpc/include/asm/mmu-hash64.h | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h index bebe31c2e907..dd50ea15e648 100644 --- a/arch/powerpc/include/asm/mmu-hash64.h +++ b/arch/powerpc/include/asm/mmu-hash64.h | |||
@@ -173,14 +173,6 @@ extern unsigned long tce_alloc_start, tce_alloc_end; | |||
173 | */ | 173 | */ |
174 | extern int mmu_ci_restrictions; | 174 | extern int mmu_ci_restrictions; |
175 | 175 | ||
176 | #ifdef CONFIG_HUGETLB_PAGE | ||
177 | /* | ||
178 | * The page size indexes of the huge pages for use by hugetlbfs | ||
179 | */ | ||
180 | extern unsigned int mmu_huge_psizes[MMU_PAGE_COUNT]; | ||
181 | |||
182 | #endif /* CONFIG_HUGETLB_PAGE */ | ||
183 | |||
184 | /* | 176 | /* |
185 | * This function sets the AVPN and L fields of the HPTE appropriately | 177 | * This function sets the AVPN and L fields of the HPTE appropriately |
186 | * for the page size | 178 | * for the page size |
@@ -254,9 +246,9 @@ extern int __hash_page_64K(unsigned long ea, unsigned long access, | |||
254 | unsigned int local, int ssize); | 246 | unsigned int local, int ssize); |
255 | struct mm_struct; | 247 | struct mm_struct; |
256 | extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap); | 248 | extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap); |
257 | extern int hash_huge_page(struct mm_struct *mm, unsigned long access, | 249 | int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid, |
258 | unsigned long ea, unsigned long vsid, int local, | 250 | pte_t *ptep, unsigned long trap, int local, int ssize, |
259 | unsigned long trap); | 251 | unsigned int shift, unsigned int mmu_psize); |
260 | 252 | ||
261 | extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend, | 253 | extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend, |
262 | unsigned long pstart, unsigned long prot, | 254 | unsigned long pstart, unsigned long prot, |