Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 cpu updates from Ingo Molnar: "The main changes in this cycle were: - Improved CPU ID handling code and related enhancements (Borislav Petkov) - RDRAND fix (Len Brown)" * 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86: Replace RDRAND forced-reseed with simple sanity check x86/MSR: Chop off lower 32-bit value x86/cpu: Fix MSR value truncation issue x86/cpu/amd, kvm: Satisfy guest kernel reads of IC_CFG MSR kvm: Add accessors for guest CPU's family, model, stepping x86/cpu: Unify CPU family, model, stepping calculation
This commit is contained in:
@@ -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,
|
||||
@@ -178,4 +179,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
|
||||
|
Reference in New Issue
Block a user