diff options
| author | Ingo Molnar <mingo@kernel.org> | 2025-11-13 07:58:43 +0100 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2025-11-13 07:58:43 +0100 |
| commit | d851f2b2b273363f65d7285b427bedbb6f8290e2 (patch) | |
| tree | 38ba3c4b0d4251d7063bcd253c9b914a56165428 /tools/testing/selftests/kvm/include/kvm_util.h | |
| parent | 249092174caa3fe9fb8f7914991a8c0de484bcf8 (diff) | |
| parent | e9a6fb0bcdd7609be6969112f3fbfcce3b1d4a7c (diff) | |
| download | linux-next-d851f2b2b273363f65d7285b427bedbb6f8290e2.tar.gz linux-next-d851f2b2b273363f65d7285b427bedbb6f8290e2.zip | |
Merge tag 'v6.18-rc5' into objtool/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/testing/selftests/kvm/include/kvm_util.h')
| -rw-r--r-- | tools/testing/selftests/kvm/include/kvm_util.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h index 26cc30290e76..d3f3e455c031 100644 --- a/tools/testing/selftests/kvm/include/kvm_util.h +++ b/tools/testing/selftests/kvm/include/kvm_util.h @@ -286,6 +286,31 @@ static inline bool kvm_has_cap(long cap) #define __KVM_SYSCALL_ERROR(_name, _ret) \ "%s failed, rc: %i errno: %i (%s)", (_name), (_ret), errno, strerror(errno) +static inline void *__kvm_mmap(size_t size, int prot, int flags, int fd, + off_t offset) +{ + void *mem; + + mem = mmap(NULL, size, prot, flags, fd, offset); + TEST_ASSERT(mem != MAP_FAILED, __KVM_SYSCALL_ERROR("mmap()", + (int)(unsigned long)MAP_FAILED)); + + return mem; +} + +static inline void *kvm_mmap(size_t size, int prot, int flags, int fd) +{ + return __kvm_mmap(size, prot, flags, fd, 0); +} + +static inline void kvm_munmap(void *mem, size_t size) +{ + int ret; + + ret = munmap(mem, size); + TEST_ASSERT(!ret, __KVM_SYSCALL_ERROR("munmap()", ret)); +} + /* * Use the "inner", double-underscore macro when reporting errors from within * other macros so that the name of ioctl() and not its literal numeric value @@ -1273,4 +1298,6 @@ bool vm_is_gpa_protected(struct kvm_vm *vm, vm_paddr_t paddr); uint32_t guest_get_vcpuid(void); +bool kvm_arch_has_default_irqchip(void); + #endif /* SELFTEST_KVM_UTIL_H */ |
