powerpc/book3s: Use config independent helpers for page table walk
Even when we have HugeTLB and THP disabled, kernel linear map can still be mapped with hugepages. This is only an issue with radix translation because hash MMU doesn't map kernel linear range in linux page table and other kernel map areas are not mapped using hugepage. Add config independent helpers and put WARN_ON() when we don't expect things to be mapped via hugepages. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:

committed by
Michael Ellerman

parent
259a948c4b
commit
d6eacedd1f
@@ -309,16 +309,20 @@ EXPORT_SYMBOL(__iounmap_at);
|
||||
/* 4 level page table */
|
||||
struct page *pgd_page(pgd_t pgd)
|
||||
{
|
||||
if (pgd_huge(pgd))
|
||||
if (pgd_is_leaf(pgd)) {
|
||||
VM_WARN_ON(!pgd_huge(pgd));
|
||||
return pte_page(pgd_pte(pgd));
|
||||
}
|
||||
return virt_to_page(pgd_page_vaddr(pgd));
|
||||
}
|
||||
#endif
|
||||
|
||||
struct page *pud_page(pud_t pud)
|
||||
{
|
||||
if (pud_huge(pud))
|
||||
if (pud_is_leaf(pud)) {
|
||||
VM_WARN_ON(!pud_huge(pud));
|
||||
return pte_page(pud_pte(pud));
|
||||
}
|
||||
return virt_to_page(pud_page_vaddr(pud));
|
||||
}
|
||||
|
||||
@@ -328,8 +332,10 @@ struct page *pud_page(pud_t pud)
|
||||
*/
|
||||
struct page *pmd_page(pmd_t pmd)
|
||||
{
|
||||
if (pmd_large(pmd) || pmd_huge(pmd) || pmd_devmap(pmd))
|
||||
if (pmd_is_leaf(pmd)) {
|
||||
VM_WARN_ON(!(pmd_large(pmd) || pmd_huge(pmd) || pmd_devmap(pmd)));
|
||||
return pte_page(pmd_pte(pmd));
|
||||
}
|
||||
return virt_to_page(pmd_page_vaddr(pmd));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user