mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/hyperv: fix build error when CONFIG_KEXEC_CORE is not defined
@ 2015-09-02  6:35 Mike Rapoport
  0 siblings, 0 replies; only message in thread
From: Mike Rapoport @ 2015-09-02  6:35 UTC (permalink / raw)
  To: K. Y. Srinivasan; +Cc: Haiyang Zhang, linux-kernel, Mike Rapoport

When CONFIG_KEXEC_CORE is not enabled, linkage fails with the following error:

  LINK    vmlinux
  LD      vmlinux.o
  MODPOST vmlinux.o
  GEN     .version
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  LD      init/built-in.o
arch/x86/built-in.o: In function `hv_machine_crash_shutdown':
mshyperv.c:(.text+0x10fbb): undefined reference to
`native_machine_crash_shutdown'
make[1]: *** [vmlinux] Error 1

Surrounding crash handling related code in #ifdef CONFIG_KEXEC_CORE resolves
the issue
---
 arch/x86/include/asm/mshyperv.h |  5 +++++
 arch/x86/kernel/cpu/mshyperv.c  | 11 +++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index aaf59b7..359e7ea 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -23,6 +23,11 @@ void hv_remove_vmbus_irq(void);
 
 void hv_setup_kexec_handler(void (*handler)(void));
 void hv_remove_kexec_handler(void);
+#ifdef CONFIG_KEXEC_CORE
 void hv_setup_crash_handler(void (*handler)(struct pt_regs *regs));
 void hv_remove_crash_handler(void);
+#else
+static inline void hv_setup_crash_handler(void (*handler)(struct pt_regs *regs)) {}
+static inline void hv_remove_crash_handler(void) {}
+#endif
 #endif
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 7a2ff7b..a8d1f18 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -35,7 +35,9 @@ struct ms_hyperv_info ms_hyperv;
 EXPORT_SYMBOL_GPL(ms_hyperv);
 
 static void (*hv_kexec_handler)(void);
+#ifdef CONFIG_KEXEC_CORE
 static void (*hv_crash_handler)(struct pt_regs *regs);
+#endif
 
 #if IS_ENABLED(CONFIG_HYPERV)
 static void (*vmbus_handler)(void);
@@ -85,6 +87,7 @@ void hv_remove_kexec_handler(void)
 }
 EXPORT_SYMBOL_GPL(hv_remove_kexec_handler);
 
+#ifdef CONFIG_KEXEC_CORE
 void hv_setup_crash_handler(void (*handler)(struct pt_regs *regs))
 {
 	hv_crash_handler = handler;
@@ -96,7 +99,8 @@ void hv_remove_crash_handler(void)
 	hv_crash_handler = NULL;
 }
 EXPORT_SYMBOL_GPL(hv_remove_crash_handler);
-#endif
+#endif /* CONFIG_KEXEC_CORE */
+#endif /* IS_ENABLED(CONFIG_HYPERV) */
 
 static void hv_machine_shutdown(void)
 {
@@ -105,13 +109,14 @@ static void hv_machine_shutdown(void)
 	native_machine_shutdown();
 }
 
+#ifdef CONFIG_KEXEC_CORE
 static void hv_machine_crash_shutdown(struct pt_regs *regs)
 {
 	if (hv_crash_handler)
 		hv_crash_handler(regs);
 	native_machine_crash_shutdown(regs);
 }
-
+#endif
 
 static uint32_t  __init ms_hyperv_platform(void)
 {
@@ -189,7 +194,9 @@ static void __init ms_hyperv_init_platform(void)
 	mark_tsc_unstable("running on Hyper-V");
 
 	machine_ops.shutdown = hv_machine_shutdown;
+#ifdef CONFIG_KEXEC_CORE
 	machine_ops.crash_shutdown = hv_machine_crash_shutdown;
+#endif
 }
 
 const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-09-02  6:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-02  6:35 [PATCH] x86/hyperv: fix build error when CONFIG_KEXEC_CORE is not defined Mike Rapoport

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®