提交 431f5d44 编写于 作者: R Radim Krčmář 提交者: Paolo Bonzini

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: NAlexander Graf <agraf@suse.de>
Acked-by: NBorislav Petkov <bp@suse.de>
Acked-by: NMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: NRadim Krčmář <rkrcmar@redhat.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 346f48fa
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册