KVM: selftests: Use KVM_IOCTL_ERROR() for one-off arm64 ioctls
authorSean Christopherson <seanjc@google.com>
Thu, 17 Feb 2022 18:57:06 +0000 (10:57 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 11 Jun 2022 15:46:20 +0000 (11:46 -0400)
Use the KVM_IOCTL_ERROR() macro to generate error messages for a handful
of one-off arm64 ioctls.  The calls in question are made without an
associated struct kvm_vm/kvm_vcpu as they are used to configure those
structs, i.e. can't be easily converted to e.g. vcpu_ioctl().

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/lib/aarch64/processor.c

index 388bd7d..2e73853 100644 (file)
@@ -472,15 +472,15 @@ void aarch64_get_supported_page_sizes(uint32_t ipa,
        TEST_ASSERT(vm_fd >= 0, KVM_IOCTL_ERROR(KVM_CREATE_VM, vm_fd));
 
        vcpu_fd = ioctl(vm_fd, KVM_CREATE_VCPU, 0);
-       TEST_ASSERT(vcpu_fd >= 0, "Can't create vcpu");
+       TEST_ASSERT(vcpu_fd >= 0, KVM_IOCTL_ERROR(KVM_CREATE_VCPU, vcpu_fd));
 
        err = ioctl(vm_fd, KVM_ARM_PREFERRED_TARGET, &preferred_init);
-       TEST_ASSERT(err == 0, "Can't get target");
+       TEST_ASSERT(err == 0, KVM_IOCTL_ERROR(KVM_ARM_PREFERRED_TARGET, err));
        err = ioctl(vcpu_fd, KVM_ARM_VCPU_INIT, &preferred_init);
-       TEST_ASSERT(err == 0, "Can't get init vcpu");
+       TEST_ASSERT(err == 0, KVM_IOCTL_ERROR(KVM_ARM_VCPU_INIT, err));
 
        err = ioctl(vcpu_fd, KVM_GET_ONE_REG, &reg);
-       TEST_ASSERT(err == 0, "Can't get MMFR0");
+       TEST_ASSERT(err == 0, KVM_IOCTL_ERROR(KVM_GET_ONE_REG, vcpu_fd));
 
        *ps4k = ((val >> 28) & 0xf) != 0xf;
        *ps64k = ((val >> 24) & 0xf) == 0;