Starting with kernel 4.12, the hash page table geometry is updated to
accommodate larger VA range. Update here accordingly.
Signed-off-by: Hari Bathini <hbathini(a)linux.vnet.ibm.com>
---
defs.h | 4 ++++
ppc64.c | 18 ++++++++++++++----
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/defs.h b/defs.h
index 18f36b3..0bf718c 100644
--- a/defs.h
+++ b/defs.h
@@ -3895,6 +3895,7 @@ struct efi_memory_desc_t {
#define PUD_INDEX_SIZE_L4_4K 7
#define PGD_INDEX_SIZE_L4_4K 9
#define PUD_INDEX_SIZE_L4_4K_3_7 9
+#define PGD_INDEX_SIZE_L4_4K_4_12 12
#define PTE_INDEX_SIZE_RADIX_4K 9
#define PMD_INDEX_SIZE_RADIX_4K 9
#define PUD_INDEX_SIZE_RADIX_4K 9
@@ -3915,6 +3916,9 @@ struct efi_memory_desc_t {
#define PGD_INDEX_SIZE_L4_64K_3_10 12
#define PMD_INDEX_SIZE_L4_64K_4_6 5
#define PUD_INDEX_SIZE_L4_64K_4_6 5
+#define PMD_INDEX_SIZE_L4_64K_4_12 10
+#define PUD_INDEX_SIZE_L4_64K_4_12 7
+#define PGD_INDEX_SIZE_L4_64K_4_12 8
#define PTE_INDEX_SIZE_RADIX_64K 5
#define PMD_INDEX_SIZE_RADIX_64K 9
#define PUD_INDEX_SIZE_RADIX_64K 9
diff --git a/ppc64.c b/ppc64.c
index 84cec09..727749e 100644
--- a/ppc64.c
+++ b/ppc64.c
@@ -447,10 +447,16 @@ ppc64_init(int when)
} else if (!(machdep->flags & BOOK3E) &&
(THIS_KERNEL_VERSION >= LINUX(4,6,0))) {
m->l1_index_size = PTE_INDEX_SIZE_L4_64K_3_10;
- m->l2_index_size = PMD_INDEX_SIZE_L4_64K_4_6;
- m->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_6;
- m->l4_index_size = PGD_INDEX_SIZE_L4_64K_3_10;
+ if (THIS_KERNEL_VERSION >= LINUX(4,12,0)) {
+ m->l2_index_size = PMD_INDEX_SIZE_L4_64K_4_12;
+ m->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_12;
+ m->l4_index_size = PGD_INDEX_SIZE_L4_64K_4_12;
+ } else {
+ m->l2_index_size = PMD_INDEX_SIZE_L4_64K_4_6;
+ m->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_6;
+ m->l4_index_size = PGD_INDEX_SIZE_L4_64K_3_10;
+ }
} else if (THIS_KERNEL_VERSION >= LINUX(3,10,0)) {
m->l1_index_size = PTE_INDEX_SIZE_L4_64K_3_10;
m->l2_index_size = PMD_INDEX_SIZE_L4_64K_3_10;
@@ -499,7 +505,11 @@ ppc64_init(int when)
m->l3_index_size = PUD_INDEX_SIZE_L4_4K_3_7;
else
m->l3_index_size = PUD_INDEX_SIZE_L4_4K;
- m->l4_index_size = PGD_INDEX_SIZE_L4_4K;
+ if (!(machdep->flags & BOOK3E) &&
+ (THIS_KERNEL_VERSION >= LINUX(4,12,0)))
+ m->l4_index_size = PGD_INDEX_SIZE_L4_4K_4_12;
+ else
+ m->l4_index_size = PGD_INDEX_SIZE_L4_4K;
if (machdep->flags & BOOK3E)
m->pte_rpn_shift = PTE_RPN_SHIFT_L4_BOOK3E_4K;