Commit 8c1674de authored by Becky Bruce's avatar Becky Bruce Committed by Benjamin Herrenschmidt

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: default avatarBecky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 97632e6f
...@@ -45,23 +45,20 @@ void book3e_hugetlb_preload(struct mm_struct *mm, unsigned long ea, pte_t pte) ...@@ -45,23 +45,20 @@ void book3e_hugetlb_preload(struct mm_struct *mm, unsigned long ea, pte_t pte)
unsigned long flags; unsigned long flags;
#ifdef CONFIG_PPC_FSL_BOOK3E #ifdef CONFIG_PPC_FSL_BOOK3E
int index, lz, ncams; int index, ncams;
struct vm_area_struct *vma;
#endif #endif
if (unlikely(is_kernel_addr(ea))) if (unlikely(is_kernel_addr(ea)))
return; return;
#ifdef CONFIG_PPC_MM_SLICES #ifdef CONFIG_PPC_MM_SLICES
psize = mmu_get_tsize(get_slice_psize(mm, ea)); psize = get_slice_psize(mm, ea);
tsize = mmu_get_psize(psize); tsize = mmu_get_tsize(psize);
shift = mmu_psize_defs[psize].shift; shift = mmu_psize_defs[psize].shift;
#else #else
vma = find_vma(mm, ea); psize = vma_mmu_pagesize(find_vma(mm, ea));
psize = vma_mmu_pagesize(vma); /* returns actual size in bytes */ shift = __ilog2(psize);
asm (PPC_CNTLZL "%0,%1" : "=r" (lz) : "r" (psize)); tsize = shift - 10;
shift = 31 - lz;
tsize = 21 - lz;
#endif #endif
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment