diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2018-01-31 03:41:40 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2018-01-31 04:29:40 -0500 |
commit | 5fa4ec9cb2e6679e2f828033726f758ea314b9c5 (patch) | |
tree | 653f6a261ca8cc1e7042124696a0624181ad1c1c | |
parent | 0092e4346f49558e5fe5a927c6d78d401dc4ed73 (diff) |
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....
Fixes: 0092e4346f49 ("x86/kvm: Support Hyper-V reenlightenment")
Reported-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: kvm@vger.kernel.org
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: "Michael Kelley (EOSG)" <Michael.H.Kelley@microsoft.com>
Cc: Roman Kagan <rkagan@virtuozzo.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: devel@linuxdriverproject.org
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Cathy Avery <cavery@redhat.com>
Cc: Mohammed Gamal <mmorsy@redhat.com>
-rw-r--r-- | arch/x86/kvm/x86.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 879a99987401..cd3b3bc67c5a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -5933,9 +5933,9 @@ static void tsc_khz_changed(void *data) | |||
5933 | __this_cpu_write(cpu_tsc_khz, khz); | 5933 | __this_cpu_write(cpu_tsc_khz, khz); |
5934 | } | 5934 | } |
5935 | 5935 | ||
5936 | #ifdef CONFIG_X86_64 | ||
5936 | static void kvm_hyperv_tsc_notifier(void) | 5937 | static void kvm_hyperv_tsc_notifier(void) |
5937 | { | 5938 | { |
5938 | #ifdef CONFIG_X86_64 | ||
5939 | struct kvm *kvm; | 5939 | struct kvm *kvm; |
5940 | struct kvm_vcpu *vcpu; | 5940 | struct kvm_vcpu *vcpu; |
5941 | int cpu; | 5941 | int cpu; |
@@ -5967,8 +5967,8 @@ static void kvm_hyperv_tsc_notifier(void) | |||
5967 | spin_unlock(&ka->pvclock_gtod_sync_lock); | 5967 | spin_unlock(&ka->pvclock_gtod_sync_lock); |
5968 | } | 5968 | } |
5969 | spin_unlock(&kvm_lock); | 5969 | spin_unlock(&kvm_lock); |
5970 | #endif | ||
5971 | } | 5970 | } |
5971 | #endif | ||
5972 | 5972 | ||
5973 | static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long val, | 5973 | static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long val, |
5974 | void *data) | 5974 | void *data) |
@@ -6256,7 +6256,7 @@ int kvm_arch_init(void *opaque) | |||
6256 | #ifdef CONFIG_X86_64 | 6256 | #ifdef CONFIG_X86_64 |
6257 | pvclock_gtod_register_notifier(&pvclock_gtod_notifier); | 6257 | pvclock_gtod_register_notifier(&pvclock_gtod_notifier); |
6258 | 6258 | ||
6259 | if (x86_hyper_type == X86_HYPER_MS_HYPERV) | 6259 | if (hypervisor_is_type(X86_HYPER_MS_HYPERV)) |
6260 | set_hv_tscchange_cb(kvm_hyperv_tsc_notifier); | 6260 | set_hv_tscchange_cb(kvm_hyperv_tsc_notifier); |
6261 | #endif | 6261 | #endif |
6262 | 6262 | ||
@@ -6271,7 +6271,7 @@ out: | |||
6271 | void kvm_arch_exit(void) | 6271 | void kvm_arch_exit(void) |
6272 | { | 6272 | { |
6273 | #ifdef CONFIG_X86_64 | 6273 | #ifdef CONFIG_X86_64 |
6274 | if (x86_hyper_type == X86_HYPER_MS_HYPERV) | 6274 | if (hypervisor_is_type(X86_HYPER_MS_HYPERV)) |
6275 | clear_hv_tscchange_cb(); | 6275 | clear_hv_tscchange_cb(); |
6276 | #endif | 6276 | #endif |
6277 | kvm_lapic_exit(); | 6277 | kvm_lapic_exit(); |