Starting with kernel v4.7, masked bit values are the same for 4K and
64K pagesizes. This patch updates here accordingly.
Signed-off-by: Hari Bathini <hbathini(a)linux.vnet.ibm.com>
---
defs.h | 4 ++++
ppc64.c | 14 ++++++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/defs.h b/defs.h
index e730be3..142149e 100644
--- a/defs.h
+++ b/defs.h
@@ -3848,6 +3848,10 @@ struct efi_memory_desc_t {
#define PTE_RPN_MASK_L4_4_6 (((1UL << PTE_RPN_SIZE_L4_4_6) - 1) <<
PAGESHIFT())
#define PTE_RPN_SHIFT_L4_4_6 PAGESHIFT()
+#define PGD_MASKED_BITS_4_7 0xc0000000000000ffUL
+#define PUD_MASKED_BITS_4_7 0xc0000000000000ffUL
+#define PMD_MASKED_BITS_4_7 0xc0000000000000ffUL
+
#define PD_HUGE 0x8000000000000000
#define HUGE_PTE_MASK 0x03
#define HUGEPD_SHIFT_MASK 0x3f
diff --git a/ppc64.c b/ppc64.c
index 83ebd16..17c9a19 100644
--- a/ppc64.c
+++ b/ppc64.c
@@ -471,10 +471,16 @@ ppc64_init(int when)
}
m->pte_rpn_mask = PTE_RPN_MASK_DEFAULT;
- if (!(machdep->flags & BOOK3E) &&
- (THIS_KERNEL_VERSION >= LINUX(4,6,0))) {
- m->pte_rpn_mask = PTE_RPN_MASK_L4_4_6;
- m->pte_rpn_shift = PTE_RPN_SHIFT_L4_4_6;
+ if (!(machdep->flags & BOOK3E)) {
+ if (THIS_KERNEL_VERSION >= LINUX(4,6,0)) {
+ m->pte_rpn_mask = PTE_RPN_MASK_L4_4_6;
+ m->pte_rpn_shift = PTE_RPN_SHIFT_L4_4_6;
+ }
+ if (THIS_KERNEL_VERSION >= LINUX(4,7,0)) {
+ m->pgd_masked_bits = PGD_MASKED_BITS_4_7;
+ m->pud_masked_bits = PUD_MASKED_BITS_4_7;
+ m->pmd_masked_bits = PMD_MASKED_BITS_4_7;
+ }
}
/* Compute ptrs per each level */