Blame SOURCES/github_28fa7bd0_ppc64_increase_VA_range.patch

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