From f692a3cdebc217c3d2c38faada9444dcf0416731 Mon Sep 17 00:00:00 2001 From: "Yang, Wei Y" Date: Fri, 3 Jun 2011 11:14:03 +0800 Subject: [PATCH] --- yaml --- r: 258031 b: refs/heads/master c: 611c120f7486a19e7df2225f875a52ef0b599ae8 h: refs/heads/master i: 258029: ac41f93cf9bf3c7befdcdda5105c3c8656fe6a75 258027: 95ace9495cdd0fb4ea9c6a0be051fb8a2dab523f 258023: 4cf9cff0c79a851887223b85e2b04ae9c54cc5ae 258015: e9e8c4baf7f74e0ab494a28c389991e80244c571 v: v3 --- [refs] | 2 +- trunk/arch/x86/kvm/x86.c | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 9a57f3e5e4fc..721d062cefd1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c68b734fba402b9bfdd49e23b776c42dbeaf1f5b +refs/heads/master: 611c120f7486a19e7df2225f875a52ef0b599ae8 diff --git a/trunk/arch/x86/kvm/x86.c b/trunk/arch/x86/kvm/x86.c index ba5cd27b429a..ff4623b1b102 100644 --- a/trunk/arch/x86/kvm/x86.c +++ b/trunk/arch/x86/kvm/x86.c @@ -2359,6 +2359,10 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, F(ACE2) | F(ACE2_EN) | F(PHE) | F(PHE_EN) | F(PMM) | F(PMM_EN); + /* cpuid 7.0.ebx */ + const u32 kvm_supported_word9_x86_features = + F(SMEP); + /* all calls to cpuid_count() should be made on the same cpu */ get_cpu(); do_cpuid_1_ent(entry, function, index); @@ -2393,7 +2397,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, } break; } - /* function 4 and 0xb have additional index. */ + /* function 4 has additional index. */ case 4: { int i, cache_type; @@ -2410,8 +2414,22 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, } break; } + case 7: { + entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; + /* Mask ebx against host capbability word 9 */ + if (index == 0) { + entry->ebx &= kvm_supported_word9_x86_features; + cpuid_mask(&entry->ebx, 9); + } else + entry->ebx = 0; + entry->eax = 0; + entry->ecx = 0; + entry->edx = 0; + break; + } case 9: break; + /* function 0xb has additional index. */ case 0xb: { int i, level_type;