diff options
author | Becky Bruce <beckyb@kernel.crashing.org> | 2011-10-10 06:50:38 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-12-07 00:26:21 -0500 |
commit | 8c1674de2b42d9d9f14a32445055aa525892c708 (patch) | |
tree | c4d5209abc4d783cb0b4f20b1a17f6cca8f85f87 /arch | |
parent | 97632e6fbea5b996669ffee21d869ed09848e1ec (diff) |
powerpc: Fix booke hugetlb preload code for PPC_MM_SLICES and 64-bit
This patch does 2 things: It corrects the code that determines the
size to write into MAS1 for the PPC_MM_SLICES case (this originally
came from David Gibson and I had incorrectly altered it), and it
changes the methodolody used to calculate the size for !PPC_MM_SLICES
to work for 64-bit as well as 32-bit.
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/mm/hugetlbpage-book3e.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/arch/powerpc/mm/hugetlbpage-book3e.c b/arch/powerpc/mm/hugetlbpage-book3e.c index 343ad0b87261..4d6d849a3e54 100644 --- a/arch/powerpc/mm/hugetlbpage-book3e.c +++ b/arch/powerpc/mm/hugetlbpage-book3e.c | |||
@@ -45,23 +45,20 @@ void book3e_hugetlb_preload(struct mm_struct *mm, unsigned long ea, pte_t pte) | |||
45 | unsigned long flags; | 45 | unsigned long flags; |
46 | 46 | ||
47 | #ifdef CONFIG_PPC_FSL_BOOK3E | 47 | #ifdef CONFIG_PPC_FSL_BOOK3E |
48 | int index, lz, ncams; | 48 | int index, ncams; |
49 | struct vm_area_struct *vma; | ||
50 | #endif | 49 | #endif |
51 | 50 | ||
52 | if (unlikely(is_kernel_addr(ea))) | 51 | if (unlikely(is_kernel_addr(ea))) |
53 | return; | 52 | return; |
54 | 53 | ||
55 | #ifdef CONFIG_PPC_MM_SLICES | 54 | #ifdef CONFIG_PPC_MM_SLICES |
56 | psize = mmu_get_tsize(get_slice_psize(mm, ea)); | 55 | psize = get_slice_psize(mm, ea); |
57 | tsize = mmu_get_psize(psize); | 56 | tsize = mmu_get_tsize(psize); |
58 | shift = mmu_psize_defs[psize].shift; | 57 | shift = mmu_psize_defs[psize].shift; |
59 | #else | 58 | #else |
60 | vma = find_vma(mm, ea); | 59 | psize = vma_mmu_pagesize(find_vma(mm, ea)); |
61 | psize = vma_mmu_pagesize(vma); /* returns actual size in bytes */ | 60 | shift = __ilog2(psize); |
62 | asm (PPC_CNTLZL "%0,%1" : "=r" (lz) : "r" (psize)); | 61 | tsize = shift - 10; |
63 | shift = 31 - lz; | ||
64 | tsize = 21 - lz; | ||
65 | #endif | 62 | #endif |
66 | 63 | ||
67 | /* | 64 | /* |