Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1275213
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/6] kvm: Add accessors for guest CPU's family, model, stepping |
| Date | 2015-11-23 11:20 +0100 |
| Message-ID | <qxWo3-pd-23@gated-at.bofh.it> (permalink) |
| References | <qxWo2-pd-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Borislav Petkov <bp@suse.de>
Those give the family, model and stepping of the guest vcpu.
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
---
arch/x86/kvm/cpuid.h | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
index 06332cb7e7d1..5d47e0d95ef1 100644
--- a/arch/x86/kvm/cpuid.h
+++ b/arch/x86/kvm/cpuid.h
@@ -2,6 +2,7 @@
#define ARCH_X86_KVM_CPUID_H
#include "x86.h"
+#include <asm/cpu.h>
int kvm_update_cpuid(struct kvm_vcpu *vcpu);
struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu,
@@ -170,4 +171,37 @@ static inline bool guest_cpuid_has_nrips(struct kvm_vcpu *vcpu)
}
#undef BIT_NRIPS
+static inline int guest_cpuid_family(struct kvm_vcpu *vcpu)
+{
+ struct kvm_cpuid_entry2 *best;
+
+ best = kvm_find_cpuid_entry(vcpu, 0x1, 0);
+ if (!best)
+ return -1;
+
+ return x86_family(best->eax);
+}
+
+static inline int guest_cpuid_model(struct kvm_vcpu *vcpu)
+{
+ struct kvm_cpuid_entry2 *best;
+
+ best = kvm_find_cpuid_entry(vcpu, 0x1, 0);
+ if (!best)
+ return -1;
+
+ return x86_model(best->eax);
+}
+
+static inline int guest_cpuid_stepping(struct kvm_vcpu *vcpu)
+{
+ struct kvm_cpuid_entry2 *best;
+
+ best = kvm_find_cpuid_entry(vcpu, 0x1, 0);
+ if (!best)
+ return -1;
+
+ return x86_stepping(best->eax);
+}
+
#endif
--
2.3.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/6] tip-queue 2015-11-23 Borislav Petkov <bp@alien8.de> - 2015-11-23 11:20 +0100
[PATCH 1/6] x86/cpu: Unify CPU family, model, stepping calculation Borislav Petkov <bp@alien8.de> - 2015-11-23 11:20 +0100
[tip:x86/cpu] x86/cpu: Unify CPU family, model, stepping calculation tip-bot for Borislav Petkov <tipbot@zytor.com> - 2015-11-24 10:40 +0100
[PATCH 6/6] x86/MSR: Chop off lower 32-bit value Borislav Petkov <bp@alien8.de> - 2015-11-23 11:20 +0100
[tip:x86/cpu] x86/MSR: Chop off lower 32-bit value tip-bot for Borislav Petkov <tipbot@zytor.com> - 2015-11-24 10:40 +0100
[PATCH 2/6] kvm: Add accessors for guest CPU's family, model, stepping Borislav Petkov <bp@alien8.de> - 2015-11-23 11:20 +0100
[tip:x86/cpu] kvm: Add accessors for guest CPU's family, model, stepping tip-bot for Borislav Petkov <tipbot@zytor.com> - 2015-11-24 10:40 +0100
[PATCH 3/6] x86/cpu/amd, kvm: Satisfy guest kernel reads of IC_CFG MSR Borislav Petkov <bp@alien8.de> - 2015-11-23 11:20 +0100
[tip:x86/cpu] x86/cpu/amd, kvm: Satisfy guest kernel reads of IC_CFG MSR tip-bot for Borislav Petkov <tipbot@zytor.com> - 2015-11-24 10:40 +0100
[PATCH 5/6] x86/cpu: Fix MSR value truncation issue Borislav Petkov <bp@alien8.de> - 2015-11-23 11:20 +0100
[tip:x86/cpu] x86/cpu: Fix MSR value truncation issue tip-bot for Borislav Petkov <tipbot@zytor.com> - 2015-11-24 10:40 +0100
csiph-web