On 03/05/19 11:44, Sean Christopherson wrote: > Hmm, probably better to check KVM_CAP_NESTED_STATE. If/when support for > AMD is added it'd be good to automatically pick up whatever testing we can. > As a bonus it'll test the cap code. > Fixed like this: diff --git a/tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c b/tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c index 5eea24087d19..61a2163cf9f1 100644 --- a/tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c +++ b/tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c @@ -225,6 +225,11 @@ int main(int argc, char *argv[]) struct kvm_nested_state state; struct kvm_cpuid_entry2 *entry = kvm_get_supported_cpuid_entry(1); + if (!kvm_check_cap(KVM_CAP_NESTED_STATE)) { + printf("KVM_CAP_NESTED_STATE not available, skipping test\n"); + exit(KSFT_SKIP); + } + /* * AMD currently does not implement set_nested_state, so for now we * just early out. Paolo