x86/Hyper-V/hv_apic: Build the Hyper-V APIC conditionally
authorThomas Gleixner <tglx@linutronix.de>
Sat, 19 May 2018 19:22:48 +0000 (21:22 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 19 May 2018 19:34:11 +0000 (21:34 +0200)
The Hyper-V APIC code is built when CONFIG_HYPERV is enabled but the actual
code in that file is guarded with CONFIG_X86_64. There is no point in doing
this. Neither is there a point in having the CONFIG_HYPERV guard in there
because the containing directory is not built when CONFIG_HYPERV=n.

Further for the hv_init_apic() function a stub is provided only for
CONFIG_HYPERV=n, which is pointless as the callsite is not compiled at
all. But for X86_32 the stub is missing and the build fails.

Clean that up:

  - Compile hv_apic.c only when CONFIG_X86_64=y
  - Make the stub for hv_init_apic() available when CONFG_X86_64=n

Fixes: 6b48cb5f8347 ("X86/Hyper-V: Enlighten APIC access")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Michael Kelley <mikelley@microsoft.com>
arch/x86/hyperv/Makefile
arch/x86/hyperv/hv_apic.c
arch/x86/include/asm/mshyperv.h

index 00ce4df01a09979cce0eff157e225b07fbd4aa47..b173d404e3df0e070dde4d07dbaa04a348217245 100644 (file)
@@ -1 +1,2 @@
-obj-y          := hv_init.o mmu.o hv_apic.o
+obj-y                  := hv_init.o mmu.o
+obj-$(CONFIG_X86_64)   += hv_apic.o
index d3ff6e255924df9b8c559046b28b7158dbd5e945..f68855499391f4637532fa0de4c95ca844e6563e 100644 (file)
@@ -31,9 +31,6 @@
 #include <asm/mshyperv.h>
 #include <asm/apic.h>
 
-#ifdef CONFIG_X86_64
-#if IS_ENABLED(CONFIG_HYPERV)
-
 static struct apic orig_apic;
 
 static u64 hv_apic_icr_read(void)
@@ -257,6 +254,3 @@ void __init hv_apic_init(void)
                apic->icr_read  = hv_apic_icr_read;
        }
 }
-
-#endif /* CONFIG_HYPERV */
-#endif /* CONFIG_X86_64 */
index 9aaa493f57565fbec23bd006db6f1fa2303887fd..997192131b7b864ab73e0e6656c8eaaa6c620a56 100644 (file)
@@ -302,7 +302,13 @@ void hyperv_reenlightenment_intr(struct pt_regs *regs);
 void set_hv_tscchange_cb(void (*cb)(void));
 void clear_hv_tscchange_cb(void);
 void hyperv_stop_tsc_emulation(void);
+
+#ifdef CONFIG_X86_64
 void hv_apic_init(void);
+#else
+static inline void hv_apic_init(void) {}
+#endif
+
 #else /* CONFIG_HYPERV */
 static inline void hyperv_init(void) {}
 static inline bool hv_is_hyperv_initialized(void) { return false; }
@@ -311,7 +317,6 @@ static inline void hyperv_setup_mmu_ops(void) {}
 static inline void set_hv_tscchange_cb(void (*cb)(void)) {}
 static inline void clear_hv_tscchange_cb(void) {}
 static inline void hyperv_stop_tsc_emulation(void) {};
-static inline void hv_apic_init(void) {}
 static inline struct hv_vp_assist_page *hv_get_vp_assist_page(unsigned int cpu)
 {
        return NULL;