summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/kexec/kexec-tools/0008-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/kexec/kexec-tools/0008-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch')
-rw-r--r--meta/recipes-kernel/kexec/kexec-tools/0008-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch150
1 files changed, 0 insertions, 150 deletions
diff --git a/meta/recipes-kernel/kexec/kexec-tools/0008-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch b/meta/recipes-kernel/kexec/kexec-tools/0008-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch
deleted file mode 100644
index 31c3d8510a..0000000000
--- a/meta/recipes-kernel/kexec/kexec-tools/0008-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch
+++ /dev/null
@@ -1,150 +0,0 @@
1From 23bf7ac189cc3b87ceb9d1d3b69b5c4815354add Mon Sep 17 00:00:00 2001
2From: AKASHI Takahiro <takahiro.akashi@linaro.org>
3Date: Wed, 27 Jan 2016 13:38:39 +0900
4Subject: [PATCH 8/9] arm64: kdump: add DT properties to crash dump kernel's
5 dtb
6
7We pass the following properties to crash dump kernel:
8linux,elfcorehdr: elf core header segment,
9 same as "elfcorehdr=" kernel parameter on other archs
10linux,usable-memory-range: usable memory reserved for crash dump kernel
11
12Upstream-Status: Backport [https://git.linaro.org/people/takahiro.akashi/kexec-tools.git]
13
14Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
15Signed-off-by: He Zhe <zhe.he@windriver.com>
16---
17 kexec/arch/arm64/kexec-arm64.c | 76 +++++++++++++++++++++++++++++++++++---
18 kexec/arch/arm64/kexec-elf-arm64.c | 5 ---
19 2 files changed, 71 insertions(+), 10 deletions(-)
20
21diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
22index 78a0035..a8fb64f 100644
23--- a/kexec/arch/arm64/kexec-arm64.c
24+++ b/kexec/arch/arm64/kexec-arm64.c
25@@ -128,9 +128,6 @@ int arch_process_options(int argc, char **argv)
26 case OPT_INITRD:
27 arm64_opts.initrd = optarg;
28 break;
29- case OPT_PANIC:
30- die("load-panic (-p) not supported");
31- break;
32 default:
33 break; /* Ignore core and unknown options. */
34 }
35@@ -285,8 +282,12 @@ on_success:
36 * setup_2nd_dtb - Setup the 2nd stage kernel's dtb.
37 */
38
39-static int setup_2nd_dtb(struct dtb *dtb, char *command_line)
40+static int setup_2nd_dtb(struct dtb *dtb, char *command_line, int on_crash)
41 {
42+ char *new_buf;
43+ int new_size;
44+ int nodeoffset;
45+ uint64_t range[2];
46 int result;
47
48 result = fdt_check_header(dtb->buf);
49@@ -298,8 +299,72 @@ static int setup_2nd_dtb(struct dtb *dtb, char *command_line)
50
51 result = set_bootargs(dtb, command_line);
52
53+ /* remove those anyway */
54+ nodeoffset = fdt_path_offset(dtb->buf, "/chosen");
55+ fdt_delprop(dtb->buf, nodeoffset, "linux,crashkernel-base");
56+ fdt_delprop(dtb->buf, nodeoffset, "linux,crashkernel-size");
57+
58+ if (on_crash) {
59+ nodeoffset = fdt_path_offset(dtb->buf, "/chosen");
60+ fdt_delprop(dtb->buf, nodeoffset, "linux,elfcorehdr");
61+ fdt_delprop(dtb->buf, nodeoffset, "linux,usable-memory-range");
62+ new_size = fdt_totalsize(dtb->buf)
63+ + 2 * (sizeof(struct fdt_property)
64+ + FDT_TAGALIGN(sizeof(range)))
65+ + strlen("linux,elfcorehdr") + 1
66+ + strlen("linux,usable-memory-range") + 1;
67+
68+ new_buf = xmalloc(new_size);
69+ result = fdt_open_into(dtb->buf, new_buf, new_size);
70+ if (result) {
71+ dbgprintf("%s: fdt_open_into failed: %s\n", __func__,
72+ fdt_strerror(result));
73+ result = -ENOSPC;
74+ goto on_error;
75+ }
76+
77+ range[0] = cpu_to_be64(elfcorehdr_mem.start);
78+ range[1] = cpu_to_be64(elfcorehdr_mem.end
79+ - elfcorehdr_mem.start + 1);
80+ nodeoffset = fdt_path_offset(new_buf, "/chosen");
81+ result = fdt_setprop(new_buf, nodeoffset, "linux,elfcorehdr",
82+ (void *)range, sizeof(range));
83+ if (result) {
84+ dbgprintf("%s: fdt_setprop failed: %s\n", __func__,
85+ fdt_strerror(result));
86+ result = -EINVAL;
87+ goto on_error;
88+ }
89+
90+ range[0] = cpu_to_be64(crash_reserved_mem.start);
91+ range[1] = cpu_to_be64(crash_reserved_mem.end
92+ - crash_reserved_mem.start + 1);
93+ nodeoffset = fdt_path_offset(new_buf, "/chosen");
94+ result = fdt_setprop(new_buf, nodeoffset,
95+ "linux,usable-memory-range",
96+ (void *)range, sizeof(range));
97+ if (result) {
98+ dbgprintf("%s: fdt_setprop failed: %s\n", __func__,
99+ fdt_strerror(result));
100+ result = -EINVAL;
101+ goto on_error;
102+ }
103+
104+ fdt_pack(new_buf);
105+ dtb->buf = new_buf;
106+ dtb->size = fdt_totalsize(new_buf);
107+ }
108+
109 dump_reservemap(dtb);
110
111+
112+ return result;
113+
114+on_error:
115+ fprintf(stderr, "kexec: %s failed.\n", __func__);
116+ if (new_buf)
117+ free(new_buf);
118+
119 return result;
120 }
121
122@@ -366,7 +431,8 @@ int arm64_load_other_segments(struct kexec_info *info,
123 }
124 }
125
126- result = setup_2nd_dtb(&dtb, command_line);
127+ result = setup_2nd_dtb(&dtb, command_line,
128+ info->kexec_flags & KEXEC_ON_CRASH);
129
130 if (result)
131 return -EFAILED;
132diff --git a/kexec/arch/arm64/kexec-elf-arm64.c b/kexec/arch/arm64/kexec-elf-arm64.c
133index 842ce21..b17a31a 100644
134--- a/kexec/arch/arm64/kexec-elf-arm64.c
135+++ b/kexec/arch/arm64/kexec-elf-arm64.c
136@@ -47,11 +47,6 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
137 int result;
138 int i;
139
140- if (info->kexec_flags & KEXEC_ON_CRASH) {
141- fprintf(stderr, "kexec: kdump not yet supported on arm64\n");
142- return -EFAILED;
143- }
144-
145 result = build_elf_exec_info(kernel_buf, kernel_size, &ehdr, 0);
146
147 if (result < 0) {
148--
1491.9.1
150