Commit 7e464770 authored by Vitaly Kuznetsov's avatar Vitaly Kuznetsov Committed by Paolo Bonzini

KVM: selftests: Don't probe KVM_CAP_HYPERV_ENLIGHTENED_VMCS when nested VMX is unsupported

KVM_CAP_HYPERV_ENLIGHTENED_VMCS will be reported as supported even when
nested VMX is not, fix evmcs_test/hyperv_cpuid tests to check for both.
Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20200610135847.754289-3-vkuznets@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 41a23ab3
...@@ -94,9 +94,10 @@ int main(int argc, char *argv[]) ...@@ -94,9 +94,10 @@ int main(int argc, char *argv[])
vcpu_set_cpuid(vm, VCPU_ID, kvm_get_supported_cpuid()); vcpu_set_cpuid(vm, VCPU_ID, kvm_get_supported_cpuid());
if (!kvm_check_cap(KVM_CAP_NESTED_STATE) || if (!nested_vmx_supported() ||
!kvm_check_cap(KVM_CAP_NESTED_STATE) ||
!kvm_check_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS)) { !kvm_check_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS)) {
print_skip("capabilities not available"); print_skip("Enlightened VMCS is unsupported");
exit(KSFT_SKIP); exit(KSFT_SKIP);
} }
......
...@@ -170,7 +170,8 @@ int main(int argc, char *argv[]) ...@@ -170,7 +170,8 @@ int main(int argc, char *argv[])
case 1: case 1:
break; break;
case 2: case 2:
if (!kvm_check_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS)) { if (!nested_vmx_supported() ||
!kvm_check_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS)) {
print_skip("Enlightened VMCS is unsupported"); print_skip("Enlightened VMCS is unsupported");
continue; continue;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment