diff options
author | Liu, Jinsong <jinsong.liu@intel.com> | 2011-11-28 06:55:19 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-12-27 04:22:01 -0500 |
commit | fb215366b3c7320ac25dca766a0152df16534932 (patch) | |
tree | af89c80a04274cc52d488728f7cc1eef53deff5a /arch | |
parent | 00b27a3efb116062ca5a276ad5cb01ea1b80b5f6 (diff) |
KVM: expose latest Intel cpu new features (BMI1/BMI2/FMA/AVX2) to guest
Intel latest cpu add 6 new features, refer http://software.intel.com/file/36945
The new feature cpuid listed as below:
1. FMA CPUID.EAX=01H:ECX.FMA[bit 12]
2. MOVBE CPUID.EAX=01H:ECX.MOVBE[bit 22]
3. BMI1 CPUID.EAX=07H,ECX=0H:EBX.BMI1[bit 3]
4. AVX2 CPUID.EAX=07H,ECX=0H:EBX.AVX2[bit 5]
5. BMI2 CPUID.EAX=07H,ECX=0H:EBX.BMI2[bit 8]
6. LZCNT CPUID.EAX=80000001H:ECX.LZCNT[bit 5]
This patch expose these features to guest.
Among them, FMA/MOVBE/LZCNT has already been defined, MOVBE/LZCNT has
already been exposed.
This patch defines BMI1/AVX2/BMI2, and exposes FMA/BMI1/AVX2/BMI2 to guest.
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/cpufeature.h | 3 | ||||
-rw-r--r-- | arch/x86/kvm/cpuid.c | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index f3444f700f36..17c5d4bdee5e 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
@@ -197,7 +197,10 @@ | |||
197 | 197 | ||
198 | /* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 9 */ | 198 | /* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 9 */ |
199 | #define X86_FEATURE_FSGSBASE (9*32+ 0) /* {RD/WR}{FS/GS}BASE instructions*/ | 199 | #define X86_FEATURE_FSGSBASE (9*32+ 0) /* {RD/WR}{FS/GS}BASE instructions*/ |
200 | #define X86_FEATURE_BMI1 (9*32+ 3) /* 1st group bit manipulation extensions */ | ||
201 | #define X86_FEATURE_AVX2 (9*32+ 5) /* AVX2 instructions */ | ||
200 | #define X86_FEATURE_SMEP (9*32+ 7) /* Supervisor Mode Execution Protection */ | 202 | #define X86_FEATURE_SMEP (9*32+ 7) /* Supervisor Mode Execution Protection */ |
203 | #define X86_FEATURE_BMI2 (9*32+ 8) /* 2nd group bit manipulation extensions */ | ||
201 | #define X86_FEATURE_ERMS (9*32+ 9) /* Enhanced REP MOVSB/STOSB */ | 204 | #define X86_FEATURE_ERMS (9*32+ 9) /* Enhanced REP MOVSB/STOSB */ |
202 | 205 | ||
203 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) | 206 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) |
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 0a332ec5203c..47be763e1b60 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c | |||
@@ -222,7 +222,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, | |||
222 | F(XMM3) | F(PCLMULQDQ) | 0 /* DTES64, MONITOR */ | | 222 | F(XMM3) | F(PCLMULQDQ) | 0 /* DTES64, MONITOR */ | |
223 | 0 /* DS-CPL, VMX, SMX, EST */ | | 223 | 0 /* DS-CPL, VMX, SMX, EST */ | |
224 | 0 /* TM2 */ | F(SSSE3) | 0 /* CNXT-ID */ | 0 /* Reserved */ | | 224 | 0 /* TM2 */ | F(SSSE3) | 0 /* CNXT-ID */ | 0 /* Reserved */ | |
225 | 0 /* Reserved */ | F(CX16) | 0 /* xTPR Update, PDCM */ | | 225 | F(FMA) | F(CX16) | 0 /* xTPR Update, PDCM */ | |
226 | 0 /* Reserved, DCA */ | F(XMM4_1) | | 226 | 0 /* Reserved, DCA */ | F(XMM4_1) | |
227 | F(XMM4_2) | F(X2APIC) | F(MOVBE) | F(POPCNT) | | 227 | F(XMM4_2) | F(X2APIC) | F(MOVBE) | F(POPCNT) | |
228 | 0 /* Reserved*/ | F(AES) | F(XSAVE) | 0 /* OSXSAVE */ | F(AVX) | | 228 | 0 /* Reserved*/ | F(AES) | F(XSAVE) | 0 /* OSXSAVE */ | F(AVX) | |
@@ -242,7 +242,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, | |||
242 | 242 | ||
243 | /* cpuid 7.0.ebx */ | 243 | /* cpuid 7.0.ebx */ |
244 | const u32 kvm_supported_word9_x86_features = | 244 | const u32 kvm_supported_word9_x86_features = |
245 | F(SMEP) | F(FSGSBASE) | F(ERMS); | 245 | F(FSGSBASE) | F(BMI1) | F(AVX2) | F(SMEP) | F(BMI2) | F(ERMS); |
246 | 246 | ||
247 | /* all calls to cpuid_count() should be made on the same cpu */ | 247 | /* all calls to cpuid_count() should be made on the same cpu */ |
248 | get_cpu(); | 248 | get_cpu(); |