Skip to content

Commit 1e03474

Browse files
vittyvkIngo Molnar
authored andcommitted
x86/hyperv: Fix the build in the !CONFIG_KEXEC_CORE case
Recent changes in the Hyper-V driver: b4370df ("Drivers: hv: vmbus: add special crash handler") broke the build when CONFIG_KEXEC_CORE is not set: arch/x86/built-in.o: In function `hv_machine_crash_shutdown': arch/x86/kernel/cpu/mshyperv.c:112: undefined reference to `native_machine_crash_shutdown' Decorate all kexec related code with #ifdef CONFIG_KEXEC_CORE. Reported-by: Jim Davis <[email protected]> Reported-by: Stephen Hemminger <[email protected]> Signed-off-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: K. Y. Srinivasan <[email protected]> Cc: Haiyang Zhang <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Linus Torvalds <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent a7adb91 commit 1e03474

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

arch/x86/kernel/cpu/mshyperv.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@
3434
struct ms_hyperv_info ms_hyperv;
3535
EXPORT_SYMBOL_GPL(ms_hyperv);
3636

37-
static void (*hv_kexec_handler)(void);
38-
static void (*hv_crash_handler)(struct pt_regs *regs);
39-
4037
#if IS_ENABLED(CONFIG_HYPERV)
4138
static void (*vmbus_handler)(void);
39+
static void (*hv_kexec_handler)(void);
40+
static void (*hv_crash_handler)(struct pt_regs *regs);
4241

4342
void hyperv_vector_handler(struct pt_regs *regs)
4443
{
@@ -96,8 +95,8 @@ void hv_remove_crash_handler(void)
9695
hv_crash_handler = NULL;
9796
}
9897
EXPORT_SYMBOL_GPL(hv_remove_crash_handler);
99-
#endif
10098

99+
#ifdef CONFIG_KEXEC_CORE
101100
static void hv_machine_shutdown(void)
102101
{
103102
if (kexec_in_progress && hv_kexec_handler)
@@ -111,7 +110,8 @@ static void hv_machine_crash_shutdown(struct pt_regs *regs)
111110
hv_crash_handler(regs);
112111
native_machine_crash_shutdown(regs);
113112
}
114-
113+
#endif /* CONFIG_KEXEC_CORE */
114+
#endif /* CONFIG_HYPERV */
115115

116116
static uint32_t __init ms_hyperv_platform(void)
117117
{
@@ -186,8 +186,10 @@ static void __init ms_hyperv_init_platform(void)
186186
no_timer_check = 1;
187187
#endif
188188

189+
#if IS_ENABLED(CONFIG_HYPERV) && defined(CONFIG_KEXEC_CORE)
189190
machine_ops.shutdown = hv_machine_shutdown;
190191
machine_ops.crash_shutdown = hv_machine_crash_shutdown;
192+
#endif
191193
mark_tsc_unstable("running on Hyper-V");
192194
}
193195

0 commit comments

Comments
 (0)