aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorYang, Wei Y <wei.y.yang@intel.com>2011-06-02 23:14:03 -0400
committerAvi Kivity <avi@redhat.com>2011-07-12 06:16:14 -0400
commit611c120f7486a19e7df2225f875a52ef0b599ae8 (patch)
tree52f8d2ce975953d081bdd1176a4ab32cd548bd48 /arch/x86/kvm/x86.c
parentc68b734fba402b9bfdd49e23b776c42dbeaf1f5b (diff)
KVM: Mask function7 ebx against host capability word9
This patch masks CPUID leaf 7 ebx against host capability word9. Signed-off-by: Yang, Wei <wei.y.yang@intel.com> Signed-off-by: Shan, Haitao <haitao.shan@intel.com> Signed-off-by: Li, Xin <xin.li@intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index ba5cd27b429a..ff4623b1b102 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2359,6 +2359,10 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
2359 F(ACE2) | F(ACE2_EN) | F(PHE) | F(PHE_EN) | 2359 F(ACE2) | F(ACE2_EN) | F(PHE) | F(PHE_EN) |
2360 F(PMM) | F(PMM_EN); 2360 F(PMM) | F(PMM_EN);
2361 2361
2362 /* cpuid 7.0.ebx */
2363 const u32 kvm_supported_word9_x86_features =
2364 F(SMEP);
2365
2362 /* all calls to cpuid_count() should be made on the same cpu */ 2366 /* all calls to cpuid_count() should be made on the same cpu */
2363 get_cpu(); 2367 get_cpu();
2364 do_cpuid_1_ent(entry, function, index); 2368 do_cpuid_1_ent(entry, function, index);
@@ -2393,7 +2397,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
2393 } 2397 }
2394 break; 2398 break;
2395 } 2399 }
2396 /* function 4 and 0xb have additional index. */ 2400 /* function 4 has additional index. */
2397 case 4: { 2401 case 4: {
2398 int i, cache_type; 2402 int i, cache_type;
2399 2403
@@ -2410,8 +2414,22 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
2410 } 2414 }
2411 break; 2415 break;
2412 } 2416 }
2417 case 7: {
2418 entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
2419 /* Mask ebx against host capbability word 9 */
2420 if (index == 0) {
2421 entry->ebx &= kvm_supported_word9_x86_features;
2422 cpuid_mask(&entry->ebx, 9);
2423 } else
2424 entry->ebx = 0;
2425 entry->eax = 0;
2426 entry->ecx = 0;
2427 entry->edx = 0;
2428 break;
2429 }
2413 case 9: 2430 case 9:
2414 break; 2431 break;
2432 /* function 0xb has additional index. */
2415 case 0xb: { 2433 case 0xb: {
2416 int i, level_type; 2434 int i, level_type;
2417 2435