History

x86/kvm: Make it compile on 32bit and with HYPYERVISOR_GUEST=n

The reenlightment support for hyperv slapped a direct reference to x86_hyper_type into the kvm code which results in the following build failure when CONFIG_HYPERVISOR_GUEST=n: arch/x86/kvm/x86.c:6259:6: error: ‘x86_hyper_type’ undeclared (first use in this function) arch/x86/kvm/x86.c:6259:6: note: each undeclared identifier is reported only once for each function it appears in Use the proper helper function to cure that. The 32bit compile fails because of: arch/x86/kvm/x86.c:5936:13: warning: ‘kvm_hyperv_tsc_notifier’ defined but not used [-Wunused-function] which is a real trainwreck engineering artwork. The callsite is wrapped into #ifdef CONFIG_X86_64, but the function itself has the #ifdef inside the function body. Make the function itself wrapped into the ifdef to cure that. Qualiteee....

Thomas Gleixner committed 8 years ago

Commit 5fa4ec91 parent 0092e431 file · +4 −4Browse files

Unified · Split

arch/x86/kvm/x86.c+4−4
@@ -5933,9 +5933,9 @@ static void tsc_khz_changed(void *data) · 5932 unmodified lines
59335933 __this_cpu_write(cpu_tsc_khz, khz);
59345934 }
59355935
5936+#ifdef CONFIG_X86_64
59365937 static void kvm_hyperv_tsc_notifier(void)
59375938 {
5938−#ifdef CONFIG_X86_64
59395939 struct kvm *kvm;
59405940 struct kvm_vcpu *vcpu;
59415941 int cpu;
@@ -5967,8 +5967,8 @@ static void kvm_hyperv_tsc_notifier(void) · 25 unmodified lines
59675967 spin_unlock(&ka->pvclock_gtod_sync_lock);
59685968 }
59695969 spin_unlock(&kvm_lock);
5970−#endif
59715970 }
5971+#endif
59725972
59735973 static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
59745974 void *data)
@@ -6256,7 +6256,7 @@ int kvm_arch_init(void *opaque) · 281 unmodified lines
62566256 #ifdef CONFIG_X86_64
62576257 pvclock_gtod_register_notifier(&pvclock_gtod_notifier);
62586258
6259− if (x86_hyper_type == X86_HYPER_MS_HYPERV)
6259+ if (hypervisor_is_type(X86_HYPER_MS_HYPERV))
62606260 set_hv_tscchange_cb(kvm_hyperv_tsc_notifier);
62616261 #endif
62626262
@@ -6271,7 +6271,7 @@ out: · 8 unmodified lines
62716271 void kvm_arch_exit(void)
62726272 {
62736273 #ifdef CONFIG_X86_64
6274− if (x86_hyper_type == X86_HYPER_MS_HYPERV)
6274+ if (hypervisor_is_type(X86_HYPER_MS_HYPERV))
62756275 clear_hv_tscchange_cb();
62766276 #endif
62776277 kvm_lapic_exit();