summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/kvm_para.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2014-01-27 17:49:40 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-06 23:22:14 +0400
commit0f39cea7488daa2f2d77269337597529f047d168 (patch)
tree2b51203355971983b972074b2fe7cef85ff59ec3 /arch/x86/include/asm/kvm_para.h
parent67454c317bc75219d41516419ffe516a6c3e962e (diff)
downloadlinux-0f39cea7488daa2f2d77269337597529f047d168.tar.xz
x86, kvm: cache the base of the KVM cpuid leaves
commit 1c300a40772dae829b91dad634999a6a522c0829 upstream. It is unnecessary to go through hypervisor_cpuid_base every time a leaf is found (which will be every time a feature is requested after the next patch). Fixes: 1085ba7f552d84aa8ac0ae903fa8d0cc2ff9f79d Cc: mtosatti@redhat.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/x86/include/asm/kvm_para.h')
-rw-r--r--arch/x86/include/asm/kvm_para.h22
1 files changed, 6 insertions, 16 deletions
diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h
index 1df115909758..1679cc799b26 100644
--- a/arch/x86/include/asm/kvm_para.h
+++ b/arch/x86/include/asm/kvm_para.h
@@ -85,28 +85,13 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
return ret;
}
-static inline uint32_t kvm_cpuid_base(void)
-{
- if (boot_cpu_data.cpuid_level < 0)
- return 0; /* So we don't blow up on old processors */
-
- if (cpu_has_hypervisor)
- return hypervisor_cpuid_base("KVMKVMKVM\0\0\0", 0);
-
- return 0;
-}
-
-static inline bool kvm_para_available(void)
-{
- return kvm_cpuid_base() != 0;
-}
-
static inline unsigned int kvm_arch_para_features(void)
{
return cpuid_eax(KVM_CPUID_FEATURES);
}
#ifdef CONFIG_KVM_GUEST
+bool kvm_para_available(void);
void __init kvm_guest_init(void);
void kvm_async_pf_task_wait(u32 token);
void kvm_async_pf_task_wake(u32 token);
@@ -126,6 +111,11 @@ static inline void kvm_spinlock_init(void)
#define kvm_async_pf_task_wait(T) do {} while(0)
#define kvm_async_pf_task_wake(T) do {} while(0)
+static inline bool kvm_para_available(void)
+{
+ return 0;
+}
+
static inline u32 kvm_read_and_reset_pf_reason(void)
{
return 0;