[External] [RFC PATCH v1 6/6] arch/x86/mm: create page table mapping for DRAM and NVDIMM both

From: Huaisheng HS1 Ye
Date: Mon May 07 2018 - 22:35:39 EST


Create PTE, PMD, PUD and P4D levels page table mapping for physical
addresses of DRAM and NVDIMM both. Here E820_TYPE_PMEM represents
the region of e820_table.

Signed-off-by: Huaisheng Ye <yehs1@xxxxxxxxxx>
Signed-off-by: Ocean He <hehy1@xxxxxxxxxx>
---
arch/x86/mm/init_64.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index af11a28..c03c2091 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -420,6 +420,10 @@ void __init cleanup_highmap(void)
if (!after_bootmem &&
!e820__mapped_any(paddr & PAGE_MASK, paddr_next,
E820_TYPE_RAM) &&
+#ifdef CONFIG_ZONE_NVM
+ !e820__mapped_any(paddr & PAGE_MASK, paddr_next,
+ E820_TYPE_PMEM) &&
+#endif
!e820__mapped_any(paddr & PAGE_MASK, paddr_next,
E820_TYPE_RESERVED_KERN))
set_pte(pte, __pte(0));
@@ -475,6 +479,10 @@ void __init cleanup_highmap(void)
if (!after_bootmem &&
!e820__mapped_any(paddr & PMD_MASK, paddr_next,
E820_TYPE_RAM) &&
+#ifdef CONFIG_ZONE_NVM
+ !e820__mapped_any(paddr & PAGE_MASK, paddr_next,
+ E820_TYPE_PMEM) &&
+#endif
!e820__mapped_any(paddr & PMD_MASK, paddr_next,
E820_TYPE_RESERVED_KERN))
set_pmd(pmd, __pmd(0));
@@ -561,6 +569,10 @@ void __init cleanup_highmap(void)
if (!after_bootmem &&
!e820__mapped_any(paddr & PUD_MASK, paddr_next,
E820_TYPE_RAM) &&
+#ifdef CONFIG_ZONE_NVM
+ !e820__mapped_any(paddr & PAGE_MASK, paddr_next,
+ E820_TYPE_PMEM) &&
+#endif
!e820__mapped_any(paddr & PUD_MASK, paddr_next,
E820_TYPE_RESERVED_KERN))
set_pud(pud, __pud(0));
@@ -647,6 +659,10 @@ void __init cleanup_highmap(void)
if (!after_bootmem &&
!e820__mapped_any(paddr & P4D_MASK, paddr_next,
E820_TYPE_RAM) &&
+#ifdef CONFIG_ZONE_NVM
+ !e820__mapped_any(paddr & PAGE_MASK, paddr_next,
+ E820_TYPE_PMEM) &&
+#endif
!e820__mapped_any(paddr & P4D_MASK, paddr_next,
E820_TYPE_RESERVED_KERN))
set_p4d(p4d, __p4d(0));
--
1.8.3.1