diff options
author | Vitaly Kuznetsov <vkuznets@redhat.com> | 2020-06-10 15:58:46 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-06-11 12:35:17 -0400 |
commit | 41a23ab336fbf4d01036e1aa6369d7364aa29b4c (patch) | |
tree | d0b517861b6f56ea33b5a6ac1694bc731e12f906 /tools/testing/selftests/kvm/lib/x86_64/svm.c | |
parent | Merge branch 'kvm-basic-exit-reason' into HEAD (diff) | |
download | linux-dev-41a23ab336fbf4d01036e1aa6369d7364aa29b4c.tar.xz linux-dev-41a23ab336fbf4d01036e1aa6369d7364aa29b4c.zip |
KVM: selftests: do not substitute SVM/VMX check with KVM_CAP_NESTED_STATE check
state_test/smm_test use KVM_CAP_NESTED_STATE check as an indicator for
nested VMX/SVM presence and this is incorrect. Check for the required
features dirrectly.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20200610135847.754289-2-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/lib/x86_64/svm.c')
-rw-r--r-- | tools/testing/selftests/kvm/lib/x86_64/svm.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/testing/selftests/kvm/lib/x86_64/svm.c b/tools/testing/selftests/kvm/lib/x86_64/svm.c index c42401068373..3a5c72ed2b79 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/svm.c +++ b/tools/testing/selftests/kvm/lib/x86_64/svm.c @@ -148,14 +148,18 @@ void run_guest(struct vmcb *vmcb, uint64_t vmcb_gpa) : "r15", "memory"); } -void nested_svm_check_supported(void) +bool nested_svm_supported(void) { struct kvm_cpuid_entry2 *entry = kvm_get_supported_cpuid_entry(0x80000001); - if (!(entry->ecx & CPUID_SVM)) { + return entry->ecx & CPUID_SVM; +} + +void nested_svm_check_supported(void) +{ + if (!nested_svm_supported()) { print_skip("nested SVM not enabled"); exit(KSFT_SKIP); } } - |