aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJim Mattson2022-01-14 21:24:30 -0800
committerPaolo Bonzini2022-01-19 12:12:15 -0500
commit2ba9047424fc7243c63ac57f5fdfa754aa895e3c (patch)
tree58faf6f69cea4cc8fc18b94a09d91ea22af06f92 /tools
parent398f9240f90f4168f5882180723f743f7b682049 (diff)
selftests: kvm/x86: Introduce x86_model()
Extract the x86 model number from CPUID.01H:EAX. Signed-off-by: Jim Mattson <jmattson@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20220115052431.447232-6-jmattson@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/kvm/include/x86_64/processor.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h
index 4eb73959ce05..122447827954 100644
--- a/tools/testing/selftests/kvm/include/x86_64/processor.h
+++ b/tools/testing/selftests/kvm/include/x86_64/processor.h
@@ -378,6 +378,11 @@ static inline unsigned int x86_family(unsigned int eax)
return x86;
}
+static inline unsigned int x86_model(unsigned int eax)
+{
+ return ((eax >> 12) & 0xf0) | ((eax >> 4) & 0x0f);
+}
+
struct kvm_x86_state *vcpu_save_state(struct kvm_vm *vm, uint32_t vcpuid);
void vcpu_load_state(struct kvm_vm *vm, uint32_t vcpuid,
struct kvm_x86_state *state);