Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1635231 > unrolled thread

[PATCH 4/4] KVM: x86: simplify kvm_mwait_in_guest()

Started byRadim Krčmář <rkrcmar@redhat.com>
First post2017-05-03 21:40 +0200
Last post2017-05-03 21:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4/4] KVM: x86: simplify kvm_mwait_in_guest() Radim Krčmář <rkrcmar@redhat.com> - 2017-05-03 21:40 +0200

#1635231 — [PATCH 4/4] KVM: x86: simplify kvm_mwait_in_guest()

FromRadim Krčmář <rkrcmar@redhat.com>
Date2017-05-03 21:40 +0200
Subject[PATCH 4/4] KVM: x86: simplify kvm_mwait_in_guest()
Message-ID<tD8hX-1fJ-5@gated-at.bofh.it>
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().

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 arch/x86/kvm/x86.h | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index 8ea4e80c24d1..b49add75ea35 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -216,17 +216,9 @@ 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:
-		return !boot_cpu_has_bug(X86_BUG_AMD_E400);
-	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_AMD_E400) &&
+		!boot_cpu_has_bug(X86_BUG_MONITOR);
 }
 
 #endif
-- 
2.12.2

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web