|
|
de80c6 |
From 387de7fa62fbfd78e45aac28b9baf1593e236863 Mon Sep 17 00:00:00 2001
|
|
|
de80c6 |
Message-Id: <387de7fa62fbfd78e45aac28b9baf1593e236863.1429703426.git.panand@redhat.com>
|
|
|
de80c6 |
In-Reply-To: <de1db775d6e9b51f014442677863b57b8566c510.1429703426.git.panand@redhat.com>
|
|
|
de80c6 |
References: <de1db775d6e9b51f014442677863b57b8566c510.1429703426.git.panand@redhat.com>
|
|
|
de80c6 |
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
|
|
de80c6 |
Date: Wed, 22 Apr 2015 11:20:27 +0900
|
|
|
de80c6 |
Subject: [PATCH 12/15] arm64: clean up on crash dump
|
|
|
de80c6 |
|
|
|
de80c6 |
---
|
|
|
de80c6 |
kexec/arch/arm64/crashdump-arm64.c | 12 +++---------
|
|
|
de80c6 |
kexec/arch/arm64/crashdump-arm64.h | 6 +++---
|
|
|
de80c6 |
kexec/arch/arm64/kexec-elf-arm64.c | 9 +++++----
|
|
|
de80c6 |
3 files changed, 11 insertions(+), 16 deletions(-)
|
|
|
de80c6 |
|
|
|
de80c6 |
diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c
|
|
|
de80c6 |
index 04958418ae82..a929b9e3ecb1 100644
|
|
|
de80c6 |
--- a/kexec/arch/arm64/crashdump-arm64.c
|
|
|
de80c6 |
+++ b/kexec/arch/arm64/crashdump-arm64.c
|
|
|
de80c6 |
@@ -288,7 +288,7 @@ int load_crashdump_segments(struct kexec_info *info, char **option)
|
|
|
de80c6 |
return 0;
|
|
|
de80c6 |
}
|
|
|
de80c6 |
|
|
|
de80c6 |
-void modify_ehdr_for_crashmem(struct mem_ehdr *ehdr)
|
|
|
de80c6 |
+void modify_ehdr_for_crashdump(struct mem_ehdr *ehdr)
|
|
|
de80c6 |
{
|
|
|
de80c6 |
struct mem_phdr *phdr;
|
|
|
de80c6 |
int i;
|
|
|
de80c6 |
@@ -304,13 +304,7 @@ void modify_ehdr_for_crashmem(struct mem_ehdr *ehdr)
|
|
|
de80c6 |
}
|
|
|
de80c6 |
}
|
|
|
de80c6 |
|
|
|
de80c6 |
-void set_crash_entry(struct mem_ehdr *ehdr, struct kexec_info *info)
|
|
|
de80c6 |
+void *get_crash_entry(void)
|
|
|
de80c6 |
{
|
|
|
de80c6 |
- info->entry = (void *)crash_reserved_mem.start + arm64_mem.text_offset;
|
|
|
de80c6 |
-}
|
|
|
de80c6 |
-
|
|
|
de80c6 |
-off_t locate_dtb_in_crashmem(struct kexec_info *info, off_t dtb_size)
|
|
|
de80c6 |
-{
|
|
|
de80c6 |
- return locate_hole(info, dtb_size, 128UL * 1024,
|
|
|
de80c6 |
- crash_reserved_mem.start, crash_reserved_mem.end, -1);
|
|
|
de80c6 |
+ return (void *)crash_reserved_mem.start + arm64_mem.text_offset;
|
|
|
de80c6 |
}
|
|
|
de80c6 |
diff --git a/kexec/arch/arm64/crashdump-arm64.h b/kexec/arch/arm64/crashdump-arm64.h
|
|
|
de80c6 |
index d4fd3f2288c9..6457ea7cabec 100644
|
|
|
de80c6 |
--- a/kexec/arch/arm64/crashdump-arm64.h
|
|
|
de80c6 |
+++ b/kexec/arch/arm64/crashdump-arm64.h
|
|
|
de80c6 |
@@ -17,10 +17,10 @@
|
|
|
de80c6 |
#define CRASH_MAX_MEMORY_RANGES 32
|
|
|
de80c6 |
|
|
|
de80c6 |
extern struct memory_ranges usablemem_rgns;
|
|
|
de80c6 |
+extern struct memory_range crash_reserved_mem;
|
|
|
de80c6 |
|
|
|
de80c6 |
int load_crashdump_segments(struct kexec_info *info, char **option);
|
|
|
de80c6 |
-void modify_ehdr_for_crashmem(struct mem_ehdr *ehdr);
|
|
|
de80c6 |
-void set_crash_entry(struct mem_ehdr *ehdr, struct kexec_info *info);
|
|
|
de80c6 |
-off_t locate_dtb_in_crashmem(struct kexec_info *info, off_t dtb_size);
|
|
|
de80c6 |
+void modify_ehdr_for_crashdump(struct mem_ehdr *ehdr);
|
|
|
de80c6 |
+void *get_crash_entry(void);
|
|
|
de80c6 |
|
|
|
de80c6 |
#endif
|
|
|
de80c6 |
diff --git a/kexec/arch/arm64/kexec-elf-arm64.c b/kexec/arch/arm64/kexec-elf-arm64.c
|
|
|
de80c6 |
index f5ecda825278..9fda5e539471 100644
|
|
|
de80c6 |
--- a/kexec/arch/arm64/kexec-elf-arm64.c
|
|
|
de80c6 |
+++ b/kexec/arch/arm64/kexec-elf-arm64.c
|
|
|
de80c6 |
@@ -93,16 +93,17 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
|
|
|
de80c6 |
}
|
|
|
de80c6 |
|
|
|
de80c6 |
if (info->kexec_flags & KEXEC_ON_CRASH) {
|
|
|
de80c6 |
+ /* allocate and initialize elf core header */
|
|
|
de80c6 |
result = load_crashdump_segments(info, &header_option);
|
|
|
de80c6 |
|
|
|
de80c6 |
if (result) {
|
|
|
de80c6 |
fprintf(stderr, "kexec: creating eflcorehdr failed.\n");
|
|
|
de80c6 |
goto exit;
|
|
|
de80c6 |
}
|
|
|
de80c6 |
- }
|
|
|
de80c6 |
|
|
|
de80c6 |
- if (info->kexec_flags & KEXEC_ON_CRASH)
|
|
|
de80c6 |
- modify_ehdr_for_crashmem(&ehdr);
|
|
|
de80c6 |
+ /* offset addresses to load vmlinux(elf_exec) in crash memory */
|
|
|
de80c6 |
+ modify_ehdr_for_crashdump(&ehdr);
|
|
|
de80c6 |
+ }
|
|
|
de80c6 |
|
|
|
de80c6 |
result = elf_exec_load(&ehdr, info);
|
|
|
de80c6 |
|
|
|
de80c6 |
@@ -112,7 +113,7 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
|
|
|
de80c6 |
}
|
|
|
de80c6 |
|
|
|
de80c6 |
if (info->kexec_flags & KEXEC_ON_CRASH)
|
|
|
de80c6 |
- set_crash_entry(&ehdr, info);
|
|
|
de80c6 |
+ info->entry = get_crash_entry();
|
|
|
de80c6 |
else
|
|
|
de80c6 |
info->entry = (void *)virt_to_phys(ehdr.e_entry);
|
|
|
de80c6 |
|
|
|
de80c6 |
--
|
|
|
de80c6 |
2.1.0
|
|
|
de80c6 |
|