diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2014-11-21 12:13:26 -0500 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-11-23 12:33:37 -0500 |
commit | b65d6e17fe2239c9b2051727903955d922083fbf (patch) | |
tree | f6073d37ef7a6ab3eb3603cd4fed2a3e2d58cf4d | |
parent | c274e03af70544506cd7214fcc2d4c4376c2c6f4 (diff) |
kvm: x86: mask out XSAVES
This feature is not supported inside KVM guests yet, because we do not emulate
MSR_IA32_XSS. Mask it out.
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | arch/x86/kvm/cpuid.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 20d83217fb1d..a4f5ac46226c 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c | |||
@@ -320,6 +320,10 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, | |||
320 | F(ADX) | F(SMAP) | F(AVX512F) | F(AVX512PF) | F(AVX512ER) | | 320 | F(ADX) | F(SMAP) | F(AVX512F) | F(AVX512PF) | F(AVX512ER) | |
321 | F(AVX512CD); | 321 | F(AVX512CD); |
322 | 322 | ||
323 | /* cpuid 0xD.1.eax */ | ||
324 | const u32 kvm_supported_word10_x86_features = | ||
325 | F(XSAVEOPT) | F(XSAVEC) | F(XGETBV1); | ||
326 | |||
323 | /* all calls to cpuid_count() should be made on the same cpu */ | 327 | /* all calls to cpuid_count() should be made on the same cpu */ |
324 | get_cpu(); | 328 | get_cpu(); |
325 | 329 | ||
@@ -456,13 +460,18 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, | |||
456 | entry->eax &= supported; | 460 | entry->eax &= supported; |
457 | entry->edx &= supported >> 32; | 461 | entry->edx &= supported >> 32; |
458 | entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; | 462 | entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; |
463 | if (!supported) | ||
464 | break; | ||
465 | |||
459 | for (idx = 1, i = 1; idx < 64; ++idx) { | 466 | for (idx = 1, i = 1; idx < 64; ++idx) { |
460 | u64 mask = ((u64)1 << idx); | 467 | u64 mask = ((u64)1 << idx); |
461 | if (*nent >= maxnent) | 468 | if (*nent >= maxnent) |
462 | goto out; | 469 | goto out; |
463 | 470 | ||
464 | do_cpuid_1_ent(&entry[i], function, idx); | 471 | do_cpuid_1_ent(&entry[i], function, idx); |
465 | if (entry[i].eax == 0 || !(supported & mask)) | 472 | if (idx == 1) |
473 | entry[i].eax &= kvm_supported_word10_x86_features; | ||
474 | else if (entry[i].eax == 0 || !(supported & mask)) | ||
466 | continue; | 475 | continue; |
467 | entry[i].flags |= | 476 | entry[i].flags |= |
468 | KVM_CPUID_FLAG_SIGNIFCANT_INDEX; | 477 | KVM_CPUID_FLAG_SIGNIFCANT_INDEX; |