xref: /linux/tools/testing/selftests/kvm/include/kvm_util_types.h (revision 06bc7ff0a1e0f2b0102e1314e3527a7ec0997851)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef SELFTEST_KVM_UTIL_TYPES_H
3 #define SELFTEST_KVM_UTIL_TYPES_H
4 
5 #include <linux/types.h>
6 
7 /*
8  * Provide a version of static_assert() that is guaranteed to have an optional
9  * message param.  _GNU_SOURCE is defined for all KVM selftests, _GNU_SOURCE
10  * implies _ISOC11_SOURCE, and if _ISOC11_SOURCE is defined, glibc #undefs and
11  * #defines static_assert() as a direct alias to _Static_assert() (see
12  * usr/include/assert.h).  Define a custom macro instead of redefining
13  * static_assert() to avoid creating non-deterministic behavior that is
14  * dependent on include order.
15  */
16 #define __kvm_static_assert(expr, msg, ...) _Static_assert(expr, msg)
17 #define kvm_static_assert(expr, ...) __kvm_static_assert(expr, ##__VA_ARGS__, #expr)
18 
19 typedef u64 gpa_t; /* Virtual Machine (Guest) physical address */
20 typedef u64 gva_t; /* Virtual Machine (Guest) virtual address */
21 
22 #define INVALID_GPA (~(u64)0)
23 
24 #endif /* SELFTEST_KVM_UTIL_TYPES_H */
25