kvm: selftest: unify the guest port macros
commit4e18bccc2e5544f0be28fc1c4e6be47a469d6c60
authorPeter Xu <peterx@redhat.com>
Wed, 22 Aug 2018 07:19:57 +0000 (22 15:19 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 22 Aug 2018 14:48:37 +0000 (22 16:48 +0200)
treed334c9b09f5e94cb97c85ac487d4da9bf75cf86f
parent07a262cc7c586e3f385a61b8870b0913bf31309a
kvm: selftest: unify the guest port macros

Most of the tests are using the same way to do guest to host sync but
the code is mostly duplicated.  Generalize the guest port macros into
the common header file and use it in different tests.

Meanwhile provide "struct guest_args" and a helper "guest_args_read()"
to hide the register details when playing with these port operations on
RDI and RSI.

Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/cr4_cpuid_sync_test.c
tools/testing/selftests/kvm/include/kvm_util.h
tools/testing/selftests/kvm/lib/kvm_util.c
tools/testing/selftests/kvm/state_test.c
tools/testing/selftests/kvm/sync_regs_test.c
tools/testing/selftests/kvm/vmx_tsc_adjust_test.c