aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/aarch64
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2022-05-27 15:13:03 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2022-06-11 11:47:28 -0400
commit3ea9b809650b4eda5d4ae18ed7bb080e499af154 (patch)
tree69a88487730d38d154c7e7fea7af84973b8ac713 /tools/testing/selftests/kvm/aarch64
parentKVM: selftests: Return an 'unsigned int' from kvm_check_cap() (diff)
downloadlinux-dev-3ea9b809650b4eda5d4ae18ed7bb080e499af154.tar.xz
linux-dev-3ea9b809650b4eda5d4ae18ed7bb080e499af154.zip
KVM: selftests: Add kvm_has_cap() to provide syntactic sugar
Add kvm_has_cap() to wrap kvm_check_cap() and return a bool for the use cases where the caller only wants check if a capability is supported, i.e. doesn't care about the value beyond whether or not it's non-zero. The "check" terminology is somewhat ambiguous as the non-boolean return suggests that '0' might mean "success", i.e. suggests that the ioctl uses the 0/-errno pattern. Provide a wrapper instead of trying to find a new name for the raw helper; the "check" terminology is derived from the name of the ioctl, so using e.g. "get" isn't a clear win. Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/aarch64')
-rw-r--r--tools/testing/selftests/kvm/aarch64/get-reg-list.c2
-rw-r--r--tools/testing/selftests/kvm/aarch64/vcpu_width_config.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list.c b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
index f0f83ffda344..8bc10b9acbbc 100644
--- a/tools/testing/selftests/kvm/aarch64/get-reg-list.c
+++ b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
@@ -395,7 +395,7 @@ static void check_supported(struct vcpu_config *c)
struct reg_sublist *s;
for_each_sublist(c, s) {
- if (s->capability && !kvm_check_cap(s->capability)) {
+ if (s->capability && !kvm_has_cap(s->capability)) {
fprintf(stderr, "%s: %s not available, skipping tests\n", config_name(c), s->name);
exit(KSFT_SKIP);
}
diff --git a/tools/testing/selftests/kvm/aarch64/vcpu_width_config.c b/tools/testing/selftests/kvm/aarch64/vcpu_width_config.c
index dd5a1c4b49e0..fff02c442610 100644
--- a/tools/testing/selftests/kvm/aarch64/vcpu_width_config.c
+++ b/tools/testing/selftests/kvm/aarch64/vcpu_width_config.c
@@ -82,7 +82,7 @@ int main(void)
struct kvm_vm *vm;
int ret;
- if (!kvm_check_cap(KVM_CAP_ARM_EL1_32BIT)) {
+ if (!kvm_has_cap(KVM_CAP_ARM_EL1_32BIT)) {
print_skip("KVM_CAP_ARM_EL1_32BIT is not supported");
exit(KSFT_SKIP);
}