On 08/05/2019 14.05, Paolo Bonzini wrote: > On 02/05/19 13:31, Aaron Lewis wrote: >> Add tests for KVM_SET_NESTED_STATE and for various code paths in its implementation in vmx_set_nested_state(). >> >> Signed-off-by: Aaron Lewis <aaronlewis@xxxxxxxxxx> >> Reviewed-by: Marc Orr <marcorr@xxxxxxxxxx> >> Reviewed-by: Peter Shier <pshier@xxxxxxxxxx> >> --- >> tools/testing/selftests/kvm/.gitignore | 1 + >> tools/testing/selftests/kvm/Makefile | 1 + >> .../testing/selftests/kvm/include/kvm_util.h | 4 + >> tools/testing/selftests/kvm/lib/kvm_util.c | 32 ++ >> .../kvm/x86_64/vmx_set_nested_state_test.c | 275 ++++++++++++++++++ >> 5 files changed, 313 insertions(+) >> create mode 100644 tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c >> >> diff --git a/tools/testing/selftests/kvm/.gitignore b/tools/testing/selftests/kvm/.gitignore >> index 2689d1ea6d7a..bbaa97dbd19e 100644 >> --- a/tools/testing/selftests/kvm/.gitignore >> +++ b/tools/testing/selftests/kvm/.gitignore >> @@ -6,4 +6,5 @@ >> /x86_64/vmx_close_while_nested_test >> /x86_64/vmx_tsc_adjust_test >> /x86_64/state_test >> +/x86_64/vmx_set_nested_state_test >> /dirty_log_test >> diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile >> index f8588cca2bef..10eff4317226 100644 >> --- a/tools/testing/selftests/kvm/Makefile >> +++ b/tools/testing/selftests/kvm/Makefile >> @@ -20,6 +20,7 @@ TEST_GEN_PROGS_x86_64 += x86_64/evmcs_test >> TEST_GEN_PROGS_x86_64 += x86_64/hyperv_cpuid >> TEST_GEN_PROGS_x86_64 += x86_64/vmx_close_while_nested_test >> TEST_GEN_PROGS_x86_64 += x86_64/smm_test >> +TEST_GEN_PROGS_x86_64 += x86_64/vmx_set_nested_state_test >> TEST_GEN_PROGS_x86_64 += dirty_log_test >> TEST_GEN_PROGS_x86_64 += clear_dirty_log_test >> >> diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h >> index 07b71ad9734a..8c6b9619797d 100644 >> --- a/tools/testing/selftests/kvm/include/kvm_util.h >> +++ b/tools/testing/selftests/kvm/include/kvm_util.h >> @@ -118,6 +118,10 @@ void vcpu_events_get(struct kvm_vm *vm, uint32_t vcpuid, >> struct kvm_vcpu_events *events); >> void vcpu_events_set(struct kvm_vm *vm, uint32_t vcpuid, >> struct kvm_vcpu_events *events); >> +void vcpu_nested_state_get(struct kvm_vm *vm, uint32_t vcpuid, >> + struct kvm_nested_state *state); >> +int vcpu_nested_state_set(struct kvm_vm *vm, uint32_t vcpuid, >> + struct kvm_nested_state *state, bool ignore_error); >> [...] > > Queued all three, thanks. struct kvm_nested_state is only declared on x86 ... so this currently fails for me when compiling the kvm selftests for s390x: include/kvm_util.h:124:14: warning: ‘struct kvm_nested_state’ declared inside parameter list will not be visible outside of this definition or declaration struct kvm_nested_state *state); ^~~~~~~~~~~~~~~~ include/kvm_util.h:126:13: warning: ‘struct kvm_nested_state’ declared inside parameter list will not be visible outside of this definition or declaration struct kvm_nested_state *state, bool ignore_error); ^~~~~~~~~~~~~~~~ ... so I guess these functions should be wrapped with "#ifdef __x86_64__" ? Thomas