KVM: selftests: enumerate GUEST_ASSERT arguments
authorColton Lewis <coltonlewis@google.com>
Wed, 15 Jun 2022 19:31:13 +0000 (19:31 +0000)
committerSean Christopherson <seanjc@google.com>
Thu, 14 Jul 2022 01:14:06 +0000 (18:14 -0700)
Enumerate GUEST_ASSERT arguments to avoid magic indices to ucall.args.

Signed-off-by: Colton Lewis <coltonlewis@google.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Link: https://lore.kernel.org/r/20220615193116.806312-2-coltonlewis@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/include/ucall_common.h

index 98562f6..dbe8728 100644 (file)
@@ -32,6 +32,14 @@ uint64_t get_ucall(struct kvm_vcpu *vcpu, struct ucall *uc);
                                ucall(UCALL_SYNC, 6, "hello", stage, arg1, arg2, arg3, arg4)
 #define GUEST_SYNC(stage)      ucall(UCALL_SYNC, 2, "hello", stage)
 #define GUEST_DONE()           ucall(UCALL_DONE, 0)
+
+enum guest_assert_builtin_args {
+       GUEST_ERROR_STRING,
+       GUEST_FILE,
+       GUEST_LINE,
+       GUEST_ASSERT_BUILTIN_NARGS
+};
+
 #define __GUEST_ASSERT(_condition, _condstr, _nargs, _args...) do {    \
        if (!(_condition))                                              \
                ucall(UCALL_ABORT, 2 + _nargs,                          \