runtime_instr.h 1.9 KB

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