Skip to content

Commit

Permalink
RISC-V: mm: Enable huge page support to kernel_page_present() function
Browse files Browse the repository at this point in the history
Currently kernel_page_present() function doesn't support huge page
detection causes the function to mistakenly return false to the
hibernation core.

Add huge page detection to the function to solve the problem.

Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
Reviewed-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
Reviewed-by: Mason Huo <mason.huo@starfivetech.com>
  • Loading branch information
Sia Jee Heng authored and intel-lab-lkp committed Jan 6, 2023
1 parent e047acd commit c0a75e6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/riscv/mm/pageattr.c
Expand Up @@ -221,14 +221,20 @@ bool kernel_page_present(struct page *page)
p4d = p4d_offset(pgd, addr);
if (!p4d_present(*p4d))
return false;
if (pgtable_l5_enabled && p4d_leaf(*pud))
return true;

pud = pud_offset(p4d, addr);
if (!pud_present(*pud))
return false;
if (pgtable_l4_enabled && pud_leaf(*pud))
return true;

pmd = pmd_offset(pud, addr);
if (!pmd_present(*pmd))
return false;
if (pmd_leaf(*pmd))
return true;

pte = pte_offset_kernel(pmd, addr);
return pte_present(*pte);
Expand Down

0 comments on commit c0a75e6

Please sign in to comment.