hwsampler.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * CPUMF HW sampler functions and internal structures
  3. *
  4. * Copyright IBM Corp. 2010
  5. * Author(s): Heinz Graalfs <graalfs@de.ibm.com>
  6. */
  7. #ifndef HWSAMPLER_H_
  8. #define HWSAMPLER_H_
  9. #include <linux/workqueue.h>
  10. struct hws_qsi_info_block /* QUERY SAMPLING information block */
  11. { /* Bit(s) */
  12. unsigned int b0_13:14; /* 0-13: zeros */
  13. unsigned int as:1; /* 14: sampling authorisation control*/
  14. unsigned int b15_21:7; /* 15-21: zeros */
  15. unsigned int es:1; /* 22: sampling enable control */
  16. unsigned int b23_29:7; /* 23-29: zeros */
  17. unsigned int cs:1; /* 30: sampling activation control */
  18. unsigned int:1; /* 31: reserved */
  19. unsigned int bsdes:16; /* 4-5: size of sampling entry */
  20. unsigned int:16; /* 6-7: reserved */
  21. unsigned long min_sampl_rate; /* 8-15: minimum sampling interval */
  22. unsigned long max_sampl_rate; /* 16-23: maximum sampling interval*/
  23. unsigned long tear; /* 24-31: TEAR contents */
  24. unsigned long dear; /* 32-39: DEAR contents */
  25. unsigned int rsvrd0; /* 40-43: reserved */
  26. unsigned int cpu_speed; /* 44-47: CPU speed */
  27. unsigned long long rsvrd1; /* 48-55: reserved */
  28. unsigned long long rsvrd2; /* 56-63: reserved */
  29. };
  30. struct hws_ssctl_request_block /* SET SAMPLING CONTROLS req block */
  31. { /* bytes 0 - 7 Bit(s) */
  32. unsigned int s:1; /* 0: maximum buffer indicator */
  33. unsigned int h:1; /* 1: part. level reserved for VM use*/
  34. unsigned long b2_53:52; /* 2-53: zeros */
  35. unsigned int es:1; /* 54: sampling enable control */
  36. unsigned int b55_61:7; /* 55-61: - zeros */
  37. unsigned int cs:1; /* 62: sampling activation control */
  38. unsigned int b63:1; /* 63: zero */
  39. unsigned long interval; /* 8-15: sampling interval */
  40. unsigned long tear; /* 16-23: TEAR contents */
  41. unsigned long dear; /* 24-31: DEAR contents */
  42. /* 32-63: */
  43. unsigned long rsvrd1; /* reserved */
  44. unsigned long rsvrd2; /* reserved */
  45. unsigned long rsvrd3; /* reserved */
  46. unsigned long rsvrd4; /* reserved */
  47. };
  48. struct hws_cpu_buffer {
  49. unsigned long first_sdbt; /* @ of 1st SDB-Table for this CP*/
  50. unsigned long worker_entry;
  51. unsigned long sample_overflow; /* taken from SDB ... */
  52. struct hws_qsi_info_block qsi;
  53. struct hws_ssctl_request_block ssctl;
  54. struct work_struct worker;
  55. atomic_t ext_params;
  56. unsigned long req_alert;
  57. unsigned long loss_of_sample_data;
  58. unsigned long invalid_entry_address;
  59. unsigned long incorrect_sdbt_entry;
  60. unsigned long sample_auth_change_alert;
  61. unsigned int finish:1;
  62. unsigned int oom:1;
  63. unsigned int stop_mode:1;
  64. };
  65. struct hws_data_entry {
  66. unsigned int def:16; /* 0-15 Data Entry Format */
  67. unsigned int R:4; /* 16-19 reserved */
  68. unsigned int U:4; /* 20-23 Number of unique instruct. */
  69. unsigned int z:2; /* zeros */
  70. unsigned int T:1; /* 26 PSW DAT mode */
  71. unsigned int W:1; /* 27 PSW wait state */
  72. unsigned int P:1; /* 28 PSW Problem state */
  73. unsigned int AS:2; /* 29-30 PSW address-space control */
  74. unsigned int I:1; /* 31 entry valid or invalid */
  75. unsigned int:16;
  76. unsigned int prim_asn:16; /* primary ASN */
  77. unsigned long long ia; /* Instruction Address */
  78. unsigned long long lpp; /* Logical-Partition Program Param. */
  79. unsigned long long vpp; /* Virtual-Machine Program Param. */
  80. };
  81. struct hws_trailer_entry {
  82. unsigned int f:1; /* 0 - Block Full Indicator */
  83. unsigned int a:1; /* 1 - Alert request control */
  84. unsigned long:62; /* 2 - 63: Reserved */
  85. unsigned long overflow; /* 64 - sample Overflow count */
  86. unsigned long timestamp; /* 16 - time-stamp */
  87. unsigned long timestamp1; /* */
  88. unsigned long reserved1; /* 32 -Reserved */
  89. unsigned long reserved2; /* */
  90. unsigned long progusage1; /* 48 - reserved for programming use */
  91. unsigned long progusage2; /* */
  92. };
  93. int hwsampler_setup(void);
  94. int hwsampler_shutdown(void);
  95. int hwsampler_allocate(unsigned long sdbt, unsigned long sdb);
  96. int hwsampler_deallocate(void);
  97. unsigned long hwsampler_query_min_interval(void);
  98. unsigned long hwsampler_query_max_interval(void);
  99. int hwsampler_start_all(unsigned long interval);
  100. int hwsampler_stop_all(void);
  101. int hwsampler_deactivate(unsigned int cpu);
  102. int hwsampler_activate(unsigned int cpu);
  103. unsigned long hwsampler_get_sample_overflow_count(unsigned int cpu);
  104. #endif /*HWSAMPLER_H_*/