Skip to content

Commit

Permalink
selftests: kvm/x86: Introduce x86_model()
Browse files Browse the repository at this point in the history
Extract the x86 model number from CPUID.01H:EAX.

Signed-off-by: Jim Mattson <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
jsmattsonjr authored and bonzini committed Jan 19, 2022
1 parent 398f924 commit 2ba9047
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/testing/selftests/kvm/include/x86_64/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2ba9047

Please sign in to comment.