summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJim Mattson <jmattson@google.com>2022-01-14 21:24:29 -0800
committerPaolo Bonzini <pbonzini@redhat.com>2022-01-19 12:12:03 -0500
commit398f9240f90f4168f5882180723f743f7b682049 (patch)
treed13528d34ad0521e3244bba676ec3832988b2dda /tools
parent21066101f42cfd86fdd835b70ce0e36c335f5f4d (diff)
downloadlinux-stable-398f9240f90f4168f5882180723f743f7b682049.tar.gz
linux-stable-398f9240f90f4168f5882180723f743f7b682049.tar.bz2
linux-stable-398f9240f90f4168f5882180723f743f7b682049.zip
selftests: kvm/x86: Export x86_family() for use outside of processor.c
Move this static inline function to processor.h, so that it can be used in individual tests, as needed. Opportunistically replace the bare 'unsigned' with 'unsigned int.' Signed-off-by: Jim Mattson <jmattson@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20220115052431.447232-5-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.h12
-rw-r--r--tools/testing/selftests/kvm/lib/x86_64/processor.c12
2 files changed, 12 insertions, 12 deletions
diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h
index e82c44aa029a..4eb73959ce05 100644
--- a/tools/testing/selftests/kvm/include/x86_64/processor.h
+++ b/tools/testing/selftests/kvm/include/x86_64/processor.h
@@ -366,6 +366,18 @@ static inline unsigned long get_xmm(int n)
bool is_intel_cpu(void);
bool is_amd_cpu(void);
+static inline unsigned int x86_family(unsigned int eax)
+{
+ unsigned int x86;
+
+ x86 = (eax >> 8) & 0xf;
+
+ if (x86 == 0xf)
+ x86 += (eax >> 20) & 0xff;
+
+ return x86;
+}
+
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);
diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
index 6bf01ded3776..59dcfe1967cc 100644
--- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
+++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
@@ -1516,18 +1516,6 @@ struct kvm_cpuid2 *vcpu_get_supported_hv_cpuid(struct kvm_vm *vm, uint32_t vcpui
return cpuid;
}
-static inline unsigned x86_family(unsigned int eax)
-{
- unsigned int x86;
-
- x86 = (eax >> 8) & 0xf;
-
- if (x86 == 0xf)
- x86 += (eax >> 20) & 0xff;
-
- return x86;
-}
-
unsigned long vm_compute_max_gfn(struct kvm_vm *vm)
{
const unsigned long num_ht_pages = 12 << (30 - vm->page_shift); /* 12 GiB */