powerpc/kexec_file: Use current CPU info while setting up FDT
authorSourabh Jain <sourabhjain@linux.ibm.com>
Thu, 29 Apr 2021 06:02:56 +0000 (11:32 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 4 May 2021 12:26:57 +0000 (22:26 +1000)
commit40c753993e3aad51a12c21233486e2037417a4d6
tree34703cb2fc18b6f738475e8495e2ffa34fc434b1
parent8abddd968a303db75e4debe77a3df484164f1f33
powerpc/kexec_file: Use current CPU info while setting up FDT

kexec_file_load() uses initial_boot_params in setting up the device tree
for the kernel to be loaded. Though initial_boot_params holds info about
CPUs at the time of boot, it doesn't account for hot added CPUs.

So, kexec'ing with kexec_file_load() syscall leaves the kexec'ed kernel
with inaccurate CPU info.

If kdump kernel is loaded with kexec_file_load() syscall and the system
crashes on a hot added CPU, the capture kernel hangs failing to identify
the boot CPU, with no output.

To avoid this from happening, extract current CPU info from of_root
device node and use it for setting up the fdt in kexec_file_load case.

Fixes: 6ecd0163d360 ("powerpc/kexec_file: Add appropriate regions for memory reserve map")
Cc: stable@vger.kernel.org # v5.9+
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
Reviewed-by: Hari Bathini <hbathini@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210429060256.199714-1-sourabhjain@linux.ibm.com
arch/powerpc/kexec/file_load_64.c