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

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