Linux 3.8-rc7
[cris-mirror.git] / arch / x86 / kvm / cpuid.h
blobb7fd07984888e9f348c04df9043c6596928c1cd3
1 #ifndef ARCH_X86_KVM_CPUID_H
2 #define ARCH_X86_KVM_CPUID_H
4 #include "x86.h"
6 void kvm_update_cpuid(struct kvm_vcpu *vcpu);
7 struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu,
8 u32 function, u32 index);
9 int kvm_dev_ioctl_get_supported_cpuid(struct kvm_cpuid2 *cpuid,
10 struct kvm_cpuid_entry2 __user *entries);
11 int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu,
12 struct kvm_cpuid *cpuid,
13 struct kvm_cpuid_entry __user *entries);
14 int kvm_vcpu_ioctl_set_cpuid2(struct kvm_vcpu *vcpu,
15 struct kvm_cpuid2 *cpuid,
16 struct kvm_cpuid_entry2 __user *entries);
17 int kvm_vcpu_ioctl_get_cpuid2(struct kvm_vcpu *vcpu,
18 struct kvm_cpuid2 *cpuid,
19 struct kvm_cpuid_entry2 __user *entries);
20 void kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx, u32 *ecx, u32 *edx);
23 static inline bool guest_cpuid_has_xsave(struct kvm_vcpu *vcpu)
25 struct kvm_cpuid_entry2 *best;
27 if (!static_cpu_has(X86_FEATURE_XSAVE))
28 return 0;
30 best = kvm_find_cpuid_entry(vcpu, 1, 0);
31 return best && (best->ecx & bit(X86_FEATURE_XSAVE));
34 static inline bool guest_cpuid_has_tsc_adjust(struct kvm_vcpu *vcpu)
36 struct kvm_cpuid_entry2 *best;
38 best = kvm_find_cpuid_entry(vcpu, 7, 0);
39 return best && (best->ebx & bit(X86_FEATURE_TSC_ADJUST));
42 static inline bool guest_cpuid_has_smep(struct kvm_vcpu *vcpu)
44 struct kvm_cpuid_entry2 *best;
46 best = kvm_find_cpuid_entry(vcpu, 7, 0);
47 return best && (best->ebx & bit(X86_FEATURE_SMEP));
50 static inline bool guest_cpuid_has_fsgsbase(struct kvm_vcpu *vcpu)
52 struct kvm_cpuid_entry2 *best;
54 best = kvm_find_cpuid_entry(vcpu, 7, 0);
55 return best && (best->ebx & bit(X86_FEATURE_FSGSBASE));
58 static inline bool guest_cpuid_has_osvw(struct kvm_vcpu *vcpu)
60 struct kvm_cpuid_entry2 *best;
62 best = kvm_find_cpuid_entry(vcpu, 0x80000001, 0);
63 return best && (best->ecx & bit(X86_FEATURE_OSVW));
66 static inline bool guest_cpuid_has_pcid(struct kvm_vcpu *vcpu)
68 struct kvm_cpuid_entry2 *best;
70 best = kvm_find_cpuid_entry(vcpu, 1, 0);
71 return best && (best->ecx & bit(X86_FEATURE_PCID));
74 #endif