Blame SOURCES/github_28fa7bd0_ppc64_increase_VA_range.patch

474a44
commit 28fa7bd09013455b5ddc020dea4706278cda0d65
474a44
Author: Dave Anderson <anderson@redhat.com>
474a44
Date:   Tue Jun 19 16:31:54 2018 -0400
474a44
474a44
    Fix for PPC64 kernel virtual address translation in Linux 4.17 and
474a44
    later kernels with commit c2b4d8b7417a59b7f9a52d0d8402f5257cbbd398,
474a44
    titled "powerpc/mm/hash64: Increase the VA range", in which the
474a44
    maximum virtual address value has been increased to 4PB.  Without
474a44
    the patch, the translation/access of high vmalloc space addresses
474a44
    fails; for example, the "kmem -[sS]" option fails the translation
474a44
    of per-cpu kmem_cache_cpu addresses located in vmalloc space, with
474a44
    the error messages "kmem: invalid kernel virtual address: <address>
474a44
    type: kmem_cache_cpu.freelist" and "kmem: invalid kernel virtual
474a44
    address: <address>  type: kmem_cache_cpu.page", and the "vtop"
474a44
    command shows the addresses as "(not mapped)".
474a44
    (hbathini@linux.ibm.com)
474a44
474a44
diff --git a/defs.h b/defs.h
474a44
index 6e6f6be..e6e3850 100644
474a44
--- a/defs.h
474a44
+++ b/defs.h
474a44
@@ -3978,6 +3978,7 @@ struct efi_memory_desc_t {
474a44
 #define PMD_INDEX_SIZE_L4_64K_4_12 10
474a44
 #define PUD_INDEX_SIZE_L4_64K_4_12 7
474a44
 #define PGD_INDEX_SIZE_L4_64K_4_12 8
474a44
+#define PUD_INDEX_SIZE_L4_64K_4_17 10
474a44
 #define PTE_INDEX_SIZE_RADIX_64K  5
474a44
 #define PMD_INDEX_SIZE_RADIX_64K  9
474a44
 #define PUD_INDEX_SIZE_RADIX_64K  9
474a44
diff --git a/ppc64.c b/ppc64.c
474a44
index 0dd8a2a..f5d0dac 100644
474a44
--- a/ppc64.c
474a44
+++ b/ppc64.c
474a44
@@ -451,7 +451,10 @@ ppc64_init(int when)
474a44
 
474a44
 					if (THIS_KERNEL_VERSION >= LINUX(4,12,0)) {
474a44
 						m->l2_index_size = PMD_INDEX_SIZE_L4_64K_4_12;
474a44
-						m->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_12;
474a44
+						if (THIS_KERNEL_VERSION >= LINUX(4,17,0))
474a44
+							m->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_17;
474a44
+						else
474a44
+							m->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_12;
474a44
 						m->l4_index_size = PGD_INDEX_SIZE_L4_64K_4_12;
474a44
 					} else {
474a44
 						m->l2_index_size = PMD_INDEX_SIZE_L4_64K_4_6;