xref: /kvm-unit-tests/lib/s390x/sie-icpt.h (revision 1f08a91a41402b0e032ecce8ed1b5952cbfca0ea)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Functionality for SIE interception handling.
4  *
5  * Copyright IBM Corp. 2024
6  */
7 
8 #ifndef _S390X_SIE_ICPT_H_
9 #define _S390X_SIE_ICPT_H_
10 
11 #include <libcflat.h>
12 #include <sie.h>
13 
14 struct diag_itext {
15 	uint64_t opcode   :  8;
16 	uint64_t r_1      :  4;
17 	uint64_t r_2      :  4;
18 	uint64_t r_base   :  4;
19 	uint64_t displace : 12;
20 	uint64_t zero     : 16;
21 	uint64_t          : 16;
22 };
23 
24 struct diag_itext sblk_ip_as_diag(struct kvm_s390_sie_block *sblk);
25 
26 /**
27  * sie_is_diag_icpt() - Check if intercept is due to diagnose instruction
28  * @vm: the guest
29  * @diag: the expected diagnose code
30  *
31  * Check that the intercept is due to diagnose @diag and valid.
32  * For protected virtualization, check that the intercept data meets additional
33  * constraints.
34  *
35  * Returns: true if intercept is due to a valid and has matching diagnose code
36  */
37 bool sie_is_diag_icpt(struct vm *vm, unsigned int diag);
38 
39 #endif /* _S390X_SIE_ICPT_H_ */
40