[PATCH] MIPS: fix pmd_bad check for huge pmd

From: Hongchen Zhang
Date: Tue May 10 2022 - 06:02:48 EST


a huge pmd is also a bad pmd,so make pmd_bad return 1 when
passed in a huge pmd.

Signed-off-by: Hongchen Zhang <zhanghongchen@xxxxxxxxxxx>
---
arch/mips/include/asm/pgtable-32.h | 6 ------
arch/mips/include/asm/pgtable-64.h | 6 ------
2 files changed, 12 deletions(-)

diff --git a/arch/mips/include/asm/pgtable-32.h b/arch/mips/include/asm/pgtable-32.h
index 95df9c2..252887b 100644
--- a/arch/mips/include/asm/pgtable-32.h
+++ b/arch/mips/include/asm/pgtable-32.h
@@ -129,12 +129,6 @@ static inline int pmd_none(pmd_t pmd)

static inline int pmd_bad(pmd_t pmd)
{
-#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
- /* pmd_huge(pmd) but inline */
- if (unlikely(pmd_val(pmd) & _PAGE_HUGE))
- return 0;
-#endif
-
if (unlikely(pmd_val(pmd) & ~PAGE_MASK))
return 1;

diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h
index 41921ac..ef52812 100644
--- a/arch/mips/include/asm/pgtable-64.h
+++ b/arch/mips/include/asm/pgtable-64.h
@@ -249,12 +249,6 @@ static inline int pmd_none(pmd_t pmd)

static inline int pmd_bad(pmd_t pmd)
{
-#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
- /* pmd_huge(pmd) but inline */
- if (unlikely(pmd_val(pmd) & _PAGE_HUGE))
- return 0;
-#endif
-
if (unlikely(pmd_val(pmd) & ~PAGE_MASK))
return 1;

--
1.8.3.1