Skip to content

Commit 7e46477

Browse files
vittyvkbonzini
authored andcommitted
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: Vitaly Kuznetsov <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 41a23ab commit 7e46477

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tools/testing/selftests/kvm/x86_64/evmcs_test.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ int main(int argc, char *argv[])
9494

9595
vcpu_set_cpuid(vm, VCPU_ID, kvm_get_supported_cpuid());
9696

97-
if (!kvm_check_cap(KVM_CAP_NESTED_STATE) ||
97+
if (!nested_vmx_supported() ||
98+
!kvm_check_cap(KVM_CAP_NESTED_STATE) ||
9899
!kvm_check_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS)) {
99-
print_skip("capabilities not available");
100+
print_skip("Enlightened VMCS is unsupported");
100101
exit(KSFT_SKIP);
101102
}
102103

tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ int main(int argc, char *argv[])
170170
case 1:
171171
break;
172172
case 2:
173-
if (!kvm_check_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS)) {
173+
if (!nested_vmx_supported() ||
174+
!kvm_check_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS)) {
174175
print_skip("Enlightened VMCS is unsupported");
175176
continue;
176177
}

0 commit comments

Comments
 (0)