mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Rapoport <mike.rapoport@gmail.com>
To: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>,
	linux-kernel@vger.kernel.org,
	Mike Rapoport <mike.rapoport@gmail.com>
Subject: [PATCH] x86/hyperv: fix build error when CONFIG_KEXEC_CORE is not defined
Date: Wed,  2 Sep 2015 09:35:06 +0300	[thread overview]
Message-ID: <1441175706-3219-1-git-send-email-mike.rapoport@gmail.com> (raw)

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


                 reply	other threads:[~2015-09-02  6:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441175706-3219-1-git-send-email-mike.rapoport@gmail.com \
    --to=mike.rapoport@gmail.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®