]> Pileus Git - ~andy/linux/commitdiff
x86, kvm: correctly access the KVM_CPUID_FEATURES leaf at 0x40000101
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 27 Jan 2014 13:51:44 +0000 (14:51 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 29 Jan 2014 17:11:55 +0000 (18:11 +0100)
When Hyper-V hypervisor leaves are present, KVM must relocate
its own leaves at 0x40000100, because Windows does not look for
Hyper-V leaves at indices other than 0x40000000.  In this case,
the KVM features are at 0x40000101, but the old code would always
look at 0x40000001.

Fix by using kvm_cpuid_base().  This also requires making the
function non-inline, since kvm_cpuid_base() is static.

Fixes: 1085ba7f552d84aa8ac0ae903fa8d0cc2ff9f79d
Cc: stable@vger.kernel.org
Cc: mtosatti@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_para.h
arch/x86/kernel/kvm.c

index 1679cc799b2621ff2cba187ee80dffc9fa0ba055..c7678e43465bd64a3750bb912b9abc7984ac54cd 100644 (file)
@@ -85,13 +85,9 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
        return ret;
 }
 
-static inline unsigned int kvm_arch_para_features(void)
-{
-       return cpuid_eax(KVM_CPUID_FEATURES);
-}
-
 #ifdef CONFIG_KVM_GUEST
 bool kvm_para_available(void);
+unsigned int kvm_arch_para_features(void);
 void __init kvm_guest_init(void);
 void kvm_async_pf_task_wait(u32 token);
 void kvm_async_pf_task_wake(u32 token);
@@ -116,6 +112,11 @@ static inline bool kvm_para_available(void)
        return 0;
 }
 
+static inline unsigned int kvm_arch_para_features(void)
+{
+       return 0;
+}
+
 static inline u32 kvm_read_and_reset_pf_reason(void)
 {
        return 0;
index 0823003770fccad450aad1f3858cde8167641c69..f81cadebcc0e64402ee6610a5dc0c57e715db5bf 100644 (file)
@@ -527,6 +527,11 @@ bool kvm_para_available(void)
 }
 EXPORT_SYMBOL_GPL(kvm_para_available);
 
+unsigned int kvm_arch_para_features(void)
+{
+       return cpuid_eax(kvm_cpuid_base() | KVM_CPUID_FEATURES);
+}
+
 static uint32_t __init kvm_detect(void)
 {
        return kvm_cpuid_base();