A common crash hotplug handler is used for both kexec_load and kexec_file_load, which is already implemented in earlier patches while adding support for kexec_file_load. To enable the crash hotplug handler to work for kexec_load case the fdt_index attribute of kimage_arch needs to be populated with index of FDT segment in kexec segment array. After loading kexec segments the FDT segment is identified by looping through all the kexec segments and fdt_index is updated accordingly. Signed-off-by: Sourabh Jain <sourabhjain@xxxxxxxxxxxxx> --- arch/powerpc/kexec/core_64.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/powerpc/kexec/core_64.c b/arch/powerpc/kexec/core_64.c index 6d448b55dfad..373cb46bcc0e 100644 --- a/arch/powerpc/kexec/core_64.c +++ b/arch/powerpc/kexec/core_64.c @@ -74,6 +74,31 @@ int machine_kexec_prepare(struct kimage *image) return 0; } +#if defined(CONFIG_HOTPLUG_CPU) +int machine_kexec_post_load(struct kimage *kimage) +{ + int i; + void *ptr; + unsigned long mem; + + if (kimage->type != KEXEC_TYPE_CRASH) + return 0; + + /* Mark fdt_index invalid */ + kimage->arch.fdt_index = -1; + + for (i = 0; i < kimage->nr_segments; i++) { + mem = kimage->segment[i].mem; + ptr = __va(mem); + + if (ptr && fdt_magic(ptr) == FDT_MAGIC) + kimage->arch.fdt_index = i; + } + + return 0; +} +#endif + /* Called during kexec sequence with MMU off */ static notrace void copy_segments(unsigned long ind) { -- 2.36.1 _______________________________________________ kexec mailing list kexec@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/kexec