[PATCH v4 13/18] KVM: selftests: Add support to get the VM's mode

From: Raghavendra Rao Ananta
Date: Wed Sep 08 2021 - 21:40:52 EST


The host utility functions (in upcoming patches) may
want to know the mode of the VM. Hence, create
vm_get_mode() to return the same.

Signed-off-by: Raghavendra Rao Ananta <rananta@xxxxxxxxxx>
---
tools/testing/selftests/kvm/include/kvm_util.h | 1 +
tools/testing/selftests/kvm/lib/kvm_util.c | 5 +++++
2 files changed, 6 insertions(+)

diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h
index d5d0ca919928..9842bf5e2c2e 100644
--- a/tools/testing/selftests/kvm/include/kvm_util.h
+++ b/tools/testing/selftests/kvm/include/kvm_util.h
@@ -400,5 +400,6 @@ uint64_t get_ucall(struct kvm_vm *vm, uint32_t vcpu_id, struct ucall *uc);
int vm_get_stats_fd(struct kvm_vm *vm);
int vcpu_get_stats_fd(struct kvm_vm *vm, uint32_t vcpuid);
int vm_get_nr_vcpus(struct kvm_vm *vm);
+enum vm_guest_mode vm_get_mode(struct kvm_vm *vm);

#endif /* SELFTEST_KVM_UTIL_H */
diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
index 1b5349b5132f..ad73ca921e2e 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util.c
+++ b/tools/testing/selftests/kvm/lib/kvm_util.c
@@ -2350,3 +2350,8 @@ int vm_get_nr_vcpus(struct kvm_vm *vm)
{
return vm->nr_vcpus;
}
+
+enum vm_guest_mode vm_get_mode(struct kvm_vm *vm)
+{
+ return vm->mode;
+}
--
2.33.0.153.gba50c8fa24-goog