1f08c3bdfSopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
2f08c3bdfSopenharmony_ci/*
3f08c3bdfSopenharmony_ci * Copyright (C) 2021 SUSE LLC <mdoucha@suse.cz>
4f08c3bdfSopenharmony_ci *
5f08c3bdfSopenharmony_ci * Common definitions for communication between KVM guest and host.
6f08c3bdfSopenharmony_ci */
7f08c3bdfSopenharmony_ci
8f08c3bdfSopenharmony_ci#ifndef KVM_COMMON_H_
9f08c3bdfSopenharmony_ci#define KVM_COMMON_H_
10f08c3bdfSopenharmony_ci
11f08c3bdfSopenharmony_ci#define KVM_TNONE	-1	/* "No result" status value */
12f08c3bdfSopenharmony_ci
13f08c3bdfSopenharmony_ci/*
14f08c3bdfSopenharmony_ci * Result value for asynchronous notifications between guest and host.
15f08c3bdfSopenharmony_ci * Do not use this value directly. Call tst_signal_host() or tst_wait_host()
16f08c3bdfSopenharmony_ci * in guest code. The notification must be handled by another host thread
17f08c3bdfSopenharmony_ci * and then the result value must be reset to KVM_TNONE.
18f08c3bdfSopenharmony_ci */
19f08c3bdfSopenharmony_ci#define KVM_TSYNC	0xfe
20f08c3bdfSopenharmony_ci
21f08c3bdfSopenharmony_ci/*
22f08c3bdfSopenharmony_ci * Result value indicating end of test. If the test program exits using
23f08c3bdfSopenharmony_ci * the HLT instruction with any valid result value other than KVM_TEXIT or
24f08c3bdfSopenharmony_ci * TBROK, KVM runner will automatically resume VM execution after printing
25f08c3bdfSopenharmony_ci * the message.
26f08c3bdfSopenharmony_ci */
27f08c3bdfSopenharmony_ci#define KVM_TEXIT	0xff
28f08c3bdfSopenharmony_ci
29f08c3bdfSopenharmony_ci#define KVM_RESULT_BASEADDR 0xfffff000
30f08c3bdfSopenharmony_ci#define KVM_RESULT_SIZE 0x1000
31f08c3bdfSopenharmony_ci
32f08c3bdfSopenharmony_cistruct tst_kvm_result {
33f08c3bdfSopenharmony_ci	int32_t result;
34f08c3bdfSopenharmony_ci	int32_t lineno;
35f08c3bdfSopenharmony_ci	uint64_t file_addr;
36f08c3bdfSopenharmony_ci	char message[0];
37f08c3bdfSopenharmony_ci};
38f08c3bdfSopenharmony_ci
39f08c3bdfSopenharmony_ci#endif /* KVM_COMMON_H_ */
40