summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/include
Commit message (Collapse)AuthorAgeFilesLines
...
* kvm: selftest: include the tools headersPeter Xu2018-08-221-2/+0
| | | | | | | | Let the kvm selftest include the tools headers, then we can start to use things there like bitmap operations. Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* kvm: selftest: unify the guest port macrosPeter Xu2018-08-221-0/+39
| | | | | | | | | | | | | Most of the tests are using the same way to do guest to host sync but the code is mostly duplicated. Generalize the guest port macros into the common header file and use it in different tests. Meanwhile provide "struct guest_args" and a helper "guest_args_read()" to hide the register details when playing with these port operations on RDI and RSI. Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* KVM: selftests: add tests for shadow VMCS save/restorePaolo Bonzini2018-08-061-0/+12
| | | | | | | This includes setting up the shadow VMCS and the secondary execution controls in lib/vmx.c. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* kvm: selftests: add test for nested state save/restorePaolo Bonzini2018-08-061-0/+33
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* kvm: selftests: add basic test for state save and restorePaolo Bonzini2018-08-062-0/+6
| | | | | | | | | | | | | | | The test calls KVM_RUN repeatedly, and creates an entirely new VM with the old memory and vCPU state on every exit to userspace. The kvm_util API is expanded with two functions that manage the lifetime of a kvm_vm struct: the first closes the file descriptors and leaves the memory allocated, and the second opens the file descriptors and reuses the memory from the previous incarnation of the kvm_vm struct. For now the test is very basic, as it does not test for example XSAVE or vCPU events. However, it will test nested virtualization state starting with the next patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* kvm: selftests: actually use all of lib/vmx.cPaolo Bonzini2018-08-061-4/+17
| | | | | | | | | | 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>
* kvm: selftests: create a GDT and TSSPaolo Bonzini2018-08-062-3/+3
| | | | | | | | | | | | The GDT and the TSS base were left to zero, and this has interesting effects when the TSS descriptor is later read to set up a VMCS's TR_BASE. Basically it worked by chance, and this patch fixes it by setting up all the protected mode data structures properly. Because the GDT and TSS addresses are virtual, the page tables now always exist at the time of vcpu setup. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* KVM: selftests: exit with 0 status code when tests cannot be runPaolo Bonzini2018-05-111-0/+1
| | | | | | | | | | | Right now, skipped tests are returning a failure exit code if /dev/kvm does not exists. Consistently return a zero status code so that various scripts over the interwebs do not complain. Also return a zero status code if the KVM_CAP_SYNC_REGS capability is not present, and hardcode in the test the register kinds that are covered (rather than just using whatever value of KVM_SYNC_X86_VALID_FIELDS is provided by the kernel headers). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* kvm: selftests: add vmx_tsc_adjust_testPaolo Bonzini2018-04-162-6/+503
| | | | | | | | The test checks the behavior of setting MSR_IA32_TSC in a nested guest, and the TSC_OFFSET VMCS field in general. It also introduces the testing infrastructure for Intel nested virtualization. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* kvm: selftests: add sync_regs_testPaolo Bonzini2018-04-041-0/+3
| | | | | | | | This includes the infrastructure to map the test into the guest and run code from the test program inside a VM. Signed-off-by: Ken Hofsass <hofsass@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* kvm: selftests: add API testing infrastructurePaolo Bonzini2018-04-044-0/+1302
Testsuite contributed by Google and cleaned up by myself for inclusion in Linux. Signed-off-by: Ken Hofsass <hofsass@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
OpenPOWER on IntegriCloud