riscv: mm: make pmd_bad() check leaf condition

In the definition in Documentation/vm/arch_pgtable_helpers.rst,
pmd_bad() means test a non-table mapped PMD, so it should also
return true when it is a leaf page.

Signed-off-by: Nanyong Sun <sunnanyong@huawei.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
This commit is contained in:
Nanyong Sun 2021-04-30 16:28:48 +08:00 committed by Palmer Dabbelt
parent f5397c3ee0
commit 141682f5b9
No known key found for this signature in database
GPG Key ID: 2E1319F35FBB1889

View File

@ -184,7 +184,7 @@ static inline int pmd_none(pmd_t pmd)
static inline int pmd_bad(pmd_t pmd)
{
return !pmd_present(pmd);
return !pmd_present(pmd) || (pmd_val(pmd) & _PAGE_LEAF);
}
#define pmd_leaf pmd_leaf