Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kexec: loongarch: add multi crash kernel segment support
@ 2024-05-20  1:32 Ming Wang
  2024-06-03 18:05 ` Simon Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Ming Wang @ 2024-05-20  1:32 UTC (permalink / raw)
  To: kexec; +Cc: horms, chenhuacai, gaojuxin

Production kernel may reserved multiple crash kernel segments, like:
'crashkernel=4G,high crashkernel=256M,low'.
So we should pass multiple mem=<size>@<address> parameters in capture kernel.

Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
Signed-off-by: Ming Wang <wangming01@loongson.cn>
---
 kexec/arch/loongarch/kexec-loongarch.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/kexec/arch/loongarch/kexec-loongarch.c b/kexec/arch/loongarch/kexec-loongarch.c
index 32a42d2..f00027c 100644
--- a/kexec/arch/loongarch/kexec-loongarch.c
+++ b/kexec/arch/loongarch/kexec-loongarch.c
@@ -289,6 +289,7 @@ int loongarch_load_other_segments(struct kexec_info *info, unsigned long hole_mi
 	unsigned long initrd_min, hole_max;
 	char *initrd_buf = NULL;
 	unsigned long pagesize = getpagesize();
+	int i;
 
 	if (arch_options.command_line) {
 		if (strlen(arch_options.command_line) >
@@ -326,9 +327,11 @@ int loongarch_load_other_segments(struct kexec_info *info, unsigned long hole_mi
 		cmdline_add_elfcorehdr(cmdline, elfcorehdr_mem.start,
 				elfcorehdr_mem.end - elfcorehdr_mem.start + 1);
 
-		cmdline_add_mem(cmdline, crash_reserved_mem[usablemem_rgns.size - 1].start,
-			crash_reserved_mem[usablemem_rgns.size - 1].end -
-			crash_reserved_mem[usablemem_rgns.size - 1].start + 1);
+		for(i = 0;i < usablemem_rgns.size; i++) {
+			cmdline_add_mem(cmdline, crash_reserved_mem[i].start,
+			crash_reserved_mem[i].end -
+			crash_reserved_mem[i].start + 1);
+		}
 	}
 
 	cmdline[sizeof(cmdline) - 1] = 0;

base-commit: 2a3e54e9f734ce08dee20b4ff1bdd5037f1b0193
-- 
2.39.2


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-03 18:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-20  1:32 [PATCH] kexec: loongarch: add multi crash kernel segment support Ming Wang
2024-06-03 18:05 ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox