of: Add a common kexec FDT setup function
authorRob Herring <robh@kernel.org>
Sun, 21 Feb 2021 17:49:22 +0000 (09:49 -0800)
committerRob Herring <robh@kernel.org>
Mon, 8 Mar 2021 19:06:29 +0000 (12:06 -0700)
commitb30be4dc733e5067b56def359b0823f1e54ded8c
tree0442c9d623d1227b980846493dc41d22c7bd9291
parent179350f00e0663cea76af83b843078eebe1bfbf4
of: Add a common kexec FDT setup function

Both arm64 and powerpc do essentially the same FDT /chosen setup for
kexec.  The differences are either omissions that arm64 should have
or additional properties that will be ignored.  The setup code can be
combined and shared by both powerpc and arm64.

The differences relative to the arm64 version:
 - If /chosen doesn't exist, it will be created (should never happen).
 - Any old dtb and initrd reserved memory will be released.
 - The new initrd and elfcorehdr are marked reserved.
 - "linux,booted-from-kexec" is set.

The differences relative to the powerpc version:
 - "kaslr-seed" and "rng-seed" may be set.
 - "linux,elfcorehdr" is set.
 - Any existing "linux,usable-memory-range" is removed.

Combine the code for setting up the /chosen node in the FDT and updating
the memory reservation for kexec, for powerpc and arm64, in
of_kexec_alloc_and_setup_fdt() and move it to "drivers/of/kexec.c".

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
Reviewed-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210221174930.27324-6-nramas@linux.microsoft.com
drivers/of/Makefile
drivers/of/kexec.c [new file with mode: 0644]
include/linux/of.h