Skip to content

Commit 38c64df

Browse files
Ben Collinsmaddy-kerneldev
authored andcommitted
kexec: Include kernel-end even without crashkernel
Certain versions of kexec don't even work without kernel-end being added to the device-tree. Add it even if crash-kernel is disabled. Signed-off-by: Ben Collins <bcollins@kernel.org> Reviewed-by: Sourabh Jain <sourabhjain@linux.ibm.com> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/2025042122-inescapable-mandrill-8a5ff2@boujee-and-buff
1 parent af6850a commit 38c64df

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

arch/powerpc/kexec/core.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include <asm/setup.h>
2323
#include <asm/firmware.h>
2424

25+
#define cpu_to_be_ulong __PASTE(cpu_to_be, BITS_PER_LONG)
26+
2527
#ifdef CONFIG_CRASH_DUMP
2628
void machine_crash_shutdown(struct pt_regs *regs)
2729
{
@@ -144,17 +146,10 @@ int __init overlaps_crashkernel(unsigned long start, unsigned long size)
144146
}
145147

146148
/* Values we need to export to the second kernel via the device tree. */
147-
static phys_addr_t kernel_end;
148149
static phys_addr_t crashk_base;
149150
static phys_addr_t crashk_size;
150151
static unsigned long long mem_limit;
151152

152-
static struct property kernel_end_prop = {
153-
.name = "linux,kernel-end",
154-
.length = sizeof(phys_addr_t),
155-
.value = &kernel_end,
156-
};
157-
158153
static struct property crashk_base_prop = {
159154
.name = "linux,crashkernel-base",
160155
.length = sizeof(phys_addr_t),
@@ -173,8 +168,6 @@ static struct property memory_limit_prop = {
173168
.value = &mem_limit,
174169
};
175170

176-
#define cpu_to_be_ulong __PASTE(cpu_to_be, BITS_PER_LONG)
177-
178171
static void __init export_crashk_values(struct device_node *node)
179172
{
180173
/* There might be existing crash kernel properties, but we can't
@@ -198,6 +191,15 @@ static void __init export_crashk_values(struct device_node *node)
198191
mem_limit = cpu_to_be_ulong(memory_limit);
199192
of_update_property(node, &memory_limit_prop);
200193
}
194+
#endif /* CONFIG_CRASH_RESERVE */
195+
196+
static phys_addr_t kernel_end;
197+
198+
static struct property kernel_end_prop = {
199+
.name = "linux,kernel-end",
200+
.length = sizeof(phys_addr_t),
201+
.value = &kernel_end,
202+
};
201203

202204
static int __init kexec_setup(void)
203205
{
@@ -208,16 +210,17 @@ static int __init kexec_setup(void)
208210
return -ENOENT;
209211

210212
/* remove any stale properties so ours can be found */
211-
of_remove_property(node, of_find_property(node, kernel_end_prop.name, NULL));
213+
of_remove_property(node, of_find_property(node, kernel_end_prop.name,
214+
NULL));
212215

213216
/* information needed by userspace when using default_machine_kexec */
214217
kernel_end = cpu_to_be_ulong(__pa(_end));
215218
of_add_property(node, &kernel_end_prop);
216219

220+
#ifdef CONFIG_CRASH_RESERVE
217221
export_crashk_values(node);
218-
222+
#endif
219223
of_node_put(node);
220224
return 0;
221225
}
222226
late_initcall(kexec_setup);
223-
#endif /* CONFIG_CRASH_RESERVE */

0 commit comments

Comments
 (0)