The commit a72bbec70da2 ("crash: hotplug support for kexec_load()")
introduced a new kexec flag, `KEXEC_UPDATE_ELFCOREHDR`. Kexec tool uses
this flag to indicate kernel that it is safe to modify the elfcorehdr
of kdump image loaded using kexec_load system call.Similarly, add a new kexec flag, `KEXEC_UPDATE_FDT`, for another kdump component named FDT (Flatten Device Tree). Architectures like PowerPC need to update FDT kdump image component on CPU hotplug events. Kexec tool passing `KEXEC_UPDATE_FDT` will be an indication to kernel that FDT segment is not part of SHA calculation hence it is safe to update it. With the `KEXEC_UPDATE_ELFCOREHDR` and `KEXEC_UPDATE_FDT` kexec flags, crash hotplug support can be added to PowerPC for the kexec_load syscall while maintaining the backward compatibility with older kexec tools that do not have these newly introduced flags. Signed-off-by: Sourabh Jain <[email protected]> Cc: Akhil Raj <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Baoquan He <[email protected]> Cc: Borislav Petkov (AMD) <[email protected]> Cc: Boris Ostrovsky <[email protected]> Cc: Christophe Leroy <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Dave Young <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Eric DeVolder <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Hari Bathini <[email protected]> Cc: Laurent Dufour <[email protected]> Cc: Mahesh Salgaonkar <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Mimi Zohar <[email protected]> Cc: Oscar Salvador <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Valentin Schneider <[email protected]> Cc: Vivek Goyal <[email protected]> Cc: [email protected] Cc: [email protected] --- include/linux/kexec.h | 6 ++++-- include/uapi/linux/kexec.h | 1 + kernel/kexec.c | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 0f6ea35879ee..bcedb7625b1f 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -319,6 +319,7 @@ struct kimage { #ifdef CONFIG_CRASH_HOTPLUG /* If set, allow changes to elfcorehdr of kexec_load'd image */ unsigned int update_elfcorehdr:1; + unsigned int update_fdt:1; #endif #ifdef ARCH_HAS_KIMAGE_ARCH @@ -396,9 +397,10 @@ bool kexec_load_permitted(int kexec_image_type); /* List of defined/legal kexec flags */ #ifndef CONFIG_KEXEC_JUMP -#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_UPDATE_ELFCOREHDR) +#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_UPDATE_ELFCOREHDR | KEXEC_UPDATE_FDT) #else -#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT | KEXEC_UPDATE_ELFCOREHDR) +#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT | KEXEC_UPDATE_ELFCOREHDR | \ + KEXEC_UPDATE_FDT) #endif /* List of defined/legal kexec file flags */ diff --git a/include/uapi/linux/kexec.h b/include/uapi/linux/kexec.h index 01766dd839b0..3d5b3d757bed 100644 --- a/include/uapi/linux/kexec.h +++ b/include/uapi/linux/kexec.h @@ -13,6 +13,7 @@ #define KEXEC_ON_CRASH 0x00000001 #define KEXEC_PRESERVE_CONTEXT 0x00000002 #define KEXEC_UPDATE_ELFCOREHDR 0x00000004 +#define KEXEC_UPDATE_FDT 0x00000008 #define KEXEC_ARCH_MASK 0xffff0000 /* diff --git a/kernel/kexec.c b/kernel/kexec.c index 8f35a5a42af8..97eb151cd931 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c @@ -132,6 +132,8 @@ static int do_kexec_load(unsigned long entry, unsigned long nr_segments, #ifdef CONFIG_CRASH_HOTPLUG if (flags & KEXEC_UPDATE_ELFCOREHDR) image->update_elfcorehdr = 1; + if (flags & KEXEC_UPDATE_FDT) + image->update_fdt = 1; #endif ret = machine_kexec_prepare(image); -- 2.41.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
