• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _RUNTIME_INSTR_H
3 #define _RUNTIME_INSTR_H
4 
5 #define S390_RUNTIME_INSTR_START	0x1
6 #define S390_RUNTIME_INSTR_STOP		0x2
7 
8 struct runtime_instr_cb {
9 	__u64 buf_current;
10 	__u64 buf_origin;
11 	__u64 buf_limit;
12 
13 	__u32 valid		: 1;
14 	__u32 pstate		: 1;
15 	__u32 pstate_set_buf	: 1;
16 	__u32 home_space	: 1;
17 	__u32 altered		: 1;
18 	__u32			: 3;
19 	__u32 pstate_sample	: 1;
20 	__u32 sstate_sample	: 1;
21 	__u32 pstate_collect	: 1;
22 	__u32 sstate_collect	: 1;
23 	__u32			: 1;
24 	__u32 halted_int	: 1;
25 	__u32 int_requested	: 1;
26 	__u32 buffer_full_int	: 1;
27 	__u32 key		: 4;
28 	__u32			: 9;
29 	__u32 rgs		: 3;
30 
31 	__u32 mode		: 4;
32 	__u32 next		: 1;
33 	__u32 mae		: 1;
34 	__u32			: 2;
35 	__u32 call_type_br	: 1;
36 	__u32 return_type_br	: 1;
37 	__u32 other_type_br	: 1;
38 	__u32 bc_other_type	: 1;
39 	__u32 emit		: 1;
40 	__u32 tx_abort		: 1;
41 	__u32			: 2;
42 	__u32 bp_xn		: 1;
43 	__u32 bp_xt		: 1;
44 	__u32 bp_ti		: 1;
45 	__u32 bp_ni		: 1;
46 	__u32 suppr_y		: 1;
47 	__u32 suppr_z		: 1;
48 
49 	__u32 dc_miss_extra	: 1;
50 	__u32 lat_lev_ignore	: 1;
51 	__u32 ic_lat_lev	: 4;
52 	__u32 dc_lat_lev	: 4;
53 
54 	__u64 reserved1;
55 	__u64 scaling_factor;
56 	__u64 rsic;
57 	__u64 reserved2;
58 } __packed __aligned(8);
59 
60 extern struct runtime_instr_cb runtime_instr_empty_cb;
61 
load_runtime_instr_cb(struct runtime_instr_cb * cb)62 static 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 
store_runtime_instr_cb(struct runtime_instr_cb * cb)68 static 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 
save_ri_cb(struct runtime_instr_cb * cb_prev)74 static inline void save_ri_cb(struct runtime_instr_cb *cb_prev)
75 {
76 	if (cb_prev)
77 		store_runtime_instr_cb(cb_prev);
78 }
79 
restore_ri_cb(struct runtime_instr_cb * cb_next,struct runtime_instr_cb * cb_prev)80 static inline void restore_ri_cb(struct runtime_instr_cb *cb_next,
81 				 struct runtime_instr_cb *cb_prev)
82 {
83 	if (cb_next)
84 		load_runtime_instr_cb(cb_next);
85 	else if (cb_prev)
86 		load_runtime_instr_cb(&runtime_instr_empty_cb);
87 }
88 
89 struct task_struct;
90 
91 void runtime_instr_release(struct task_struct *tsk);
92 
93 #endif /* _RUNTIME_INSTR_H */
94