Skip to content

Commit 2d2ccf2

Browse files
committed
x86/Hyper-V/hv_apic: Build the Hyper-V APIC conditionally
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: 6b48cb5 ("X86/Hyper-V: Enlighten APIC access") Reported-by: kbuild test robot <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: K. Y. Srinivasan <[email protected]> Cc: Michael Kelley <[email protected]>
1 parent 61eeb1f commit 2d2ccf2

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

arch/x86/hyperv/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
obj-y := hv_init.o mmu.o hv_apic.o
1+
obj-y := hv_init.o mmu.o
2+
obj-$(CONFIG_X86_64) += hv_apic.o

arch/x86/hyperv/hv_apic.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
#include <asm/mshyperv.h>
3232
#include <asm/apic.h>
3333

34-
#ifdef CONFIG_X86_64
35-
#if IS_ENABLED(CONFIG_HYPERV)
36-
3734
static struct apic orig_apic;
3835

3936
static u64 hv_apic_icr_read(void)
@@ -257,6 +254,3 @@ void __init hv_apic_init(void)
257254
apic->icr_read = hv_apic_icr_read;
258255
}
259256
}
260-
261-
#endif /* CONFIG_HYPERV */
262-
#endif /* CONFIG_X86_64 */

arch/x86/include/asm/mshyperv.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,13 @@ void hyperv_reenlightenment_intr(struct pt_regs *regs);
302302
void set_hv_tscchange_cb(void (*cb)(void));
303303
void clear_hv_tscchange_cb(void);
304304
void hyperv_stop_tsc_emulation(void);
305+
306+
#ifdef CONFIG_X86_64
305307
void hv_apic_init(void);
308+
#else
309+
static inline void hv_apic_init(void) {}
310+
#endif
311+
306312
#else /* CONFIG_HYPERV */
307313
static inline void hyperv_init(void) {}
308314
static inline bool hv_is_hyperv_initialized(void) { return false; }
@@ -311,7 +317,6 @@ static inline void hyperv_setup_mmu_ops(void) {}
311317
static inline void set_hv_tscchange_cb(void (*cb)(void)) {}
312318
static inline void clear_hv_tscchange_cb(void) {}
313319
static inline void hyperv_stop_tsc_emulation(void) {};
314-
static inline void hv_apic_init(void) {}
315320
static inline struct hv_vp_assist_page *hv_get_vp_assist_page(unsigned int cpu)
316321
{
317322
return NULL;

0 commit comments

Comments
 (0)