From: Isaku Yamahata Hyper-V EVMCS capability, KVM_CAP_HYPERV_ENLIGHTENED_VMCS, is optional. To increase test coverage, when Hyper-V EVMCS is supported, additionally run tests with EVMCS disabled. Signed-off-by: Isaku Yamahata --- .../selftests/kvm/x86/vmx_set_nested_state_test.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/testing/selftests/kvm/x86/vmx_set_nested_state_test.c b/tools/testing/selftests/kvm/x86/vmx_set_nested_state_test.c index 67a62a5a8895..cbf6a8ff626e 100644 --- a/tools/testing/selftests/kvm/x86/vmx_set_nested_state_test.c +++ b/tools/testing/selftests/kvm/x86/vmx_set_nested_state_test.c @@ -298,6 +298,18 @@ int main(int argc, char *argv[]) test_nested_state_expect_einval(vcpu, &state); test_vmx_nested_state(vcpu); + if (have_evmcs) { + /* + * KVM_CAP_HYPERV_ENLIGHTENED_VMCS can be only enabled. + * Because There is no way to disable it, re-create vm and vcpu. + */ + have_evmcs = false; + kvm_vm_free(vm); + vm = vm_create_with_one_vcpu(&vcpu, NULL); + vcpu_clear_cpuid_feature(vcpu, X86_FEATURE_VMX); + + test_vmx_nested_state(vcpu); + } kvm_vm_free(vm); return 0; -- 2.45.2