On Tue, Nov 15, 2022, Vishal Annapurve wrote:
Introduce arch specific API: kvm_selftest_arch_init to allow each arch to handle initialization before running any selftest logic.
Suggested-by: Sean Christopherson seanjc@google.com Reviewed-by: Andrew Jones andrew.jones@linux.dev Reviewed-by: Peter Gonda pgonda@google.com Signed-off-by: Vishal Annapurve vannapurve@google.com
.../selftests/kvm/include/kvm_util_base.h | 5 +++++ .../selftests/kvm/lib/aarch64/processor.c | 18 +++++++++--------- tools/testing/selftests/kvm/lib/kvm_util.c | 6 ++++++ 3 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h index e42a09cd24a0..eec0e4898efe 100644 --- a/tools/testing/selftests/kvm/include/kvm_util_base.h +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h @@ -838,4 +838,9 @@ static inline int __vm_disable_nx_huge_pages(struct kvm_vm *vm) return __vm_enable_cap(vm, KVM_CAP_VM_DISABLE_NX_HUGE_PAGES, 0); } +/*
- API to execute architecture specific setup before executing main().
- */
I find the "API" blurb to be somewhat confusing. When I think of APIs, I think of functions that are provided by a library that are called by users of the library.
An example might also help readers understand what types of setup can/should be done with this hook.
Maybe something like this?
/* * Arch hook that is invoked via a constructor, i.e. before exeucting main(), * to allow for arch-specific setup that is common to all tests, e.g. computing * the default guest "mode". */