Commit 3133287b authored by Alexandre Ghiti's avatar Alexandre Ghiti Committed by Palmer Dabbelt

riscv: Use p*d_leaf macros to define p*d_huge

The newly introduced p*d_leaf macros allow to check if an entry of the
page table map to a physical page instead of the next level. To avoid
duplication of code, use those macros to determine if a page table entry
points to a hugepage.
Suggested-by: default avatarPaul Walmsley <paul.walmsley@sifive.com>
Signed-off-by: default avatarAlexandre Ghiti <alex@ghiti.fr>
Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
parent abc71bf0
...@@ -4,14 +4,12 @@ ...@@ -4,14 +4,12 @@
int pud_huge(pud_t pud) int pud_huge(pud_t pud)
{ {
return pud_present(pud) && return pud_leaf(pud);
(pud_val(pud) & (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC));
} }
int pmd_huge(pmd_t pmd) int pmd_huge(pmd_t pmd)
{ {
return pmd_present(pmd) && return pmd_leaf(pmd);
(pmd_val(pmd) & (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC));
} }
static __init int setup_hugepagesz(char *opt) static __init int setup_hugepagesz(char *opt)
......
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