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