summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorVitaly Kuznetsov <vkuznets@redhat.com>2019-01-17 20:12:10 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2019-01-25 21:11:38 +0300
commit35b531a1e7fc30ac8c62e5ac1794eb1460da614e (patch)
treea1db58bd74443f7dd6abf51c31ab127ae827d81f /tools/testing
parent3a2f5773baab34a9943be4c77e1ff2ac79d16c75 (diff)
downloadlinux-35b531a1e7fc30ac8c62e5ac1794eb1460da614e.tar.xz
KVM: selftests: check returned evmcs version range
Check that KVM_CAP_HYPERV_ENLIGHTENED_VMCS returns correct version range. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/kvm/x86_64/evmcs_test.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/x86_64/evmcs_test.c b/tools/testing/selftests/kvm/x86_64/evmcs_test.c
index ea3c73e8f4f6..c49c2a28b0eb 100644
--- a/tools/testing/selftests/kvm/x86_64/evmcs_test.c
+++ b/tools/testing/selftests/kvm/x86_64/evmcs_test.c
@@ -103,6 +103,12 @@ int main(int argc, char *argv[])
vcpu_ioctl(vm, VCPU_ID, KVM_ENABLE_CAP, &enable_evmcs_cap);
+ /* KVM should return supported EVMCS version range */
+ TEST_ASSERT(((evmcs_ver >> 8) >= (evmcs_ver & 0xff)) &&
+ (evmcs_ver & 0xff) > 0,
+ "Incorrect EVMCS version range: %x:%x\n",
+ evmcs_ver & 0xff, evmcs_ver >> 8);
+
run = vcpu_state(vm, VCPU_ID);
vcpu_regs_get(vm, VCPU_ID, &regs1);