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

21d858
From 0f632fa180e5a44219ab6bbe0879c3583f8c65cf Mon Sep 17 00:00:00 2001
e39704
From: Pingfan Liu <piliu@redhat.com>
21d858
Date: Tue, 9 Nov 2021 11:24:22 +0800
e39704
Subject: [PATCH] RHEL-only
e39704
21d858
Cope with RHEL8 kernel
21d858
21d858
Signed-off-by: Pingfan Liu <piliu@redhat.com>
e39704
---
e39704
 arch/arm64.c   | 14 +++++++++++++-
e39704
 makedumpfile.c |  2 ++
e39704
 makedumpfile.h |  1 +
e39704
 3 files changed, 16 insertions(+), 1 deletion(-)
e39704
21d858
diff --git a/makedumpfile-1.7.0/arch/arm64.c b/makedumpfile-1.7.0/arch/arm64.c
21d858
index 1072178..95beae6 100644
21d858
--- a/makedumpfile-1.7.0/arch/arm64.c
21d858
+++ b/makedumpfile-1.7.0/arch/arm64.c
21d858
@@ -50,6 +50,7 @@ static int va_bits;
21d858
 static int vabits_actual;
21d858
 static int flipped_va;
e39704
 static unsigned long kimage_voffset;
e39704
+static int max_user_va_bits;
e39704
 
e39704
 #define SZ_4K			4096
e39704
 #define SZ_16K			16384
21d858
@@ -108,7 +109,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.
21d858
@@ -449,6 +450,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;
21d858
diff --git a/makedumpfile-1.7.0/makedumpfile.c b/makedumpfile-1.7.0/makedumpfile.c
21d858
index 3ad4443..018ea4c 100644
21d858
--- a/makedumpfile-1.7.0/makedumpfile.c
21d858
+++ b/makedumpfile-1.7.0/makedumpfile.c
21d858
@@ -2417,6 +2417,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);
21d858
 	/* WRITE_NUMBER("TCR_EL1_T1SZ", TCR_EL1_T1SZ); should not exists */
e39704
 	WRITE_NUMBER_UNSIGNED("PHYS_OFFSET", PHYS_OFFSET);
21d858
@@ -2863,6 +2864,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);
21d858
 	READ_NUMBER("TCR_EL1_T1SZ", TCR_EL1_T1SZ);
e39704
 	READ_NUMBER_UNSIGNED("PHYS_OFFSET", PHYS_OFFSET);
21d858
diff --git a/makedumpfile-1.7.0/makedumpfile.h b/makedumpfile-1.7.0/makedumpfile.h
21d858
index e59239d..b6236dd 100644
21d858
--- a/makedumpfile-1.7.0/makedumpfile.h
21d858
+++ b/makedumpfile-1.7.0/makedumpfile.h
21d858
@@ -2064,6 +2064,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;
21d858
 	long	TCR_EL1_T1SZ;
e39704
 	unsigned long	PHYS_OFFSET;
e39704
-- 
21d858
2.31.1
e39704