aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/include
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2018-07-28 18:45:38 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2018-08-06 17:32:03 +0200
commit87ccb7dbb25b28c0003fe4be88ed02289b651f96 (patch)
tree0c2e1b69d44098f74be5fc892517c637233bc500 /tools/testing/selftests/kvm/include
parentkvm: selftests: create a GDT and TSS (diff)
downloadlinux-dev-87ccb7dbb25b28c0003fe4be88ed02289b651f96.tar.xz
linux-dev-87ccb7dbb25b28c0003fe4be88ed02289b651f96.zip
kvm: selftests: actually use all of lib/vmx.c
The allocation of the VMXON and VMCS is currently done twice, in lib/vmx.c and in vmx_tsc_adjust_test.c. Reorganize the code to provide a cleaner and easier to use API to the tests. lib/vmx.c now does the complete setup of the VMX data structures, but does not create the VM or set CPUID. This has to be done by the caller. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/include')
-rw-r--r--tools/testing/selftests/kvm/include/vmx.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/tools/testing/selftests/kvm/include/vmx.h b/tools/testing/selftests/kvm/include/vmx.h
index 6ed8499807fd..9caaf56696a4 100644
--- a/tools/testing/selftests/kvm/include/vmx.h
+++ b/tools/testing/selftests/kvm/include/vmx.h
@@ -486,9 +486,22 @@ static inline uint32_t vmcs_revision(void)
return rdmsr(MSR_IA32_VMX_BASIC);
}
-void prepare_for_vmx_operation(void);
-void prepare_vmcs(void *guest_rip, void *guest_rsp);
-struct kvm_vm *vm_create_default_vmx(uint32_t vcpuid,
- vmx_guest_code_t guest_code);
+struct vmx_pages {
+ void *vmxon_hva;
+ uint64_t vmxon_gpa;
+ void *vmxon;
+
+ void *vmcs_hva;
+ uint64_t vmcs_gpa;
+ void *vmcs;
+
+ void *msr_hva;
+ uint64_t msr_gpa;
+ void *msr;
+};
+
+struct vmx_pages *vcpu_alloc_vmx(struct kvm_vm *vm, vm_vaddr_t *p_vmx_gva);
+bool prepare_for_vmx_operation(struct vmx_pages *vmx);
+void prepare_vmcs(struct vmx_pages *vmx, void *guest_rip, void *guest_rsp);
#endif /* !SELFTEST_KVM_VMX_H */