@@ -88,6 +88,11 @@ void kvm_osxsave_update_cpuid(struct kvm_vcpu *vcpu, bool set)
guest_cpuid_change(vcpu, 1, 0, X86_FEATURE_OSXSAVE, set);
}
+void kvm_mwait_update_cpuid(struct kvm_vcpu *vcpu, bool set)
+{
+ guest_cpuid_change(vcpu, 1, 0, X86_FEATURE_MWAIT, set);
+}
+
void kvm_apic_base_update_cpuid(struct kvm_vcpu *vcpu, bool set)
{
guest_cpuid_change(vcpu, 1, 0, X86_FEATURE_APIC, set);
@@ -12,6 +12,7 @@
void kvm_osxsave_update_cpuid(struct kvm_vcpu *vcpu, bool set);
void kvm_pke_update_cpuid(struct kvm_vcpu *vcpu, bool set);
void kvm_apic_base_update_cpuid(struct kvm_vcpu *vcpu, bool set);
+void kvm_mwait_update_cpuid(struct kvm_vcpu *vcpu, bool set);
void kvm_xcr0_update_cpuid(struct kvm_vcpu *vcpu);
void kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu);
@@ -2936,8 +2936,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
((vcpu->arch.ia32_misc_enable_msr ^ data) & MSR_IA32_MISC_ENABLE_MWAIT)) {
if (!guest_cpuid_has(vcpu, X86_FEATURE_XMM3))
return 1;
+ kvm_mwait_update_cpuid(vcpu, !!(data & MSR_IA32_MISC_ENABLE_MWAIT));
+
vcpu->arch.ia32_misc_enable_msr = data;
- kvm_update_cpuid_runtime(vcpu);
} else {
vcpu->arch.ia32_misc_enable_msr = data;
}
And let kvm_set_msr_common() call kvm_mwait_update_cpuid() instead of whole kvm_update_cpuid_runtime(). Signed-off-by: Robert Hoo <robert.hu@linux.intel.com> --- arch/x86/kvm/cpuid.c | 5 +++++ arch/x86/kvm/cpuid.h | 1 + arch/x86/kvm/x86.c | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-)