[PATCH] powerpc: Don't overwrite flat device tree with kdump kernel
It's possible for prom_init to allocate the flat device tree inside the kdump crash kernel region. If this happens, when we load the kdump kernel we overwrite the flattened device tree, which is bad. We could make prom_init try and avoid allocating inside the crash kernel region, but then we run into issues if the crash kernel region uses all the space inside the RMO. The easiest solution is to move the flat device tree once we're running in the kernel. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
committed by
Paul Mackerras
parent
b4fd884a03
commit
b68239ee74
@ -1922,3 +1922,30 @@ int prom_update_property(struct device_node *np,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KEXEC
|
||||
/* We may have allocated the flat device tree inside the crash kernel region
|
||||
* in prom_init. If so we need to move it out into regular memory. */
|
||||
void kdump_move_device_tree(void)
|
||||
{
|
||||
unsigned long start, end;
|
||||
struct boot_param_header *new;
|
||||
|
||||
start = __pa((unsigned long)initial_boot_params);
|
||||
end = start + initial_boot_params->totalsize;
|
||||
|
||||
if (end < crashk_res.start || start > crashk_res.end)
|
||||
return;
|
||||
|
||||
new = (struct boot_param_header*)
|
||||
__va(lmb_alloc(initial_boot_params->totalsize, PAGE_SIZE));
|
||||
|
||||
memcpy(new, initial_boot_params, initial_boot_params->totalsize);
|
||||
|
||||
initial_boot_params = new;
|
||||
|
||||
DBG("Flat device tree blob moved to %p\n", initial_boot_params);
|
||||
|
||||
/* XXX should we unreserve the old DT? */
|
||||
}
|
||||
#endif /* CONFIG_KEXEC */
|
||||
|
Reference in New Issue
Block a user