[PATCH] mips64: Retrieve MAX_PHYSMEM_BITS from vmcoreinfo

Youling Tang tangyouling at loongson.cn
Sun Feb 21 20:31:33 EST 2021


Add a common feature for architectures to retrieve AX_PHYSMEM_BITS
from vmcoreinfo, which was added by kernel commit 1d50e5d0c505 ("
crash_core, vmcoreinfo: Append 'MAX_PHYSMEM_BITS' to vmcoreinfo").
This makes makedumpfile adaptable for future MAX_PHYSMEM_BITS changes.

Also ensure backward compatibility for kernel versions in which
MAX_PHYSMEM_BITS is not available in vmcoreinfo.

Signed-off-by: Youling Tang <tangyouling at loongson.cn>
---
 arch/mips64.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/mips64.c b/arch/mips64.c
index c968082..d541c3e 100644
--- a/arch/mips64.c
+++ b/arch/mips64.c
@@ -35,9 +35,14 @@ get_phys_base_mips64(void)
 int
 get_machdep_info_mips64(void)
 {
-	info->max_physmem_bits  = _MAX_PHYSMEM_BITS;
 	info->section_size_bits = _SECTION_SIZE_BITS;
 
+	/* Check if we can get MAX_PHYSMEM_BITS from vmcoreinfo */
+	if (NUMBER(MAX_PHYSMEM_BITS) != NOT_FOUND_NUMBER)
+		info->max_physmem_bits = NUMBER(MAX_PHYSMEM_BITS);
+	else
+		info->max_physmem_bits  = _MAX_PHYSMEM_BITS;
+
 	DEBUG_MSG("max_physmem_bits : %lx\n", info->max_physmem_bits);
 	DEBUG_MSG("section_size_bits: %lx\n", info->section_size_bits);
 
-- 
2.1.0




More information about the kexec mailing list