diff options
author | Radim Krčmář <rkrcmar@redhat.com> | 2017-11-30 00:23:43 +0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-12-14 11:26:43 +0300 |
commit | 431f5d4443964bcc58ac2e4c6fd8ace6dcd3a8d1 (patch) | |
tree | 4b3faad19cac641eb7e78a3040c06eb1ce816c87 | |
parent | 346f48fa311ceee7478b5b810ba050a4a22e0b2e (diff) | |
download | linux-431f5d4443964bcc58ac2e4c6fd8ace6dcd3a8d1.tar.xz |
KVM: x86: simplify kvm_mwait_in_guest()
If Intel/AMD implements MWAIT, we expect that it works well and only
reject known bugs; no reason to do it the other way around for minor
vendors. (Not that they are relevant ATM.)
This allows further simplification of kvm_mwait_in_guest().
And use boot_cpu_has() instead of "cpu_has(&boot_cpu_data," while at it.
Reviewed-by: Alexander Graf <agraf@suse.de>
Acked-by: Borislav Petkov <bp@suse.de>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | arch/x86/kvm/x86.h | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index d15859ec5e92..c69f973111cb 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h @@ -265,18 +265,8 @@ static inline u64 nsec_to_cycles(struct kvm_vcpu *vcpu, u64 nsec) static inline bool kvm_mwait_in_guest(void) { - if (!cpu_has(&boot_cpu_data, X86_FEATURE_MWAIT)) - return false; - - switch (boot_cpu_data.x86_vendor) { - case X86_VENDOR_AMD: - /* All AMD CPUs have a working MWAIT implementation */ - return true; - case X86_VENDOR_INTEL: - return !boot_cpu_has_bug(X86_BUG_MONITOR); - default: - return false; - } + return boot_cpu_has(X86_FEATURE_MWAIT) && + !boot_cpu_has_bug(X86_BUG_MONITOR); } #endif |