Blame SOURCES/kexec-tools-2.0.15-makedumpfile-book3s-ppc64-Lower-the-max-real-address-to-53-bits.patch

06c2a2
From dc28bfc3213960b549bcc70f0d5379a6222d2c60 Mon Sep 17 00:00:00 2001
06c2a2
From: Bhupesh Sharma <bhsharma@redhat.com>
06c2a2
Date: Wed, 13 Sep 2017 05:04:00 +0900
06c2a2
Subject: [PATCH] [PATCH v2] book3s/ppc64: Lower the max real address to 53
06c2a2
 bits for kernels >= v4.11
06c2a2
06c2a2
* Required for kernel 4.11
06c2a2
06c2a2
Kernel commit 2f18d533757da3899f4bedab0b2c051b080079dc lowered the
06c2a2
max real address on ppc64 to 53 bits.
06c2a2
06c2a2
Make similar changes in makedumpfile (on basis of the underlying kernel
06c2a2
version), without which the makedumpfile will fail to create a dumpfile
06c2a2
and instead throw a SEGV fault as shown below on kernels >= v4.11:
06c2a2
06c2a2
 # makedumpfile --split -d 31 -x vmlinux vmcore dumpfile_{1,2,3} 2>&1
06c2a2
06c2a2
 The kernel version is not supported.
06c2a2
 The makedumpfile operation may be incomplete.
06c2a2
 [ 1196.252094] makedumpfile[2367]: unhandled signal 11 at
06c2a2
 00000100f7011ca8 nip 000000001001eecc lr 000000001001f3c0 code 30001
06c2a2
 Segmentation fault
06c2a2
06c2a2
Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com>
06c2a2
---
06c2a2
 arch/ppc64.c   | 8 +++++++-
06c2a2
 makedumpfile.h | 5 +++++
06c2a2
 2 files changed, 12 insertions(+), 1 deletion(-)
06c2a2
06c2a2
diff --git a/makedumpfile-1.6.2/arch/ppc64.c b/makedumpfile-1.6.2/arch/ppc64.c
06c2a2
index bacac778f73c..2f5a0daa16b2 100644
06c2a2
--- a/makedumpfile-1.6.2/arch/ppc64.c
06c2a2
+++ b/makedumpfile-1.6.2/arch/ppc64.c
06c2a2
@@ -307,11 +307,17 @@ ppc64_vmalloc_init(void)
06c2a2
 	}
06c2a2
 
06c2a2
 	info->pte_rpn_mask = PTE_RPN_MASK_DEFAULT;
06c2a2
-	if (info->kernel_version >= KERNEL_VERSION(4, 6, 0)) {
06c2a2
+	if ((info->kernel_version >= KERNEL_VERSION(4, 6, 0)) &&
06c2a2
+	    (info->kernel_version < KERNEL_VERSION(4, 11, 0))) {
06c2a2
 		info->pte_rpn_mask = PTE_RPN_MASK_L4_4_6;
06c2a2
 		info->pte_rpn_shift = PTE_RPN_SHIFT_L4_4_6;
06c2a2
 	}
06c2a2
 
06c2a2
+	if (info->kernel_version >= KERNEL_VERSION(4, 11, 0)) {
06c2a2
+		info->pte_rpn_mask = PTE_RPN_MASK_L4_4_11;
06c2a2
+		info->pte_rpn_shift = PTE_RPN_SHIFT_L4_4_11;
06c2a2
+	}
06c2a2
+
06c2a2
 	/*
06c2a2
 	 * Compute ptrs per each level
06c2a2
 	 */
06c2a2
diff --git a/makedumpfile-1.6.2/makedumpfile.h b/makedumpfile-1.6.2/makedumpfile.h
06c2a2
index 7d81bbcf2234..f4ba02d11f09 100644
06c2a2
--- a/makedumpfile-1.6.2/makedumpfile.h
06c2a2
+++ b/makedumpfile-1.6.2/makedumpfile.h
06c2a2
@@ -692,6 +692,11 @@ unsigned long get_kvbase_arm64(void);
06c2a2
 #define PUD_MASKED_BITS_4_7  0xc0000000000000ffUL
06c2a2
 #define PMD_MASKED_BITS_4_7  0xc0000000000000ffUL
06c2a2
 
06c2a2
+#define PTE_RPN_SIZE_L4_4_11  53
06c2a2
+#define PTE_RPN_MASK_L4_4_11   \
06c2a2
+	(((1UL << PTE_RPN_SIZE_L4_4_11) - 1) & ~((1UL << info->page_shift) - 1))
06c2a2
+#define PTE_RPN_SHIFT_L4_4_11  info->page_shift
06c2a2
+
06c2a2
 /*
06c2a2
  * Supported MMU types
06c2a2
  */
06c2a2
-- 
06c2a2
2.7.4
06c2a2