From: Zi Yan <zi....@cs.rutgers.edu>

Signed-off-by: Zi Yan <zi....@cs.rutgers.edu>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Ingo Molnar <mi...@redhat.com>
Cc: "Kirill A. Shutemov" <kirill.shute...@linux.intel.com>
Cc: x...@kernel.org
Cc: linux...@kvack.org
---
 arch/x86/include/asm/pgtable-2level.h | 2 ++
 arch/x86/include/asm/pgtable-3level.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/arch/x86/include/asm/pgtable-2level.h 
b/arch/x86/include/asm/pgtable-2level.h
index 685ffe8a0eaf..fba4722ec2c2 100644
--- a/arch/x86/include/asm/pgtable-2level.h
+++ b/arch/x86/include/asm/pgtable-2level.h
@@ -93,6 +93,8 @@ static inline unsigned long pte_bitop(unsigned long value, 
unsigned int rightshi
                                         ((type) << (_PAGE_BIT_PRESENT + 1)) \
                                         | ((offset) << SWP_OFFSET_SHIFT) })
 #define __pte_to_swp_entry(pte)                ((swp_entry_t) { (pte).pte_low 
})
+#define __pmd_to_swp_entry(pmd)                ((swp_entry_t) { 
native_pmd_val(pmd) })
 #define __swp_entry_to_pte(x)          ((pte_t) { .pte = (x).val })
+#define __swp_entry_to_pmd(x)          (native_make_pmd(x.val))
 
 #endif /* _ASM_X86_PGTABLE_2LEVEL_H */
diff --git a/arch/x86/include/asm/pgtable-3level.h 
b/arch/x86/include/asm/pgtable-3level.h
index f24df59c40b2..9b7e3c74fbc0 100644
--- a/arch/x86/include/asm/pgtable-3level.h
+++ b/arch/x86/include/asm/pgtable-3level.h
@@ -246,7 +246,9 @@ static inline pud_t native_pudp_get_and_clear(pud_t *pudp)
 #define __swp_offset(x)                        ((x).val >> 5)
 #define __swp_entry(type, offset)      ((swp_entry_t){(type) | (offset) << 5})
 #define __pte_to_swp_entry(pte)                ((swp_entry_t){ (pte).pte_high 
})
+#define __pmd_to_swp_entry(pmd)                ((swp_entry_t){ (pmd).pmd_high 
})
 #define __swp_entry_to_pte(x)          ((pte_t){ { .pte_high = (x).val } })
+#define __swp_entry_to_pmd(x)          ((pmd_t){ { .pmd_high = (x).val } })
 
 #define gup_get_pte gup_get_pte
 /*
-- 
2.17.0

Reply via email to