1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * timer test specific header
4 *
5 * Copyright (C) 2018, Google LLC
6 */
7
8#ifndef SELFTEST_KVM_TIMER_TEST_H
9#define SELFTEST_KVM_TIMER_TEST_H
10
11#include "kvm_util.h"
12
13#define NR_VCPUS_DEF            4
14#define NR_TEST_ITERS_DEF       5
15#define TIMER_TEST_PERIOD_MS_DEF    10
16#define TIMER_TEST_ERR_MARGIN_US    100
17#define TIMER_TEST_MIGRATION_FREQ_MS    2
18
19/* Timer test cmdline parameters */
20struct test_args {
21	uint32_t nr_vcpus;
22	uint32_t nr_iter;
23	uint32_t timer_period_ms;
24	uint32_t migration_freq_ms;
25	uint32_t timer_err_margin_us;
26	/* Members of struct kvm_arm_counter_offset */
27	uint64_t counter_offset;
28	uint64_t reserved;
29};
30
31/* Shared variables between host and guest */
32struct test_vcpu_shared_data {
33	uint32_t nr_iter;
34	int guest_stage;
35	uint64_t xcnt;
36};
37
38extern struct test_args test_args;
39extern struct kvm_vcpu *vcpus[];
40extern struct test_vcpu_shared_data vcpu_shared_data[];
41
42struct kvm_vm *test_vm_create(void);
43void test_vm_cleanup(struct kvm_vm *vm);
44
45#endif /* SELFTEST_KVM_TIMER_TEST_H */
46