• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _RUNTIME_INSTR_H
2 #define _RUNTIME_INSTR_H
3 
4 #define S390_RUNTIME_INSTR_START	0x1
5 #define S390_RUNTIME_INSTR_STOP		0x2
6 
7 struct runtime_instr_cb {
8 	__u64 buf_current;
9 	__u64 buf_origin;
10 	__u64 buf_limit;
11 
12 	__u32 valid		: 1;
13 	__u32 pstate		: 1;
14 	__u32 pstate_set_buf	: 1;
15 	__u32 home_space	: 1;
16 	__u32 altered		: 1;
17 	__u32			: 3;
18 	__u32 pstate_sample	: 1;
19 	__u32 sstate_sample	: 1;
20 	__u32 pstate_collect	: 1;
21 	__u32 sstate_collect	: 1;
22 	__u32			: 1;
23 	__u32 halted_int	: 1;
24 	__u32 int_requested	: 1;
25 	__u32 buffer_full_int	: 1;
26 	__u32 key		: 4;
27 	__u32			: 9;
28 	__u32 rgs		: 3;
29 
30 	__u32 mode		: 4;
31 	__u32 next		: 1;
32 	__u32 mae		: 1;
33 	__u32			: 2;
34 	__u32 call_type_br	: 1;
35 	__u32 return_type_br	: 1;
36 	__u32 other_type_br	: 1;
37 	__u32 bc_other_type	: 1;
38 	__u32 emit		: 1;
39 	__u32 tx_abort		: 1;
40 	__u32			: 2;
41 	__u32 bp_xn		: 1;
42 	__u32 bp_xt		: 1;
43 	__u32 bp_ti		: 1;
44 	__u32 bp_ni		: 1;
45 	__u32 suppr_y		: 1;
46 	__u32 suppr_z		: 1;
47 
48 	__u32 dc_miss_extra	: 1;
49 	__u32 lat_lev_ignore	: 1;
50 	__u32 ic_lat_lev	: 4;
51 	__u32 dc_lat_lev	: 4;
52 
53 	__u64 reserved1;
54 	__u64 scaling_factor;
55 	__u64 rsic;
56 	__u64 reserved2;
57 } __packed __aligned(8);
58 
59 extern struct runtime_instr_cb runtime_instr_empty_cb;
60 
load_runtime_instr_cb(struct runtime_instr_cb * cb)61 static inline void load_runtime_instr_cb(struct runtime_instr_cb *cb)
62 {
63 	asm volatile(".insn	rsy,0xeb0000000060,0,0,%0"	/* LRIC */
64 		: : "Q" (*cb));
65 }
66 
store_runtime_instr_cb(struct runtime_instr_cb * cb)67 static inline void store_runtime_instr_cb(struct runtime_instr_cb *cb)
68 {
69 	asm volatile(".insn	rsy,0xeb0000000061,0,0,%0"	/* STRIC */
70 		: "=Q" (*cb) : : "cc");
71 }
72 
save_ri_cb(struct runtime_instr_cb * cb_prev)73 static inline void save_ri_cb(struct runtime_instr_cb *cb_prev)
74 {
75 #ifdef CONFIG_64BIT
76 	if (cb_prev)
77 		store_runtime_instr_cb(cb_prev);
78 #endif
79 }
80 
restore_ri_cb(struct runtime_instr_cb * cb_next,struct runtime_instr_cb * cb_prev)81 static inline void restore_ri_cb(struct runtime_instr_cb *cb_next,
82 				 struct runtime_instr_cb *cb_prev)
83 {
84 #ifdef CONFIG_64BIT
85 	if (cb_next)
86 		load_runtime_instr_cb(cb_next);
87 	else if (cb_prev)
88 		load_runtime_instr_cb(&runtime_instr_empty_cb);
89 #endif
90 }
91 
92 #ifdef CONFIG_64BIT
93 extern void exit_thread_runtime_instr(void);
94 #else
exit_thread_runtime_instr(void)95 static inline void exit_thread_runtime_instr(void) { }
96 #endif
97 
98 #endif /* _RUNTIME_INSTR_H */
99