perf_cpum_cf_events.c 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. /*
  2. * Perf PMU sysfs events attributes for available CPU-measurement counters
  3. *
  4. */
  5. #include <linux/slab.h>
  6. #include <linux/perf_event.h>
  7. /* BEGIN: CPUM_CF COUNTER DEFINITIONS =================================== */
  8. CPUMF_EVENT_ATTR(cf, CPU_CYCLES, 0x0000);
  9. CPUMF_EVENT_ATTR(cf, INSTRUCTIONS, 0x0001);
  10. CPUMF_EVENT_ATTR(cf, L1I_DIR_WRITES, 0x0002);
  11. CPUMF_EVENT_ATTR(cf, L1I_PENALTY_CYCLES, 0x0003);
  12. CPUMF_EVENT_ATTR(cf, PROBLEM_STATE_CPU_CYCLES, 0x0020);
  13. CPUMF_EVENT_ATTR(cf, PROBLEM_STATE_INSTRUCTIONS, 0x0021);
  14. CPUMF_EVENT_ATTR(cf, PROBLEM_STATE_L1I_DIR_WRITES, 0x0022);
  15. CPUMF_EVENT_ATTR(cf, PROBLEM_STATE_L1I_PENALTY_CYCLES, 0x0023);
  16. CPUMF_EVENT_ATTR(cf, PROBLEM_STATE_L1D_DIR_WRITES, 0x0024);
  17. CPUMF_EVENT_ATTR(cf, PROBLEM_STATE_L1D_PENALTY_CYCLES, 0x0025);
  18. CPUMF_EVENT_ATTR(cf, L1D_DIR_WRITES, 0x0004);
  19. CPUMF_EVENT_ATTR(cf, L1D_PENALTY_CYCLES, 0x0005);
  20. CPUMF_EVENT_ATTR(cf, PRNG_FUNCTIONS, 0x0040);
  21. CPUMF_EVENT_ATTR(cf, PRNG_CYCLES, 0x0041);
  22. CPUMF_EVENT_ATTR(cf, PRNG_BLOCKED_FUNCTIONS, 0x0042);
  23. CPUMF_EVENT_ATTR(cf, PRNG_BLOCKED_CYCLES, 0x0043);
  24. CPUMF_EVENT_ATTR(cf, SHA_FUNCTIONS, 0x0044);
  25. CPUMF_EVENT_ATTR(cf, SHA_CYCLES, 0x0045);
  26. CPUMF_EVENT_ATTR(cf, SHA_BLOCKED_FUNCTIONS, 0x0046);
  27. CPUMF_EVENT_ATTR(cf, SHA_BLOCKED_CYCLES, 0x0047);
  28. CPUMF_EVENT_ATTR(cf, DEA_FUNCTIONS, 0x0048);
  29. CPUMF_EVENT_ATTR(cf, DEA_CYCLES, 0x0049);
  30. CPUMF_EVENT_ATTR(cf, DEA_BLOCKED_FUNCTIONS, 0x004a);
  31. CPUMF_EVENT_ATTR(cf, DEA_BLOCKED_CYCLES, 0x004b);
  32. CPUMF_EVENT_ATTR(cf, AES_FUNCTIONS, 0x004c);
  33. CPUMF_EVENT_ATTR(cf, AES_CYCLES, 0x004d);
  34. CPUMF_EVENT_ATTR(cf, AES_BLOCKED_FUNCTIONS, 0x004e);
  35. CPUMF_EVENT_ATTR(cf, AES_BLOCKED_CYCLES, 0x004f);
  36. CPUMF_EVENT_ATTR(cf_z10, L1I_L2_SOURCED_WRITES, 0x0080);
  37. CPUMF_EVENT_ATTR(cf_z10, L1D_L2_SOURCED_WRITES, 0x0081);
  38. CPUMF_EVENT_ATTR(cf_z10, L1I_L3_LOCAL_WRITES, 0x0082);
  39. CPUMF_EVENT_ATTR(cf_z10, L1D_L3_LOCAL_WRITES, 0x0083);
  40. CPUMF_EVENT_ATTR(cf_z10, L1I_L3_REMOTE_WRITES, 0x0084);
  41. CPUMF_EVENT_ATTR(cf_z10, L1D_L3_REMOTE_WRITES, 0x0085);
  42. CPUMF_EVENT_ATTR(cf_z10, L1D_LMEM_SOURCED_WRITES, 0x0086);
  43. CPUMF_EVENT_ATTR(cf_z10, L1I_LMEM_SOURCED_WRITES, 0x0087);
  44. CPUMF_EVENT_ATTR(cf_z10, L1D_RO_EXCL_WRITES, 0x0088);
  45. CPUMF_EVENT_ATTR(cf_z10, L1I_CACHELINE_INVALIDATES, 0x0089);
  46. CPUMF_EVENT_ATTR(cf_z10, ITLB1_WRITES, 0x008a);
  47. CPUMF_EVENT_ATTR(cf_z10, DTLB1_WRITES, 0x008b);
  48. CPUMF_EVENT_ATTR(cf_z10, TLB2_PTE_WRITES, 0x008c);
  49. CPUMF_EVENT_ATTR(cf_z10, TLB2_CRSTE_WRITES, 0x008d);
  50. CPUMF_EVENT_ATTR(cf_z10, TLB2_CRSTE_HPAGE_WRITES, 0x008e);
  51. CPUMF_EVENT_ATTR(cf_z10, ITLB1_MISSES, 0x0091);
  52. CPUMF_EVENT_ATTR(cf_z10, DTLB1_MISSES, 0x0092);
  53. CPUMF_EVENT_ATTR(cf_z10, L2C_STORES_SENT, 0x0093);
  54. CPUMF_EVENT_ATTR(cf_z196, L1D_L2_SOURCED_WRITES, 0x0080);
  55. CPUMF_EVENT_ATTR(cf_z196, L1I_L2_SOURCED_WRITES, 0x0081);
  56. CPUMF_EVENT_ATTR(cf_z196, DTLB1_MISSES, 0x0082);
  57. CPUMF_EVENT_ATTR(cf_z196, ITLB1_MISSES, 0x0083);
  58. CPUMF_EVENT_ATTR(cf_z196, L2C_STORES_SENT, 0x0085);
  59. CPUMF_EVENT_ATTR(cf_z196, L1D_OFFBOOK_L3_SOURCED_WRITES, 0x0086);
  60. CPUMF_EVENT_ATTR(cf_z196, L1D_ONBOOK_L4_SOURCED_WRITES, 0x0087);
  61. CPUMF_EVENT_ATTR(cf_z196, L1I_ONBOOK_L4_SOURCED_WRITES, 0x0088);
  62. CPUMF_EVENT_ATTR(cf_z196, L1D_RO_EXCL_WRITES, 0x0089);
  63. CPUMF_EVENT_ATTR(cf_z196, L1D_OFFBOOK_L4_SOURCED_WRITES, 0x008a);
  64. CPUMF_EVENT_ATTR(cf_z196, L1I_OFFBOOK_L4_SOURCED_WRITES, 0x008b);
  65. CPUMF_EVENT_ATTR(cf_z196, DTLB1_HPAGE_WRITES, 0x008c);
  66. CPUMF_EVENT_ATTR(cf_z196, L1D_LMEM_SOURCED_WRITES, 0x008d);
  67. CPUMF_EVENT_ATTR(cf_z196, L1I_LMEM_SOURCED_WRITES, 0x008e);
  68. CPUMF_EVENT_ATTR(cf_z196, L1I_OFFBOOK_L3_SOURCED_WRITES, 0x008f);
  69. CPUMF_EVENT_ATTR(cf_z196, DTLB1_WRITES, 0x0090);
  70. CPUMF_EVENT_ATTR(cf_z196, ITLB1_WRITES, 0x0091);
  71. CPUMF_EVENT_ATTR(cf_z196, TLB2_PTE_WRITES, 0x0092);
  72. CPUMF_EVENT_ATTR(cf_z196, TLB2_CRSTE_HPAGE_WRITES, 0x0093);
  73. CPUMF_EVENT_ATTR(cf_z196, TLB2_CRSTE_WRITES, 0x0094);
  74. CPUMF_EVENT_ATTR(cf_z196, L1D_ONCHIP_L3_SOURCED_WRITES, 0x0096);
  75. CPUMF_EVENT_ATTR(cf_z196, L1D_OFFCHIP_L3_SOURCED_WRITES, 0x0098);
  76. CPUMF_EVENT_ATTR(cf_z196, L1I_ONCHIP_L3_SOURCED_WRITES, 0x0099);
  77. CPUMF_EVENT_ATTR(cf_z196, L1I_OFFCHIP_L3_SOURCED_WRITES, 0x009b);
  78. CPUMF_EVENT_ATTR(cf_zec12, DTLB1_MISSES, 0x0080);
  79. CPUMF_EVENT_ATTR(cf_zec12, ITLB1_MISSES, 0x0081);
  80. CPUMF_EVENT_ATTR(cf_zec12, L1D_L2I_SOURCED_WRITES, 0x0082);
  81. CPUMF_EVENT_ATTR(cf_zec12, L1I_L2I_SOURCED_WRITES, 0x0083);
  82. CPUMF_EVENT_ATTR(cf_zec12, L1D_L2D_SOURCED_WRITES, 0x0084);
  83. CPUMF_EVENT_ATTR(cf_zec12, DTLB1_WRITES, 0x0085);
  84. CPUMF_EVENT_ATTR(cf_zec12, L1D_LMEM_SOURCED_WRITES, 0x0087);
  85. CPUMF_EVENT_ATTR(cf_zec12, L1I_LMEM_SOURCED_WRITES, 0x0089);
  86. CPUMF_EVENT_ATTR(cf_zec12, L1D_RO_EXCL_WRITES, 0x008a);
  87. CPUMF_EVENT_ATTR(cf_zec12, DTLB1_HPAGE_WRITES, 0x008b);
  88. CPUMF_EVENT_ATTR(cf_zec12, ITLB1_WRITES, 0x008c);
  89. CPUMF_EVENT_ATTR(cf_zec12, TLB2_PTE_WRITES, 0x008d);
  90. CPUMF_EVENT_ATTR(cf_zec12, TLB2_CRSTE_HPAGE_WRITES, 0x008e);
  91. CPUMF_EVENT_ATTR(cf_zec12, TLB2_CRSTE_WRITES, 0x008f);
  92. CPUMF_EVENT_ATTR(cf_zec12, L1D_ONCHIP_L3_SOURCED_WRITES, 0x0090);
  93. CPUMF_EVENT_ATTR(cf_zec12, L1D_OFFCHIP_L3_SOURCED_WRITES, 0x0091);
  94. CPUMF_EVENT_ATTR(cf_zec12, L1D_OFFBOOK_L3_SOURCED_WRITES, 0x0092);
  95. CPUMF_EVENT_ATTR(cf_zec12, L1D_ONBOOK_L4_SOURCED_WRITES, 0x0093);
  96. CPUMF_EVENT_ATTR(cf_zec12, L1D_OFFBOOK_L4_SOURCED_WRITES, 0x0094);
  97. CPUMF_EVENT_ATTR(cf_zec12, TX_NC_TEND, 0x0095);
  98. CPUMF_EVENT_ATTR(cf_zec12, L1D_ONCHIP_L3_SOURCED_WRITES_IV, 0x0096);
  99. CPUMF_EVENT_ATTR(cf_zec12, L1D_OFFCHIP_L3_SOURCED_WRITES_IV, 0x0097);
  100. CPUMF_EVENT_ATTR(cf_zec12, L1D_OFFBOOK_L3_SOURCED_WRITES_IV, 0x0098);
  101. CPUMF_EVENT_ATTR(cf_zec12, L1I_ONCHIP_L3_SOURCED_WRITES, 0x0099);
  102. CPUMF_EVENT_ATTR(cf_zec12, L1I_OFFCHIP_L3_SOURCED_WRITES, 0x009a);
  103. CPUMF_EVENT_ATTR(cf_zec12, L1I_OFFBOOK_L3_SOURCED_WRITES, 0x009b);
  104. CPUMF_EVENT_ATTR(cf_zec12, L1I_ONBOOK_L4_SOURCED_WRITES, 0x009c);
  105. CPUMF_EVENT_ATTR(cf_zec12, L1I_OFFBOOK_L4_SOURCED_WRITES, 0x009d);
  106. CPUMF_EVENT_ATTR(cf_zec12, TX_C_TEND, 0x009e);
  107. CPUMF_EVENT_ATTR(cf_zec12, L1I_ONCHIP_L3_SOURCED_WRITES_IV, 0x009f);
  108. CPUMF_EVENT_ATTR(cf_zec12, L1I_OFFCHIP_L3_SOURCED_WRITES_IV, 0x00a0);
  109. CPUMF_EVENT_ATTR(cf_zec12, L1I_OFFBOOK_L3_SOURCED_WRITES_IV, 0x00a1);
  110. CPUMF_EVENT_ATTR(cf_zec12, TX_NC_TABORT, 0x00b1);
  111. CPUMF_EVENT_ATTR(cf_zec12, TX_C_TABORT_NO_SPECIAL, 0x00b2);
  112. CPUMF_EVENT_ATTR(cf_zec12, TX_C_TABORT_SPECIAL, 0x00b3);
  113. static struct attribute *cpumcf_pmu_event_attr[] = {
  114. CPUMF_EVENT_PTR(cf, CPU_CYCLES),
  115. CPUMF_EVENT_PTR(cf, INSTRUCTIONS),
  116. CPUMF_EVENT_PTR(cf, L1I_DIR_WRITES),
  117. CPUMF_EVENT_PTR(cf, L1I_PENALTY_CYCLES),
  118. CPUMF_EVENT_PTR(cf, PROBLEM_STATE_CPU_CYCLES),
  119. CPUMF_EVENT_PTR(cf, PROBLEM_STATE_INSTRUCTIONS),
  120. CPUMF_EVENT_PTR(cf, PROBLEM_STATE_L1I_DIR_WRITES),
  121. CPUMF_EVENT_PTR(cf, PROBLEM_STATE_L1I_PENALTY_CYCLES),
  122. CPUMF_EVENT_PTR(cf, PROBLEM_STATE_L1D_DIR_WRITES),
  123. CPUMF_EVENT_PTR(cf, PROBLEM_STATE_L1D_PENALTY_CYCLES),
  124. CPUMF_EVENT_PTR(cf, L1D_DIR_WRITES),
  125. CPUMF_EVENT_PTR(cf, L1D_PENALTY_CYCLES),
  126. CPUMF_EVENT_PTR(cf, PRNG_FUNCTIONS),
  127. CPUMF_EVENT_PTR(cf, PRNG_CYCLES),
  128. CPUMF_EVENT_PTR(cf, PRNG_BLOCKED_FUNCTIONS),
  129. CPUMF_EVENT_PTR(cf, PRNG_BLOCKED_CYCLES),
  130. CPUMF_EVENT_PTR(cf, SHA_FUNCTIONS),
  131. CPUMF_EVENT_PTR(cf, SHA_CYCLES),
  132. CPUMF_EVENT_PTR(cf, SHA_BLOCKED_FUNCTIONS),
  133. CPUMF_EVENT_PTR(cf, SHA_BLOCKED_CYCLES),
  134. CPUMF_EVENT_PTR(cf, DEA_FUNCTIONS),
  135. CPUMF_EVENT_PTR(cf, DEA_CYCLES),
  136. CPUMF_EVENT_PTR(cf, DEA_BLOCKED_FUNCTIONS),
  137. CPUMF_EVENT_PTR(cf, DEA_BLOCKED_CYCLES),
  138. CPUMF_EVENT_PTR(cf, AES_FUNCTIONS),
  139. CPUMF_EVENT_PTR(cf, AES_CYCLES),
  140. CPUMF_EVENT_PTR(cf, AES_BLOCKED_FUNCTIONS),
  141. CPUMF_EVENT_PTR(cf, AES_BLOCKED_CYCLES),
  142. NULL,
  143. };
  144. static struct attribute *cpumcf_z10_pmu_event_attr[] __initdata = {
  145. CPUMF_EVENT_PTR(cf_z10, L1I_L2_SOURCED_WRITES),
  146. CPUMF_EVENT_PTR(cf_z10, L1D_L2_SOURCED_WRITES),
  147. CPUMF_EVENT_PTR(cf_z10, L1I_L3_LOCAL_WRITES),
  148. CPUMF_EVENT_PTR(cf_z10, L1D_L3_LOCAL_WRITES),
  149. CPUMF_EVENT_PTR(cf_z10, L1I_L3_REMOTE_WRITES),
  150. CPUMF_EVENT_PTR(cf_z10, L1D_L3_REMOTE_WRITES),
  151. CPUMF_EVENT_PTR(cf_z10, L1D_LMEM_SOURCED_WRITES),
  152. CPUMF_EVENT_PTR(cf_z10, L1I_LMEM_SOURCED_WRITES),
  153. CPUMF_EVENT_PTR(cf_z10, L1D_RO_EXCL_WRITES),
  154. CPUMF_EVENT_PTR(cf_z10, L1I_CACHELINE_INVALIDATES),
  155. CPUMF_EVENT_PTR(cf_z10, ITLB1_WRITES),
  156. CPUMF_EVENT_PTR(cf_z10, DTLB1_WRITES),
  157. CPUMF_EVENT_PTR(cf_z10, TLB2_PTE_WRITES),
  158. CPUMF_EVENT_PTR(cf_z10, TLB2_CRSTE_WRITES),
  159. CPUMF_EVENT_PTR(cf_z10, TLB2_CRSTE_HPAGE_WRITES),
  160. CPUMF_EVENT_PTR(cf_z10, ITLB1_MISSES),
  161. CPUMF_EVENT_PTR(cf_z10, DTLB1_MISSES),
  162. CPUMF_EVENT_PTR(cf_z10, L2C_STORES_SENT),
  163. NULL,
  164. };
  165. static struct attribute *cpumcf_z196_pmu_event_attr[] __initdata = {
  166. CPUMF_EVENT_PTR(cf_z196, L1D_L2_SOURCED_WRITES),
  167. CPUMF_EVENT_PTR(cf_z196, L1I_L2_SOURCED_WRITES),
  168. CPUMF_EVENT_PTR(cf_z196, DTLB1_MISSES),
  169. CPUMF_EVENT_PTR(cf_z196, ITLB1_MISSES),
  170. CPUMF_EVENT_PTR(cf_z196, L2C_STORES_SENT),
  171. CPUMF_EVENT_PTR(cf_z196, L1D_OFFBOOK_L3_SOURCED_WRITES),
  172. CPUMF_EVENT_PTR(cf_z196, L1D_ONBOOK_L4_SOURCED_WRITES),
  173. CPUMF_EVENT_PTR(cf_z196, L1I_ONBOOK_L4_SOURCED_WRITES),
  174. CPUMF_EVENT_PTR(cf_z196, L1D_RO_EXCL_WRITES),
  175. CPUMF_EVENT_PTR(cf_z196, L1D_OFFBOOK_L4_SOURCED_WRITES),
  176. CPUMF_EVENT_PTR(cf_z196, L1I_OFFBOOK_L4_SOURCED_WRITES),
  177. CPUMF_EVENT_PTR(cf_z196, DTLB1_HPAGE_WRITES),
  178. CPUMF_EVENT_PTR(cf_z196, L1D_LMEM_SOURCED_WRITES),
  179. CPUMF_EVENT_PTR(cf_z196, L1I_LMEM_SOURCED_WRITES),
  180. CPUMF_EVENT_PTR(cf_z196, L1I_OFFBOOK_L3_SOURCED_WRITES),
  181. CPUMF_EVENT_PTR(cf_z196, DTLB1_WRITES),
  182. CPUMF_EVENT_PTR(cf_z196, ITLB1_WRITES),
  183. CPUMF_EVENT_PTR(cf_z196, TLB2_PTE_WRITES),
  184. CPUMF_EVENT_PTR(cf_z196, TLB2_CRSTE_HPAGE_WRITES),
  185. CPUMF_EVENT_PTR(cf_z196, TLB2_CRSTE_WRITES),
  186. CPUMF_EVENT_PTR(cf_z196, L1D_ONCHIP_L3_SOURCED_WRITES),
  187. CPUMF_EVENT_PTR(cf_z196, L1D_OFFCHIP_L3_SOURCED_WRITES),
  188. CPUMF_EVENT_PTR(cf_z196, L1I_ONCHIP_L3_SOURCED_WRITES),
  189. CPUMF_EVENT_PTR(cf_z196, L1I_OFFCHIP_L3_SOURCED_WRITES),
  190. NULL,
  191. };
  192. static struct attribute *cpumcf_zec12_pmu_event_attr[] __initdata = {
  193. CPUMF_EVENT_PTR(cf_zec12, DTLB1_MISSES),
  194. CPUMF_EVENT_PTR(cf_zec12, ITLB1_MISSES),
  195. CPUMF_EVENT_PTR(cf_zec12, L1D_L2I_SOURCED_WRITES),
  196. CPUMF_EVENT_PTR(cf_zec12, L1I_L2I_SOURCED_WRITES),
  197. CPUMF_EVENT_PTR(cf_zec12, L1D_L2D_SOURCED_WRITES),
  198. CPUMF_EVENT_PTR(cf_zec12, DTLB1_WRITES),
  199. CPUMF_EVENT_PTR(cf_zec12, L1D_LMEM_SOURCED_WRITES),
  200. CPUMF_EVENT_PTR(cf_zec12, L1I_LMEM_SOURCED_WRITES),
  201. CPUMF_EVENT_PTR(cf_zec12, L1D_RO_EXCL_WRITES),
  202. CPUMF_EVENT_PTR(cf_zec12, DTLB1_HPAGE_WRITES),
  203. CPUMF_EVENT_PTR(cf_zec12, ITLB1_WRITES),
  204. CPUMF_EVENT_PTR(cf_zec12, TLB2_PTE_WRITES),
  205. CPUMF_EVENT_PTR(cf_zec12, TLB2_CRSTE_HPAGE_WRITES),
  206. CPUMF_EVENT_PTR(cf_zec12, TLB2_CRSTE_WRITES),
  207. CPUMF_EVENT_PTR(cf_zec12, L1D_ONCHIP_L3_SOURCED_WRITES),
  208. CPUMF_EVENT_PTR(cf_zec12, L1D_OFFCHIP_L3_SOURCED_WRITES),
  209. CPUMF_EVENT_PTR(cf_zec12, L1D_OFFBOOK_L3_SOURCED_WRITES),
  210. CPUMF_EVENT_PTR(cf_zec12, L1D_ONBOOK_L4_SOURCED_WRITES),
  211. CPUMF_EVENT_PTR(cf_zec12, L1D_OFFBOOK_L4_SOURCED_WRITES),
  212. CPUMF_EVENT_PTR(cf_zec12, TX_NC_TEND),
  213. CPUMF_EVENT_PTR(cf_zec12, L1D_ONCHIP_L3_SOURCED_WRITES_IV),
  214. CPUMF_EVENT_PTR(cf_zec12, L1D_OFFCHIP_L3_SOURCED_WRITES_IV),
  215. CPUMF_EVENT_PTR(cf_zec12, L1D_OFFBOOK_L3_SOURCED_WRITES_IV),
  216. CPUMF_EVENT_PTR(cf_zec12, L1I_ONCHIP_L3_SOURCED_WRITES),
  217. CPUMF_EVENT_PTR(cf_zec12, L1I_OFFCHIP_L3_SOURCED_WRITES),
  218. CPUMF_EVENT_PTR(cf_zec12, L1I_OFFBOOK_L3_SOURCED_WRITES),
  219. CPUMF_EVENT_PTR(cf_zec12, L1I_ONBOOK_L4_SOURCED_WRITES),
  220. CPUMF_EVENT_PTR(cf_zec12, L1I_OFFBOOK_L4_SOURCED_WRITES),
  221. CPUMF_EVENT_PTR(cf_zec12, TX_C_TEND),
  222. CPUMF_EVENT_PTR(cf_zec12, L1I_ONCHIP_L3_SOURCED_WRITES_IV),
  223. CPUMF_EVENT_PTR(cf_zec12, L1I_OFFCHIP_L3_SOURCED_WRITES_IV),
  224. CPUMF_EVENT_PTR(cf_zec12, L1I_OFFBOOK_L3_SOURCED_WRITES_IV),
  225. CPUMF_EVENT_PTR(cf_zec12, TX_NC_TABORT),
  226. CPUMF_EVENT_PTR(cf_zec12, TX_C_TABORT_NO_SPECIAL),
  227. CPUMF_EVENT_PTR(cf_zec12, TX_C_TABORT_SPECIAL),
  228. NULL,
  229. };
  230. /* END: CPUM_CF COUNTER DEFINITIONS ===================================== */
  231. static struct attribute_group cpumsf_pmu_events_group = {
  232. .name = "events",
  233. .attrs = cpumcf_pmu_event_attr,
  234. };
  235. PMU_FORMAT_ATTR(event, "config:0-63");
  236. static struct attribute *cpumsf_pmu_format_attr[] = {
  237. &format_attr_event.attr,
  238. NULL,
  239. };
  240. static struct attribute_group cpumsf_pmu_format_group = {
  241. .name = "format",
  242. .attrs = cpumsf_pmu_format_attr,
  243. };
  244. static const struct attribute_group *cpumsf_pmu_attr_groups[] = {
  245. &cpumsf_pmu_events_group,
  246. &cpumsf_pmu_format_group,
  247. NULL,
  248. };
  249. static __init struct attribute **merge_attr(struct attribute **a,
  250. struct attribute **b)
  251. {
  252. struct attribute **new;
  253. int j, i;
  254. for (j = 0; a[j]; j++)
  255. ;
  256. for (i = 0; b[i]; i++)
  257. j++;
  258. j++;
  259. new = kmalloc(sizeof(struct attribute *) * j, GFP_KERNEL);
  260. if (!new)
  261. return NULL;
  262. j = 0;
  263. for (i = 0; a[i]; i++)
  264. new[j++] = a[i];
  265. for (i = 0; b[i]; i++)
  266. new[j++] = b[i];
  267. new[j] = NULL;
  268. return new;
  269. }
  270. __init const struct attribute_group **cpumf_cf_event_group(void)
  271. {
  272. struct attribute **combined, **model;
  273. struct cpuid cpu_id;
  274. get_cpu_id(&cpu_id);
  275. switch (cpu_id.machine) {
  276. case 0x2097:
  277. case 0x2098:
  278. model = cpumcf_z10_pmu_event_attr;
  279. break;
  280. case 0x2817:
  281. case 0x2818:
  282. model = cpumcf_z196_pmu_event_attr;
  283. break;
  284. case 0x2827:
  285. case 0x2828:
  286. model = cpumcf_zec12_pmu_event_attr;
  287. break;
  288. default:
  289. model = NULL;
  290. break;
  291. };
  292. if (!model)
  293. goto out;
  294. combined = merge_attr(cpumcf_pmu_event_attr, model);
  295. if (combined)
  296. cpumsf_pmu_events_group.attrs = combined;
  297. out:
  298. return cpumsf_pmu_attr_groups;
  299. }