summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorShradha Gupta <shradhagupta@linux.microsoft.com>2026-10-09 03:22:32 -0700
committerWei Liu <wei.liu@kernel.org>2026-10-21 00:19:40 -0700
commit14c73a2b061e494ab6da346ab075b14f2a4b2d06 (patch)
tree524eedba7a72d153e41ce3b3aa7a9efe83678bd2 /include/linux
parent016ac8174d932db3615534ba15ce5f70b3a15913 (diff)
kexec: Add helper to report an active kexec reboot
A shutdown callback in a loadable module may need to distinguish a kexec reboot from a normal restart, halt, or poweroff. The Hyper-V VMBus driver needs this distinction when moving its kexec cleanup into a common syscore shutdown callback. Add kexec_is_in_progress() and export it to GPL modules so the callback can remain guarded when VMBus is built as a module. Provide a false inline implementation when CONFIG_KEXEC_CORE is disabled. The helper reports only the normal kexec reboot path. Crash kexec and preserve-context kexec do not set this state. Signed-off-by: Shradha Gupta <shradhagupta@linux.microsoft.com> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Reviewed-by: Michael Kelley <mhklinux@outlook.com> Reviewed-by: Bradley Morgan <brads@mainlining.org> Reviewed-by: Naman Jain <namjain@linux.microsoft.com> Signed-off-by: Wei Liu <wei.liu@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/kexec.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 0af8ae4fdd08..aeb74b47c36e 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -468,6 +468,7 @@ bool kexec_load_permitted(int kexec_image_type);
/* flag to track if kexec reboot is in progress */
extern bool kexec_in_progress;
+bool kexec_is_in_progress(void);
#ifndef page_to_boot_pfn
static inline unsigned long page_to_boot_pfn(struct page *page)
@@ -544,6 +545,7 @@ static inline void *kimage_map_segment(struct kimage *image, int idx)
{ return NULL; }
static inline void kimage_unmap_segment(void *buffer) { }
#define kexec_in_progress false
+static inline bool kexec_is_in_progress(void) { return false; }
#endif /* CONFIG_KEXEC_CORE */
#ifdef CONFIG_KEXEC_SIG