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

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