1 // SPDX-License-Identifier: GPL-2.0
3 * tools/testing/selftests/kvm/include/perf_test_util.h
5 * Copyright (C) 2020, Google LLC.
8 #ifndef SELFTEST_KVM_PERF_TEST_UTIL_H
9 #define SELFTEST_KVM_PERF_TEST_UTIL_H
13 /* Default guest test virtual memory offset */
14 #define DEFAULT_GUEST_TEST_MEM 0xc0000000
16 #define DEFAULT_PER_VCPU_MEM_SIZE (1 << 30) /* 1G */
18 #define PERF_TEST_MEM_SLOT_INDEX 1
20 struct perf_test_vcpu_args {
24 /* Only used by the host userspace part of the vCPU thread */
28 struct perf_test_args {
30 uint64_t host_page_size;
31 uint64_t guest_page_size;
34 struct perf_test_vcpu_args vcpu_args[KVM_MAX_VCPUS];
37 extern struct perf_test_args perf_test_args;
40 * Guest physical memory offset of the testing memory slot.
41 * This will be set to the topmost valid physical address minus
42 * the test memory size.
44 extern uint64_t guest_test_phys_mem;
46 struct kvm_vm *perf_test_create_vm(enum vm_guest_mode mode, int vcpus,
47 uint64_t vcpu_memory_bytes, int slots,
48 enum vm_mem_backing_src_type backing_src);
49 void perf_test_destroy_vm(struct kvm_vm *vm);
50 void perf_test_setup_vcpus(struct kvm_vm *vm, int vcpus,
51 uint64_t vcpu_memory_bytes,
52 bool partition_vcpu_memory_access);
54 #endif /* SELFTEST_KVM_PERF_TEST_UTIL_H */