1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _S390_UAPI_RUNTIME_INSTR_H
3#define _S390_UAPI_RUNTIME_INSTR_H
4
5#include <linux/types.h>
6
7#define S390_RUNTIME_INSTR_START	0x1
8#define S390_RUNTIME_INSTR_STOP		0x2
9
10struct runtime_instr_cb {
11	__u64 rca;
12	__u64 roa;
13	__u64 rla;
14
15	__u32 v			: 1;
16	__u32 s			: 1;
17	__u32 k			: 1;
18	__u32 h			: 1;
19	__u32 a			: 1;
20	__u32 reserved1		: 3;
21	__u32 ps		: 1;
22	__u32 qs		: 1;
23	__u32 pc		: 1;
24	__u32 qc		: 1;
25	__u32 reserved2		: 1;
26	__u32 g			: 1;
27	__u32 u			: 1;
28	__u32 l			: 1;
29	__u32 key		: 4;
30	__u32 reserved3		: 8;
31	__u32 t			: 1;
32	__u32 rgs		: 3;
33
34	__u32 m			: 4;
35	__u32 n			: 1;
36	__u32 mae		: 1;
37	__u32 reserved4		: 2;
38	__u32 c			: 1;
39	__u32 r			: 1;
40	__u32 b			: 1;
41	__u32 j			: 1;
42	__u32 e			: 1;
43	__u32 x			: 1;
44	__u32 reserved5		: 2;
45	__u32 bpxn		: 1;
46	__u32 bpxt		: 1;
47	__u32 bpti		: 1;
48	__u32 bpni		: 1;
49	__u32 reserved6		: 2;
50
51	__u32 d			: 1;
52	__u32 f			: 1;
53	__u32 ic		: 4;
54	__u32 dc		: 4;
55
56	__u64 reserved7;
57	__u64 sf;
58	__u64 rsic;
59	__u64 reserved8;
60} __attribute__((__packed__, __aligned__(8)));
61
62static inline void load_runtime_instr_cb(struct runtime_instr_cb *cb)
63{
64	asm volatile(".insn	rsy,0xeb0000000060,0,0,%0"	/* LRIC */
65		: : "Q" (*cb));
66}
67
68static inline void store_runtime_instr_cb(struct runtime_instr_cb *cb)
69{
70	asm volatile(".insn	rsy,0xeb0000000061,0,0,%0"	/* STRIC */
71		: "=Q" (*cb) : : "cc");
72}
73
74#endif /* _S390_UAPI_RUNTIME_INSTR_H */
75