Skip to contentSkip to conversation

x86/Hyper-V/hv_apic: Build the Hyper-V APIC conditionally

tip:x86/hyperv KY Srinivasan 1 participant 1 message May 20, 2018 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 32 lines

-----Original Message-----
From: tip tree robot <[email protected]>
Sent: Saturday, May 19, 2018 12:40 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Michael Kelley (EOSG) <[email protected]>; [email protected]; KY Srinivasan <[email protected]>
Subject: [tip:x86/hyperv] x86/Hyper-V/hv_apic: Build the Hyper-V APIC conditionally

Commit-ID: 2d2ccf24939cf369f7473c7e4ea309891be91848 Gitweb:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.ker
nel.org%2Ftip%2F2d2ccf24939cf369f7473c7e4ea309891be91848&data=02%7C 01%7Ckys%40microsoft.com%7C4ca32d3abd084c7a96b608d5bdc04fd9%7C72 f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636623556042008674&sdata =F04rsVvpkPMwuzsQF6odQX2jER84S4AYcVQr4CB0yc0%3D&reserved=0

Author:     Thomas Gleixner <[email protected]>
AuthorDate: Sat, 19 May 2018 21:22:48 +0200
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Sat, 19 May 2018 21:34:11 +0200

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.

Quoted 8 lines

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

Thanks Thomas. I was planning to send this patch today after I saw the kbuild robot mail.

Regards,

K. Y

Quoted 70 lines
Fixes 6b48cb5f8347 ("X86/Hyper-V: Enlighten APIC access")
Cc K. Y. Srinivasan <[email protected]>
Cc Michael Kelley <[email protected]>
---
 arch/x86/hyperv/Makefile        | 3 ++-
 arch/x86/hyperv/hv_apic.c       | 6 ------
 arch/x86/include/asm/mshyperv.h | 7 ++++++-
 3 files changed, 8 insertions(+), 8 deletions(-)
arch/x86/hyperv/Makefile +2 -1
index 00ce4df01a09..b173d404e3df 100644
@@ -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
arch/x86/hyperv/hv_apic.c +0 -6
index d3ff6e255924..f68855499391 100644
@@ -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 */
arch/x86/include/asm/mshyperv.h +6 -0
index 9aaa493f5756..997192131b7b 100644
@@ -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; }

arch/x86/include/asm/mshyperv.h +0 -1
@@ -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;