aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/pgtable.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>2019-05-14 02:03:00 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2019-07-04 10:43:50 -0400
commitd6eacedd1f0ebf00bdf1c77715d194f7c1036fd4 (patch)
treebf977356cbeb533eb3a4e2d73d4923eba6188be3 /arch/powerpc/mm/pgtable.c
parent259a948c4ba1829ae4a3c31bb6e40ad458a21254 (diff)
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>
Diffstat (limited to 'arch/powerpc/mm/pgtable.c')
-rw-r--r--arch/powerpc/mm/pgtable.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
index 533fc6fa6726..2029e585e5c3 100644
--- a/arch/powerpc/mm/pgtable.c
+++ b/arch/powerpc/mm/pgtable.c
@@ -340,10 +340,11 @@ pte_t *__find_linux_pte(pgd_t *pgdir, unsigned long ea,
340 if (pgd_none(pgd)) 340 if (pgd_none(pgd))
341 return NULL; 341 return NULL;
342 342
343 if (pgd_huge(pgd)) { 343 if (pgd_is_leaf(pgd)) {
344 ret_pte = (pte_t *)pgdp; 344 ret_pte = (pte_t *)pgdp;
345 goto out; 345 goto out;
346 } 346 }
347
347 if (is_hugepd(__hugepd(pgd_val(pgd)))) { 348 if (is_hugepd(__hugepd(pgd_val(pgd)))) {
348 hpdp = (hugepd_t *)&pgd; 349 hpdp = (hugepd_t *)&pgd;
349 goto out_huge; 350 goto out_huge;
@@ -361,14 +362,16 @@ pte_t *__find_linux_pte(pgd_t *pgdir, unsigned long ea,
361 if (pud_none(pud)) 362 if (pud_none(pud))
362 return NULL; 363 return NULL;
363 364
364 if (pud_huge(pud)) { 365 if (pud_is_leaf(pud)) {
365 ret_pte = (pte_t *)pudp; 366 ret_pte = (pte_t *)pudp;
366 goto out; 367 goto out;
367 } 368 }
369
368 if (is_hugepd(__hugepd(pud_val(pud)))) { 370 if (is_hugepd(__hugepd(pud_val(pud)))) {
369 hpdp = (hugepd_t *)&pud; 371 hpdp = (hugepd_t *)&pud;
370 goto out_huge; 372 goto out_huge;
371 } 373 }
374
372 pdshift = PMD_SHIFT; 375 pdshift = PMD_SHIFT;
373 pmdp = pmd_offset(&pud, ea); 376 pmdp = pmd_offset(&pud, ea);
374 pmd = READ_ONCE(*pmdp); 377 pmd = READ_ONCE(*pmdp);
@@ -397,15 +400,12 @@ pte_t *__find_linux_pte(pgd_t *pgdir, unsigned long ea,
397 ret_pte = (pte_t *)pmdp; 400 ret_pte = (pte_t *)pmdp;
398 goto out; 401 goto out;
399 } 402 }
400 /* 403
401 * pmd_large check below will handle the swap pmd pte 404 if (pmd_is_leaf(pmd)) {
402 * we need to do both the check because they are config
403 * dependent.
404 */
405 if (pmd_huge(pmd) || pmd_large(pmd)) {
406 ret_pte = (pte_t *)pmdp; 405 ret_pte = (pte_t *)pmdp;
407 goto out; 406 goto out;
408 } 407 }
408
409 if (is_hugepd(__hugepd(pmd_val(pmd)))) { 409 if (is_hugepd(__hugepd(pmd_val(pmd)))) {
410 hpdp = (hugepd_t *)&pmd; 410 hpdp = (hugepd_t *)&pmd;
411 goto out_huge; 411 goto out_huge;