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