summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kvm/lib/kvm_util_internal.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2018-07-26 13:19:23 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2018-08-06 17:32:04 +0200
commitfa3899add1056f209c5b61d0c60cec34775a6781 (patch)
tree4854009f8c106b8b88b7590aeb0b4aae73448a96 /tools/testing/selftests/kvm/lib/kvm_util_internal.h
parent0a505fe6f272c5c1ceebbd266535ad79d9ca6920 (diff)
kvm: selftests: add basic test for state save and restore
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>
Diffstat (limited to 'tools/testing/selftests/kvm/lib/kvm_util_internal.h')
-rw-r--r--tools/testing/selftests/kvm/lib/kvm_util_internal.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/lib/kvm_util_internal.h b/tools/testing/selftests/kvm/lib/kvm_util_internal.h
index cbb40288890a..542ed606b338 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util_internal.h
+++ b/tools/testing/selftests/kvm/lib/kvm_util_internal.h
@@ -43,6 +43,7 @@ struct vcpu {
struct kvm_vm {
int mode;
+ int kvm_fd;
int fd;
unsigned int page_size;
unsigned int page_shift;
@@ -52,6 +53,7 @@ struct kvm_vm {
struct sparsebit *vpages_valid;
struct sparsebit *vpages_mapped;
+ bool has_irqchip;
bool pgd_created;
vm_paddr_t pgd;
vm_vaddr_t gdt;