Blame SOURCES/rhelonly-kexec-tools-2.0.20-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch

e39704
From 16028a119c85ed73944bcf6ca310a7ee4d2e64fe Mon Sep 17 00:00:00 2001
e39704
From: Pingfan Liu <piliu@redhat.com>
e39704
Date: Mon, 21 Dec 2020 13:35:38 +0800
e39704
Subject: [PATCH] RHEL-only
e39704
e39704
---
e39704
 arch/arm64.c   | 14 +++++++++++++-
e39704
 makedumpfile.c |  2 ++
e39704
 makedumpfile.h |  1 +
e39704
 3 files changed, 16 insertions(+), 1 deletion(-)
e39704
e39704
diff --git a/makedumpfile-1.6.8/arch/arm64.c b/makedumpfile-1.6.8/arch/arm64.c
e39704
index 3d7b416..c8e7f62 100644
e39704
--- a/makedumpfile-1.6.8/arch/arm64.c
e39704
+++ b/makedumpfile-1.6.8/arch/arm64.c
e39704
@@ -48,6 +48,7 @@ static int lpa_52_bit_support_available;
e39704
 static int pgtable_level;
e39704
 static int va_bits;
e39704
 static unsigned long kimage_voffset;
e39704
+static int max_user_va_bits;
e39704
 
e39704
 #define SZ_4K			4096
e39704
 #define SZ_16K			16384
e39704
@@ -107,7 +108,7 @@ typedef unsigned long pgdval_t;
e39704
 #define PGDIR_SHIFT		ARM64_HW_PGTABLE_LEVEL_SHIFT(4 - (pgtable_level))
e39704
 #define PGDIR_SIZE		(_AC(1, UL) << PGDIR_SHIFT)
e39704
 #define PGDIR_MASK		(~(PGDIR_SIZE-1))
e39704
-#define PTRS_PER_PGD		(1 << ((va_bits) - PGDIR_SHIFT))
e39704
+#define PTRS_PER_PGD           (1 << ((max_user_va_bits) - PGDIR_SHIFT))
e39704
 
e39704
 /*
e39704
  * Section address mask and size definitions.
e39704
@@ -366,6 +367,17 @@ get_machdep_info_arm64(void)
e39704
 		ERRMSG("Can't determine platform config values\n");
e39704
 		return FALSE;
e39704
 	}
e39704
+	if (NUMBER(MAX_USER_VA_BITS) != NOT_FOUND_NUMBER) {
e39704
+		max_user_va_bits = NUMBER(MAX_USER_VA_BITS);
e39704
+		DEBUG_MSG("max_user_va_bits : %d (vmcoreinfo)\n",
e39704
+		                max_user_va_bits);
e39704
+	}
e39704
+	if (!max_user_va_bits) {
e39704
+		max_user_va_bits = va_bits;
e39704
+		DEBUG_MSG("max_user_va_bits : %d (default = va_bits)\n",
e39704
+		                max_user_va_bits);
e39704
+	}
e39704
+
e39704
 
e39704
 	kimage_voffset = NUMBER(kimage_voffset);
e39704
 	info->section_size_bits = SECTIONS_SIZE_BITS;
e39704
diff --git a/makedumpfile-1.6.8/makedumpfile.c b/makedumpfile-1.6.8/makedumpfile.c
e39704
index cdde040..9fd3ae9 100644
e39704
--- a/makedumpfile-1.6.8/makedumpfile.c
e39704
+++ b/makedumpfile-1.6.8/makedumpfile.c
e39704
@@ -2322,6 +2322,7 @@ write_vmcoreinfo_data(void)
e39704
 
e39704
 	WRITE_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR);
e39704
 #ifdef __aarch64__
e39704
+	WRITE_NUMBER("MAX_USER_VA_BITS", MAX_USER_VA_BITS);
e39704
 	WRITE_NUMBER("VA_BITS", VA_BITS);
e39704
 	WRITE_NUMBER_UNSIGNED("PHYS_OFFSET", PHYS_OFFSET);
e39704
 	WRITE_NUMBER_UNSIGNED("kimage_voffset", kimage_voffset);
e39704
@@ -2728,6 +2729,7 @@ read_vmcoreinfo(void)
e39704
 	READ_NUMBER("phys_base", phys_base);
e39704
 	READ_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE);
e39704
 #ifdef __aarch64__
e39704
+	READ_NUMBER("MAX_USER_VA_BITS", MAX_USER_VA_BITS);
e39704
 	READ_NUMBER("VA_BITS", VA_BITS);
e39704
 	READ_NUMBER_UNSIGNED("PHYS_OFFSET", PHYS_OFFSET);
e39704
 	READ_NUMBER_UNSIGNED("kimage_voffset", kimage_voffset);
e39704
diff --git a/makedumpfile-1.6.8/makedumpfile.h b/makedumpfile-1.6.8/makedumpfile.h
e39704
index 698c054..2763a47 100644
e39704
--- a/makedumpfile-1.6.8/makedumpfile.h
e39704
+++ b/makedumpfile-1.6.8/makedumpfile.h
e39704
@@ -1937,6 +1937,7 @@ struct number_table {
e39704
 	long	phys_base;
e39704
 	long	KERNEL_IMAGE_SIZE;
e39704
 #ifdef __aarch64__
e39704
+	long    MAX_USER_VA_BITS;
e39704
 	long 	VA_BITS;
e39704
 	unsigned long	PHYS_OFFSET;
e39704
 	unsigned long	kimage_voffset;
e39704
-- 
e39704
2.21.0
e39704