~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/kvm/cpuid.h

Version: ~ [ linux-5.3 ] ~ [ linux-5.2.15 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.73 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.144 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.193 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.193 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.73 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef ARCH_X86_KVM_CPUID_H
  2 #define ARCH_X86_KVM_CPUID_H
  3 
  4 #include "x86.h"
  5 
  6 int 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_cpuid(struct kvm_cpuid2 *cpuid,
 10                             struct kvm_cpuid_entry2 __user *entries,
 11                             unsigned int type);
 12 int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu,
 13                              struct kvm_cpuid *cpuid,
 14                              struct kvm_cpuid_entry __user *entries);
 15 int kvm_vcpu_ioctl_set_cpuid2(struct kvm_vcpu *vcpu,
 16                               struct kvm_cpuid2 *cpuid,
 17                               struct kvm_cpuid_entry2 __user *entries);
 18 int kvm_vcpu_ioctl_get_cpuid2(struct kvm_vcpu *vcpu,
 19                               struct kvm_cpuid2 *cpuid,
 20                               struct kvm_cpuid_entry2 __user *entries);
 21 void kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx, u32 *ecx, u32 *edx);
 22 
 23 int cpuid_query_maxphyaddr(struct kvm_vcpu *vcpu);
 24 
 25 static inline int cpuid_maxphyaddr(struct kvm_vcpu *vcpu)
 26 {
 27         return vcpu->arch.maxphyaddr;
 28 }
 29 
 30 static inline bool guest_cpuid_has_xsave(struct kvm_vcpu *vcpu)
 31 {
 32         struct kvm_cpuid_entry2 *best;
 33 
 34         if (!static_cpu_has(X86_FEATURE_XSAVE))
 35                 return false;
 36 
 37         best = kvm_find_cpuid_entry(vcpu, 1, 0);
 38         return best && (best->ecx & bit(X86_FEATURE_XSAVE));
 39 }
 40 
 41 static inline bool guest_cpuid_has_tsc_adjust(struct kvm_vcpu *vcpu)
 42 {
 43         struct kvm_cpuid_entry2 *best;
 44 
 45         best = kvm_find_cpuid_entry(vcpu, 7, 0);
 46         return best && (best->ebx & bit(X86_FEATURE_TSC_ADJUST));
 47 }
 48 
 49 static inline bool guest_cpuid_has_smep(struct kvm_vcpu *vcpu)
 50 {
 51         struct kvm_cpuid_entry2 *best;
 52 
 53         best = kvm_find_cpuid_entry(vcpu, 7, 0);
 54         return best && (best->ebx & bit(X86_FEATURE_SMEP));
 55 }
 56 
 57 static inline bool guest_cpuid_has_smap(struct kvm_vcpu *vcpu)
 58 {
 59         struct kvm_cpuid_entry2 *best;
 60 
 61         best = kvm_find_cpuid_entry(vcpu, 7, 0);
 62         return best && (best->ebx & bit(X86_FEATURE_SMAP));
 63 }
 64 
 65 static inline bool guest_cpuid_has_fsgsbase(struct kvm_vcpu *vcpu)
 66 {
 67         struct kvm_cpuid_entry2 *best;
 68 
 69         best = kvm_find_cpuid_entry(vcpu, 7, 0);
 70         return best && (best->ebx & bit(X86_FEATURE_FSGSBASE));
 71 }
 72 
 73 static inline bool guest_cpuid_has_longmode(struct kvm_vcpu *vcpu)
 74 {
 75         struct kvm_cpuid_entry2 *best;
 76 
 77         best = kvm_find_cpuid_entry(vcpu, 0x80000001, 0);
 78         return best && (best->edx & bit(X86_FEATURE_LM));
 79 }
 80 
 81 static inline bool guest_cpuid_has_osvw(struct kvm_vcpu *vcpu)
 82 {
 83         struct kvm_cpuid_entry2 *best;
 84 
 85         best = kvm_find_cpuid_entry(vcpu, 0x80000001, 0);
 86         return best && (best->ecx & bit(X86_FEATURE_OSVW));
 87 }
 88 
 89 static inline bool guest_cpuid_has_pcid(struct kvm_vcpu *vcpu)
 90 {
 91         struct kvm_cpuid_entry2 *best;
 92 
 93         best = kvm_find_cpuid_entry(vcpu, 1, 0);
 94         return best && (best->ecx & bit(X86_FEATURE_PCID));
 95 }
 96 
 97 static inline bool guest_cpuid_has_x2apic(struct kvm_vcpu *vcpu)
 98 {
 99         struct kvm_cpuid_entry2 *best;
100 
101         best = kvm_find_cpuid_entry(vcpu, 1, 0);
102         return best && (best->ecx & bit(X86_FEATURE_X2APIC));
103 }
104 
105 static inline bool guest_cpuid_is_amd(struct kvm_vcpu *vcpu)
106 {
107         struct kvm_cpuid_entry2 *best;
108 
109         best = kvm_find_cpuid_entry(vcpu, 0, 0);
110         return best && best->ebx == X86EMUL_CPUID_VENDOR_AuthenticAMD_ebx;
111 }
112 
113 static inline bool guest_cpuid_has_gbpages(struct kvm_vcpu *vcpu)
114 {
115         struct kvm_cpuid_entry2 *best;
116 
117         best = kvm_find_cpuid_entry(vcpu, 0x80000001, 0);
118         return best && (best->edx & bit(X86_FEATURE_GBPAGES));
119 }
120 
121 static inline bool guest_cpuid_has_rtm(struct kvm_vcpu *vcpu)
122 {
123         struct kvm_cpuid_entry2 *best;
124 
125         best = kvm_find_cpuid_entry(vcpu, 7, 0);
126         return best && (best->ebx & bit(X86_FEATURE_RTM));
127 }
128 
129 static inline bool guest_cpuid_has_mpx(struct kvm_vcpu *vcpu)
130 {
131         struct kvm_cpuid_entry2 *best;
132 
133         best = kvm_find_cpuid_entry(vcpu, 7, 0);
134         return best && (best->ebx & bit(X86_FEATURE_MPX));
135 }
136 #endif
137 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp