coresight-etm3x-sysfs.c 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright(C) 2015 Linaro Limited. All rights reserved.
  4. * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
  5. */
  6. #include <linux/pid_namespace.h>
  7. #include <linux/pm_runtime.h>
  8. #include <linux/sysfs.h>
  9. #include "coresight-etm.h"
  10. #include "coresight-priv.h"
  11. static ssize_t nr_addr_cmp_show(struct device *dev,
  12. struct device_attribute *attr, char *buf)
  13. {
  14. unsigned long val;
  15. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  16. val = drvdata->nr_addr_cmp;
  17. return sprintf(buf, "%#lx\n", val);
  18. }
  19. static DEVICE_ATTR_RO(nr_addr_cmp);
  20. static ssize_t nr_cntr_show(struct device *dev,
  21. struct device_attribute *attr, char *buf)
  22. { unsigned long val;
  23. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  24. val = drvdata->nr_cntr;
  25. return sprintf(buf, "%#lx\n", val);
  26. }
  27. static DEVICE_ATTR_RO(nr_cntr);
  28. static ssize_t nr_ctxid_cmp_show(struct device *dev,
  29. struct device_attribute *attr, char *buf)
  30. {
  31. unsigned long val;
  32. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  33. val = drvdata->nr_ctxid_cmp;
  34. return sprintf(buf, "%#lx\n", val);
  35. }
  36. static DEVICE_ATTR_RO(nr_ctxid_cmp);
  37. static ssize_t etmsr_show(struct device *dev,
  38. struct device_attribute *attr, char *buf)
  39. {
  40. unsigned long flags, val;
  41. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  42. pm_runtime_get_sync(drvdata->dev);
  43. spin_lock_irqsave(&drvdata->spinlock, flags);
  44. CS_UNLOCK(drvdata->base);
  45. val = etm_readl(drvdata, ETMSR);
  46. CS_LOCK(drvdata->base);
  47. spin_unlock_irqrestore(&drvdata->spinlock, flags);
  48. pm_runtime_put(drvdata->dev);
  49. return sprintf(buf, "%#lx\n", val);
  50. }
  51. static DEVICE_ATTR_RO(etmsr);
  52. static ssize_t reset_store(struct device *dev,
  53. struct device_attribute *attr,
  54. const char *buf, size_t size)
  55. {
  56. int i, ret;
  57. unsigned long val;
  58. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  59. struct etm_config *config = &drvdata->config;
  60. ret = kstrtoul(buf, 16, &val);
  61. if (ret)
  62. return ret;
  63. if (val) {
  64. spin_lock(&drvdata->spinlock);
  65. memset(config, 0, sizeof(struct etm_config));
  66. config->mode = ETM_MODE_EXCLUDE;
  67. config->trigger_event = ETM_DEFAULT_EVENT_VAL;
  68. for (i = 0; i < drvdata->nr_addr_cmp; i++) {
  69. config->addr_type[i] = ETM_ADDR_TYPE_NONE;
  70. }
  71. etm_set_default(config);
  72. spin_unlock(&drvdata->spinlock);
  73. }
  74. return size;
  75. }
  76. static DEVICE_ATTR_WO(reset);
  77. static ssize_t mode_show(struct device *dev,
  78. struct device_attribute *attr, char *buf)
  79. {
  80. unsigned long val;
  81. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  82. struct etm_config *config = &drvdata->config;
  83. val = config->mode;
  84. return sprintf(buf, "%#lx\n", val);
  85. }
  86. static ssize_t mode_store(struct device *dev,
  87. struct device_attribute *attr,
  88. const char *buf, size_t size)
  89. {
  90. int ret;
  91. unsigned long val;
  92. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  93. struct etm_config *config = &drvdata->config;
  94. ret = kstrtoul(buf, 16, &val);
  95. if (ret)
  96. return ret;
  97. spin_lock(&drvdata->spinlock);
  98. config->mode = val & ETM_MODE_ALL;
  99. if (config->mode & ETM_MODE_EXCLUDE)
  100. config->enable_ctrl1 |= ETMTECR1_INC_EXC;
  101. else
  102. config->enable_ctrl1 &= ~ETMTECR1_INC_EXC;
  103. if (config->mode & ETM_MODE_CYCACC)
  104. config->ctrl |= ETMCR_CYC_ACC;
  105. else
  106. config->ctrl &= ~ETMCR_CYC_ACC;
  107. if (config->mode & ETM_MODE_STALL) {
  108. if (!(drvdata->etmccr & ETMCCR_FIFOFULL)) {
  109. dev_warn(drvdata->dev, "stall mode not supported\n");
  110. ret = -EINVAL;
  111. goto err_unlock;
  112. }
  113. config->ctrl |= ETMCR_STALL_MODE;
  114. } else
  115. config->ctrl &= ~ETMCR_STALL_MODE;
  116. if (config->mode & ETM_MODE_TIMESTAMP) {
  117. if (!(drvdata->etmccer & ETMCCER_TIMESTAMP)) {
  118. dev_warn(drvdata->dev, "timestamp not supported\n");
  119. ret = -EINVAL;
  120. goto err_unlock;
  121. }
  122. config->ctrl |= ETMCR_TIMESTAMP_EN;
  123. } else
  124. config->ctrl &= ~ETMCR_TIMESTAMP_EN;
  125. if (config->mode & ETM_MODE_CTXID)
  126. config->ctrl |= ETMCR_CTXID_SIZE;
  127. else
  128. config->ctrl &= ~ETMCR_CTXID_SIZE;
  129. if (config->mode & ETM_MODE_BBROAD)
  130. config->ctrl |= ETMCR_BRANCH_BROADCAST;
  131. else
  132. config->ctrl &= ~ETMCR_BRANCH_BROADCAST;
  133. if (config->mode & ETM_MODE_RET_STACK)
  134. config->ctrl |= ETMCR_RETURN_STACK;
  135. else
  136. config->ctrl &= ~ETMCR_RETURN_STACK;
  137. if (config->mode & (ETM_MODE_EXCL_KERN | ETM_MODE_EXCL_USER))
  138. etm_config_trace_mode(config);
  139. spin_unlock(&drvdata->spinlock);
  140. return size;
  141. err_unlock:
  142. spin_unlock(&drvdata->spinlock);
  143. return ret;
  144. }
  145. static DEVICE_ATTR_RW(mode);
  146. static ssize_t trigger_event_show(struct device *dev,
  147. struct device_attribute *attr, char *buf)
  148. {
  149. unsigned long val;
  150. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  151. struct etm_config *config = &drvdata->config;
  152. val = config->trigger_event;
  153. return sprintf(buf, "%#lx\n", val);
  154. }
  155. static ssize_t trigger_event_store(struct device *dev,
  156. struct device_attribute *attr,
  157. const char *buf, size_t size)
  158. {
  159. int ret;
  160. unsigned long val;
  161. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  162. struct etm_config *config = &drvdata->config;
  163. ret = kstrtoul(buf, 16, &val);
  164. if (ret)
  165. return ret;
  166. config->trigger_event = val & ETM_EVENT_MASK;
  167. return size;
  168. }
  169. static DEVICE_ATTR_RW(trigger_event);
  170. static ssize_t enable_event_show(struct device *dev,
  171. struct device_attribute *attr, char *buf)
  172. {
  173. unsigned long val;
  174. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  175. struct etm_config *config = &drvdata->config;
  176. val = config->enable_event;
  177. return sprintf(buf, "%#lx\n", val);
  178. }
  179. static ssize_t enable_event_store(struct device *dev,
  180. struct device_attribute *attr,
  181. const char *buf, size_t size)
  182. {
  183. int ret;
  184. unsigned long val;
  185. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  186. struct etm_config *config = &drvdata->config;
  187. ret = kstrtoul(buf, 16, &val);
  188. if (ret)
  189. return ret;
  190. config->enable_event = val & ETM_EVENT_MASK;
  191. return size;
  192. }
  193. static DEVICE_ATTR_RW(enable_event);
  194. static ssize_t fifofull_level_show(struct device *dev,
  195. struct device_attribute *attr, char *buf)
  196. {
  197. unsigned long val;
  198. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  199. struct etm_config *config = &drvdata->config;
  200. val = config->fifofull_level;
  201. return sprintf(buf, "%#lx\n", val);
  202. }
  203. static ssize_t fifofull_level_store(struct device *dev,
  204. struct device_attribute *attr,
  205. const char *buf, size_t size)
  206. {
  207. int ret;
  208. unsigned long val;
  209. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  210. struct etm_config *config = &drvdata->config;
  211. ret = kstrtoul(buf, 16, &val);
  212. if (ret)
  213. return ret;
  214. config->fifofull_level = val;
  215. return size;
  216. }
  217. static DEVICE_ATTR_RW(fifofull_level);
  218. static ssize_t addr_idx_show(struct device *dev,
  219. struct device_attribute *attr, char *buf)
  220. {
  221. unsigned long val;
  222. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  223. struct etm_config *config = &drvdata->config;
  224. val = config->addr_idx;
  225. return sprintf(buf, "%#lx\n", val);
  226. }
  227. static ssize_t addr_idx_store(struct device *dev,
  228. struct device_attribute *attr,
  229. const char *buf, size_t size)
  230. {
  231. int ret;
  232. unsigned long val;
  233. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  234. struct etm_config *config = &drvdata->config;
  235. ret = kstrtoul(buf, 16, &val);
  236. if (ret)
  237. return ret;
  238. if (val >= drvdata->nr_addr_cmp)
  239. return -EINVAL;
  240. /*
  241. * Use spinlock to ensure index doesn't change while it gets
  242. * dereferenced multiple times within a spinlock block elsewhere.
  243. */
  244. spin_lock(&drvdata->spinlock);
  245. config->addr_idx = val;
  246. spin_unlock(&drvdata->spinlock);
  247. return size;
  248. }
  249. static DEVICE_ATTR_RW(addr_idx);
  250. static ssize_t addr_single_show(struct device *dev,
  251. struct device_attribute *attr, char *buf)
  252. {
  253. u8 idx;
  254. unsigned long val;
  255. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  256. struct etm_config *config = &drvdata->config;
  257. spin_lock(&drvdata->spinlock);
  258. idx = config->addr_idx;
  259. if (!(config->addr_type[idx] == ETM_ADDR_TYPE_NONE ||
  260. config->addr_type[idx] == ETM_ADDR_TYPE_SINGLE)) {
  261. spin_unlock(&drvdata->spinlock);
  262. return -EINVAL;
  263. }
  264. val = config->addr_val[idx];
  265. spin_unlock(&drvdata->spinlock);
  266. return sprintf(buf, "%#lx\n", val);
  267. }
  268. static ssize_t addr_single_store(struct device *dev,
  269. struct device_attribute *attr,
  270. const char *buf, size_t size)
  271. {
  272. u8 idx;
  273. int ret;
  274. unsigned long val;
  275. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  276. struct etm_config *config = &drvdata->config;
  277. ret = kstrtoul(buf, 16, &val);
  278. if (ret)
  279. return ret;
  280. spin_lock(&drvdata->spinlock);
  281. idx = config->addr_idx;
  282. if (!(config->addr_type[idx] == ETM_ADDR_TYPE_NONE ||
  283. config->addr_type[idx] == ETM_ADDR_TYPE_SINGLE)) {
  284. spin_unlock(&drvdata->spinlock);
  285. return -EINVAL;
  286. }
  287. config->addr_val[idx] = val;
  288. config->addr_type[idx] = ETM_ADDR_TYPE_SINGLE;
  289. spin_unlock(&drvdata->spinlock);
  290. return size;
  291. }
  292. static DEVICE_ATTR_RW(addr_single);
  293. static ssize_t addr_range_show(struct device *dev,
  294. struct device_attribute *attr, char *buf)
  295. {
  296. u8 idx;
  297. unsigned long val1, val2;
  298. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  299. struct etm_config *config = &drvdata->config;
  300. spin_lock(&drvdata->spinlock);
  301. idx = config->addr_idx;
  302. if (idx % 2 != 0) {
  303. spin_unlock(&drvdata->spinlock);
  304. return -EPERM;
  305. }
  306. if (!((config->addr_type[idx] == ETM_ADDR_TYPE_NONE &&
  307. config->addr_type[idx + 1] == ETM_ADDR_TYPE_NONE) ||
  308. (config->addr_type[idx] == ETM_ADDR_TYPE_RANGE &&
  309. config->addr_type[idx + 1] == ETM_ADDR_TYPE_RANGE))) {
  310. spin_unlock(&drvdata->spinlock);
  311. return -EPERM;
  312. }
  313. val1 = config->addr_val[idx];
  314. val2 = config->addr_val[idx + 1];
  315. spin_unlock(&drvdata->spinlock);
  316. return sprintf(buf, "%#lx %#lx\n", val1, val2);
  317. }
  318. static ssize_t addr_range_store(struct device *dev,
  319. struct device_attribute *attr,
  320. const char *buf, size_t size)
  321. {
  322. u8 idx;
  323. unsigned long val1, val2;
  324. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  325. struct etm_config *config = &drvdata->config;
  326. if (sscanf(buf, "%lx %lx", &val1, &val2) != 2)
  327. return -EINVAL;
  328. /* Lower address comparator cannot have a higher address value */
  329. if (val1 > val2)
  330. return -EINVAL;
  331. spin_lock(&drvdata->spinlock);
  332. idx = config->addr_idx;
  333. if (idx % 2 != 0) {
  334. spin_unlock(&drvdata->spinlock);
  335. return -EPERM;
  336. }
  337. if (!((config->addr_type[idx] == ETM_ADDR_TYPE_NONE &&
  338. config->addr_type[idx + 1] == ETM_ADDR_TYPE_NONE) ||
  339. (config->addr_type[idx] == ETM_ADDR_TYPE_RANGE &&
  340. config->addr_type[idx + 1] == ETM_ADDR_TYPE_RANGE))) {
  341. spin_unlock(&drvdata->spinlock);
  342. return -EPERM;
  343. }
  344. config->addr_val[idx] = val1;
  345. config->addr_type[idx] = ETM_ADDR_TYPE_RANGE;
  346. config->addr_val[idx + 1] = val2;
  347. config->addr_type[idx + 1] = ETM_ADDR_TYPE_RANGE;
  348. config->enable_ctrl1 |= (1 << (idx/2));
  349. spin_unlock(&drvdata->spinlock);
  350. return size;
  351. }
  352. static DEVICE_ATTR_RW(addr_range);
  353. static ssize_t addr_start_show(struct device *dev,
  354. struct device_attribute *attr, char *buf)
  355. {
  356. u8 idx;
  357. unsigned long val;
  358. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  359. struct etm_config *config = &drvdata->config;
  360. spin_lock(&drvdata->spinlock);
  361. idx = config->addr_idx;
  362. if (!(config->addr_type[idx] == ETM_ADDR_TYPE_NONE ||
  363. config->addr_type[idx] == ETM_ADDR_TYPE_START)) {
  364. spin_unlock(&drvdata->spinlock);
  365. return -EPERM;
  366. }
  367. val = config->addr_val[idx];
  368. spin_unlock(&drvdata->spinlock);
  369. return sprintf(buf, "%#lx\n", val);
  370. }
  371. static ssize_t addr_start_store(struct device *dev,
  372. struct device_attribute *attr,
  373. const char *buf, size_t size)
  374. {
  375. u8 idx;
  376. int ret;
  377. unsigned long val;
  378. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  379. struct etm_config *config = &drvdata->config;
  380. ret = kstrtoul(buf, 16, &val);
  381. if (ret)
  382. return ret;
  383. spin_lock(&drvdata->spinlock);
  384. idx = config->addr_idx;
  385. if (!(config->addr_type[idx] == ETM_ADDR_TYPE_NONE ||
  386. config->addr_type[idx] == ETM_ADDR_TYPE_START)) {
  387. spin_unlock(&drvdata->spinlock);
  388. return -EPERM;
  389. }
  390. config->addr_val[idx] = val;
  391. config->addr_type[idx] = ETM_ADDR_TYPE_START;
  392. config->startstop_ctrl |= (1 << idx);
  393. config->enable_ctrl1 |= BIT(25);
  394. spin_unlock(&drvdata->spinlock);
  395. return size;
  396. }
  397. static DEVICE_ATTR_RW(addr_start);
  398. static ssize_t addr_stop_show(struct device *dev,
  399. struct device_attribute *attr, char *buf)
  400. {
  401. u8 idx;
  402. unsigned long val;
  403. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  404. struct etm_config *config = &drvdata->config;
  405. spin_lock(&drvdata->spinlock);
  406. idx = config->addr_idx;
  407. if (!(config->addr_type[idx] == ETM_ADDR_TYPE_NONE ||
  408. config->addr_type[idx] == ETM_ADDR_TYPE_STOP)) {
  409. spin_unlock(&drvdata->spinlock);
  410. return -EPERM;
  411. }
  412. val = config->addr_val[idx];
  413. spin_unlock(&drvdata->spinlock);
  414. return sprintf(buf, "%#lx\n", val);
  415. }
  416. static ssize_t addr_stop_store(struct device *dev,
  417. struct device_attribute *attr,
  418. const char *buf, size_t size)
  419. {
  420. u8 idx;
  421. int ret;
  422. unsigned long val;
  423. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  424. struct etm_config *config = &drvdata->config;
  425. ret = kstrtoul(buf, 16, &val);
  426. if (ret)
  427. return ret;
  428. spin_lock(&drvdata->spinlock);
  429. idx = config->addr_idx;
  430. if (!(config->addr_type[idx] == ETM_ADDR_TYPE_NONE ||
  431. config->addr_type[idx] == ETM_ADDR_TYPE_STOP)) {
  432. spin_unlock(&drvdata->spinlock);
  433. return -EPERM;
  434. }
  435. config->addr_val[idx] = val;
  436. config->addr_type[idx] = ETM_ADDR_TYPE_STOP;
  437. config->startstop_ctrl |= (1 << (idx + 16));
  438. config->enable_ctrl1 |= ETMTECR1_START_STOP;
  439. spin_unlock(&drvdata->spinlock);
  440. return size;
  441. }
  442. static DEVICE_ATTR_RW(addr_stop);
  443. static ssize_t addr_acctype_show(struct device *dev,
  444. struct device_attribute *attr, char *buf)
  445. {
  446. unsigned long val;
  447. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  448. struct etm_config *config = &drvdata->config;
  449. spin_lock(&drvdata->spinlock);
  450. val = config->addr_acctype[config->addr_idx];
  451. spin_unlock(&drvdata->spinlock);
  452. return sprintf(buf, "%#lx\n", val);
  453. }
  454. static ssize_t addr_acctype_store(struct device *dev,
  455. struct device_attribute *attr,
  456. const char *buf, size_t size)
  457. {
  458. int ret;
  459. unsigned long val;
  460. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  461. struct etm_config *config = &drvdata->config;
  462. ret = kstrtoul(buf, 16, &val);
  463. if (ret)
  464. return ret;
  465. spin_lock(&drvdata->spinlock);
  466. config->addr_acctype[config->addr_idx] = val;
  467. spin_unlock(&drvdata->spinlock);
  468. return size;
  469. }
  470. static DEVICE_ATTR_RW(addr_acctype);
  471. static ssize_t cntr_idx_show(struct device *dev,
  472. struct device_attribute *attr, char *buf)
  473. {
  474. unsigned long val;
  475. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  476. struct etm_config *config = &drvdata->config;
  477. val = config->cntr_idx;
  478. return sprintf(buf, "%#lx\n", val);
  479. }
  480. static ssize_t cntr_idx_store(struct device *dev,
  481. struct device_attribute *attr,
  482. const char *buf, size_t size)
  483. {
  484. int ret;
  485. unsigned long val;
  486. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  487. struct etm_config *config = &drvdata->config;
  488. ret = kstrtoul(buf, 16, &val);
  489. if (ret)
  490. return ret;
  491. if (val >= drvdata->nr_cntr)
  492. return -EINVAL;
  493. /*
  494. * Use spinlock to ensure index doesn't change while it gets
  495. * dereferenced multiple times within a spinlock block elsewhere.
  496. */
  497. spin_lock(&drvdata->spinlock);
  498. config->cntr_idx = val;
  499. spin_unlock(&drvdata->spinlock);
  500. return size;
  501. }
  502. static DEVICE_ATTR_RW(cntr_idx);
  503. static ssize_t cntr_rld_val_show(struct device *dev,
  504. struct device_attribute *attr, char *buf)
  505. {
  506. unsigned long val;
  507. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  508. struct etm_config *config = &drvdata->config;
  509. spin_lock(&drvdata->spinlock);
  510. val = config->cntr_rld_val[config->cntr_idx];
  511. spin_unlock(&drvdata->spinlock);
  512. return sprintf(buf, "%#lx\n", val);
  513. }
  514. static ssize_t cntr_rld_val_store(struct device *dev,
  515. struct device_attribute *attr,
  516. const char *buf, size_t size)
  517. {
  518. int ret;
  519. unsigned long val;
  520. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  521. struct etm_config *config = &drvdata->config;
  522. ret = kstrtoul(buf, 16, &val);
  523. if (ret)
  524. return ret;
  525. spin_lock(&drvdata->spinlock);
  526. config->cntr_rld_val[config->cntr_idx] = val;
  527. spin_unlock(&drvdata->spinlock);
  528. return size;
  529. }
  530. static DEVICE_ATTR_RW(cntr_rld_val);
  531. static ssize_t cntr_event_show(struct device *dev,
  532. struct device_attribute *attr, char *buf)
  533. {
  534. unsigned long val;
  535. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  536. struct etm_config *config = &drvdata->config;
  537. spin_lock(&drvdata->spinlock);
  538. val = config->cntr_event[config->cntr_idx];
  539. spin_unlock(&drvdata->spinlock);
  540. return sprintf(buf, "%#lx\n", val);
  541. }
  542. static ssize_t cntr_event_store(struct device *dev,
  543. struct device_attribute *attr,
  544. const char *buf, size_t size)
  545. {
  546. int ret;
  547. unsigned long val;
  548. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  549. struct etm_config *config = &drvdata->config;
  550. ret = kstrtoul(buf, 16, &val);
  551. if (ret)
  552. return ret;
  553. spin_lock(&drvdata->spinlock);
  554. config->cntr_event[config->cntr_idx] = val & ETM_EVENT_MASK;
  555. spin_unlock(&drvdata->spinlock);
  556. return size;
  557. }
  558. static DEVICE_ATTR_RW(cntr_event);
  559. static ssize_t cntr_rld_event_show(struct device *dev,
  560. struct device_attribute *attr, char *buf)
  561. {
  562. unsigned long val;
  563. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  564. struct etm_config *config = &drvdata->config;
  565. spin_lock(&drvdata->spinlock);
  566. val = config->cntr_rld_event[config->cntr_idx];
  567. spin_unlock(&drvdata->spinlock);
  568. return sprintf(buf, "%#lx\n", val);
  569. }
  570. static ssize_t cntr_rld_event_store(struct device *dev,
  571. struct device_attribute *attr,
  572. const char *buf, size_t size)
  573. {
  574. int ret;
  575. unsigned long val;
  576. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  577. struct etm_config *config = &drvdata->config;
  578. ret = kstrtoul(buf, 16, &val);
  579. if (ret)
  580. return ret;
  581. spin_lock(&drvdata->spinlock);
  582. config->cntr_rld_event[config->cntr_idx] = val & ETM_EVENT_MASK;
  583. spin_unlock(&drvdata->spinlock);
  584. return size;
  585. }
  586. static DEVICE_ATTR_RW(cntr_rld_event);
  587. static ssize_t cntr_val_show(struct device *dev,
  588. struct device_attribute *attr, char *buf)
  589. {
  590. int i, ret = 0;
  591. u32 val;
  592. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  593. struct etm_config *config = &drvdata->config;
  594. if (!local_read(&drvdata->mode)) {
  595. spin_lock(&drvdata->spinlock);
  596. for (i = 0; i < drvdata->nr_cntr; i++)
  597. ret += sprintf(buf, "counter %d: %x\n",
  598. i, config->cntr_val[i]);
  599. spin_unlock(&drvdata->spinlock);
  600. return ret;
  601. }
  602. for (i = 0; i < drvdata->nr_cntr; i++) {
  603. val = etm_readl(drvdata, ETMCNTVRn(i));
  604. ret += sprintf(buf, "counter %d: %x\n", i, val);
  605. }
  606. return ret;
  607. }
  608. static ssize_t cntr_val_store(struct device *dev,
  609. struct device_attribute *attr,
  610. const char *buf, size_t size)
  611. {
  612. int ret;
  613. unsigned long val;
  614. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  615. struct etm_config *config = &drvdata->config;
  616. ret = kstrtoul(buf, 16, &val);
  617. if (ret)
  618. return ret;
  619. spin_lock(&drvdata->spinlock);
  620. config->cntr_val[config->cntr_idx] = val;
  621. spin_unlock(&drvdata->spinlock);
  622. return size;
  623. }
  624. static DEVICE_ATTR_RW(cntr_val);
  625. static ssize_t seq_12_event_show(struct device *dev,
  626. struct device_attribute *attr, char *buf)
  627. {
  628. unsigned long val;
  629. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  630. struct etm_config *config = &drvdata->config;
  631. val = config->seq_12_event;
  632. return sprintf(buf, "%#lx\n", val);
  633. }
  634. static ssize_t seq_12_event_store(struct device *dev,
  635. struct device_attribute *attr,
  636. const char *buf, size_t size)
  637. {
  638. int ret;
  639. unsigned long val;
  640. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  641. struct etm_config *config = &drvdata->config;
  642. ret = kstrtoul(buf, 16, &val);
  643. if (ret)
  644. return ret;
  645. config->seq_12_event = val & ETM_EVENT_MASK;
  646. return size;
  647. }
  648. static DEVICE_ATTR_RW(seq_12_event);
  649. static ssize_t seq_21_event_show(struct device *dev,
  650. struct device_attribute *attr, char *buf)
  651. {
  652. unsigned long val;
  653. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  654. struct etm_config *config = &drvdata->config;
  655. val = config->seq_21_event;
  656. return sprintf(buf, "%#lx\n", val);
  657. }
  658. static ssize_t seq_21_event_store(struct device *dev,
  659. struct device_attribute *attr,
  660. const char *buf, size_t size)
  661. {
  662. int ret;
  663. unsigned long val;
  664. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  665. struct etm_config *config = &drvdata->config;
  666. ret = kstrtoul(buf, 16, &val);
  667. if (ret)
  668. return ret;
  669. config->seq_21_event = val & ETM_EVENT_MASK;
  670. return size;
  671. }
  672. static DEVICE_ATTR_RW(seq_21_event);
  673. static ssize_t seq_23_event_show(struct device *dev,
  674. struct device_attribute *attr, char *buf)
  675. {
  676. unsigned long val;
  677. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  678. struct etm_config *config = &drvdata->config;
  679. val = config->seq_23_event;
  680. return sprintf(buf, "%#lx\n", val);
  681. }
  682. static ssize_t seq_23_event_store(struct device *dev,
  683. struct device_attribute *attr,
  684. const char *buf, size_t size)
  685. {
  686. int ret;
  687. unsigned long val;
  688. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  689. struct etm_config *config = &drvdata->config;
  690. ret = kstrtoul(buf, 16, &val);
  691. if (ret)
  692. return ret;
  693. config->seq_23_event = val & ETM_EVENT_MASK;
  694. return size;
  695. }
  696. static DEVICE_ATTR_RW(seq_23_event);
  697. static ssize_t seq_31_event_show(struct device *dev,
  698. struct device_attribute *attr, char *buf)
  699. {
  700. unsigned long val;
  701. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  702. struct etm_config *config = &drvdata->config;
  703. val = config->seq_31_event;
  704. return sprintf(buf, "%#lx\n", val);
  705. }
  706. static ssize_t seq_31_event_store(struct device *dev,
  707. struct device_attribute *attr,
  708. const char *buf, size_t size)
  709. {
  710. int ret;
  711. unsigned long val;
  712. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  713. struct etm_config *config = &drvdata->config;
  714. ret = kstrtoul(buf, 16, &val);
  715. if (ret)
  716. return ret;
  717. config->seq_31_event = val & ETM_EVENT_MASK;
  718. return size;
  719. }
  720. static DEVICE_ATTR_RW(seq_31_event);
  721. static ssize_t seq_32_event_show(struct device *dev,
  722. struct device_attribute *attr, char *buf)
  723. {
  724. unsigned long val;
  725. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  726. struct etm_config *config = &drvdata->config;
  727. val = config->seq_32_event;
  728. return sprintf(buf, "%#lx\n", val);
  729. }
  730. static ssize_t seq_32_event_store(struct device *dev,
  731. struct device_attribute *attr,
  732. const char *buf, size_t size)
  733. {
  734. int ret;
  735. unsigned long val;
  736. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  737. struct etm_config *config = &drvdata->config;
  738. ret = kstrtoul(buf, 16, &val);
  739. if (ret)
  740. return ret;
  741. config->seq_32_event = val & ETM_EVENT_MASK;
  742. return size;
  743. }
  744. static DEVICE_ATTR_RW(seq_32_event);
  745. static ssize_t seq_13_event_show(struct device *dev,
  746. struct device_attribute *attr, char *buf)
  747. {
  748. unsigned long val;
  749. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  750. struct etm_config *config = &drvdata->config;
  751. val = config->seq_13_event;
  752. return sprintf(buf, "%#lx\n", val);
  753. }
  754. static ssize_t seq_13_event_store(struct device *dev,
  755. struct device_attribute *attr,
  756. const char *buf, size_t size)
  757. {
  758. int ret;
  759. unsigned long val;
  760. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  761. struct etm_config *config = &drvdata->config;
  762. ret = kstrtoul(buf, 16, &val);
  763. if (ret)
  764. return ret;
  765. config->seq_13_event = val & ETM_EVENT_MASK;
  766. return size;
  767. }
  768. static DEVICE_ATTR_RW(seq_13_event);
  769. static ssize_t seq_curr_state_show(struct device *dev,
  770. struct device_attribute *attr, char *buf)
  771. {
  772. unsigned long val, flags;
  773. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  774. struct etm_config *config = &drvdata->config;
  775. if (!local_read(&drvdata->mode)) {
  776. val = config->seq_curr_state;
  777. goto out;
  778. }
  779. pm_runtime_get_sync(drvdata->dev);
  780. spin_lock_irqsave(&drvdata->spinlock, flags);
  781. CS_UNLOCK(drvdata->base);
  782. val = (etm_readl(drvdata, ETMSQR) & ETM_SQR_MASK);
  783. CS_LOCK(drvdata->base);
  784. spin_unlock_irqrestore(&drvdata->spinlock, flags);
  785. pm_runtime_put(drvdata->dev);
  786. out:
  787. return sprintf(buf, "%#lx\n", val);
  788. }
  789. static ssize_t seq_curr_state_store(struct device *dev,
  790. struct device_attribute *attr,
  791. const char *buf, size_t size)
  792. {
  793. int ret;
  794. unsigned long val;
  795. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  796. struct etm_config *config = &drvdata->config;
  797. ret = kstrtoul(buf, 16, &val);
  798. if (ret)
  799. return ret;
  800. if (val > ETM_SEQ_STATE_MAX_VAL)
  801. return -EINVAL;
  802. config->seq_curr_state = val;
  803. return size;
  804. }
  805. static DEVICE_ATTR_RW(seq_curr_state);
  806. static ssize_t ctxid_idx_show(struct device *dev,
  807. struct device_attribute *attr, char *buf)
  808. {
  809. unsigned long val;
  810. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  811. struct etm_config *config = &drvdata->config;
  812. val = config->ctxid_idx;
  813. return sprintf(buf, "%#lx\n", val);
  814. }
  815. static ssize_t ctxid_idx_store(struct device *dev,
  816. struct device_attribute *attr,
  817. const char *buf, size_t size)
  818. {
  819. int ret;
  820. unsigned long val;
  821. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  822. struct etm_config *config = &drvdata->config;
  823. ret = kstrtoul(buf, 16, &val);
  824. if (ret)
  825. return ret;
  826. if (val >= drvdata->nr_ctxid_cmp)
  827. return -EINVAL;
  828. /*
  829. * Use spinlock to ensure index doesn't change while it gets
  830. * dereferenced multiple times within a spinlock block elsewhere.
  831. */
  832. spin_lock(&drvdata->spinlock);
  833. config->ctxid_idx = val;
  834. spin_unlock(&drvdata->spinlock);
  835. return size;
  836. }
  837. static DEVICE_ATTR_RW(ctxid_idx);
  838. static ssize_t ctxid_pid_show(struct device *dev,
  839. struct device_attribute *attr, char *buf)
  840. {
  841. unsigned long val;
  842. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  843. struct etm_config *config = &drvdata->config;
  844. /*
  845. * Don't use contextID tracing if coming from a PID namespace. See
  846. * comment in ctxid_pid_store().
  847. */
  848. if (task_active_pid_ns(current) != &init_pid_ns)
  849. return -EINVAL;
  850. spin_lock(&drvdata->spinlock);
  851. val = config->ctxid_pid[config->ctxid_idx];
  852. spin_unlock(&drvdata->spinlock);
  853. return sprintf(buf, "%#lx\n", val);
  854. }
  855. static ssize_t ctxid_pid_store(struct device *dev,
  856. struct device_attribute *attr,
  857. const char *buf, size_t size)
  858. {
  859. int ret;
  860. unsigned long pid;
  861. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  862. struct etm_config *config = &drvdata->config;
  863. /*
  864. * When contextID tracing is enabled the tracers will insert the
  865. * value found in the contextID register in the trace stream. But if
  866. * a process is in a namespace the PID of that process as seen from the
  867. * namespace won't be what the kernel sees, something that makes the
  868. * feature confusing and can potentially leak kernel only information.
  869. * As such refuse to use the feature if @current is not in the initial
  870. * PID namespace.
  871. */
  872. if (task_active_pid_ns(current) != &init_pid_ns)
  873. return -EINVAL;
  874. ret = kstrtoul(buf, 16, &pid);
  875. if (ret)
  876. return ret;
  877. spin_lock(&drvdata->spinlock);
  878. config->ctxid_pid[config->ctxid_idx] = pid;
  879. spin_unlock(&drvdata->spinlock);
  880. return size;
  881. }
  882. static DEVICE_ATTR_RW(ctxid_pid);
  883. static ssize_t ctxid_mask_show(struct device *dev,
  884. struct device_attribute *attr, char *buf)
  885. {
  886. unsigned long val;
  887. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  888. struct etm_config *config = &drvdata->config;
  889. /*
  890. * Don't use contextID tracing if coming from a PID namespace. See
  891. * comment in ctxid_pid_store().
  892. */
  893. if (task_active_pid_ns(current) != &init_pid_ns)
  894. return -EINVAL;
  895. val = config->ctxid_mask;
  896. return sprintf(buf, "%#lx\n", val);
  897. }
  898. static ssize_t ctxid_mask_store(struct device *dev,
  899. struct device_attribute *attr,
  900. const char *buf, size_t size)
  901. {
  902. int ret;
  903. unsigned long val;
  904. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  905. struct etm_config *config = &drvdata->config;
  906. /*
  907. * Don't use contextID tracing if coming from a PID namespace. See
  908. * comment in ctxid_pid_store().
  909. */
  910. if (task_active_pid_ns(current) != &init_pid_ns)
  911. return -EINVAL;
  912. ret = kstrtoul(buf, 16, &val);
  913. if (ret)
  914. return ret;
  915. config->ctxid_mask = val;
  916. return size;
  917. }
  918. static DEVICE_ATTR_RW(ctxid_mask);
  919. static ssize_t sync_freq_show(struct device *dev,
  920. struct device_attribute *attr, char *buf)
  921. {
  922. unsigned long val;
  923. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  924. struct etm_config *config = &drvdata->config;
  925. val = config->sync_freq;
  926. return sprintf(buf, "%#lx\n", val);
  927. }
  928. static ssize_t sync_freq_store(struct device *dev,
  929. struct device_attribute *attr,
  930. const char *buf, size_t size)
  931. {
  932. int ret;
  933. unsigned long val;
  934. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  935. struct etm_config *config = &drvdata->config;
  936. ret = kstrtoul(buf, 16, &val);
  937. if (ret)
  938. return ret;
  939. config->sync_freq = val & ETM_SYNC_MASK;
  940. return size;
  941. }
  942. static DEVICE_ATTR_RW(sync_freq);
  943. static ssize_t timestamp_event_show(struct device *dev,
  944. struct device_attribute *attr, char *buf)
  945. {
  946. unsigned long val;
  947. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  948. struct etm_config *config = &drvdata->config;
  949. val = config->timestamp_event;
  950. return sprintf(buf, "%#lx\n", val);
  951. }
  952. static ssize_t timestamp_event_store(struct device *dev,
  953. struct device_attribute *attr,
  954. const char *buf, size_t size)
  955. {
  956. int ret;
  957. unsigned long val;
  958. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  959. struct etm_config *config = &drvdata->config;
  960. ret = kstrtoul(buf, 16, &val);
  961. if (ret)
  962. return ret;
  963. config->timestamp_event = val & ETM_EVENT_MASK;
  964. return size;
  965. }
  966. static DEVICE_ATTR_RW(timestamp_event);
  967. static ssize_t cpu_show(struct device *dev,
  968. struct device_attribute *attr, char *buf)
  969. {
  970. int val;
  971. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  972. val = drvdata->cpu;
  973. return scnprintf(buf, PAGE_SIZE, "%d\n", val);
  974. }
  975. static DEVICE_ATTR_RO(cpu);
  976. static ssize_t traceid_show(struct device *dev,
  977. struct device_attribute *attr, char *buf)
  978. {
  979. unsigned long val;
  980. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  981. val = etm_get_trace_id(drvdata);
  982. return sprintf(buf, "%#lx\n", val);
  983. }
  984. static ssize_t traceid_store(struct device *dev,
  985. struct device_attribute *attr,
  986. const char *buf, size_t size)
  987. {
  988. int ret;
  989. unsigned long val;
  990. struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent);
  991. ret = kstrtoul(buf, 16, &val);
  992. if (ret)
  993. return ret;
  994. drvdata->traceid = val & ETM_TRACEID_MASK;
  995. return size;
  996. }
  997. static DEVICE_ATTR_RW(traceid);
  998. static struct attribute *coresight_etm_attrs[] = {
  999. &dev_attr_nr_addr_cmp.attr,
  1000. &dev_attr_nr_cntr.attr,
  1001. &dev_attr_nr_ctxid_cmp.attr,
  1002. &dev_attr_etmsr.attr,
  1003. &dev_attr_reset.attr,
  1004. &dev_attr_mode.attr,
  1005. &dev_attr_trigger_event.attr,
  1006. &dev_attr_enable_event.attr,
  1007. &dev_attr_fifofull_level.attr,
  1008. &dev_attr_addr_idx.attr,
  1009. &dev_attr_addr_single.attr,
  1010. &dev_attr_addr_range.attr,
  1011. &dev_attr_addr_start.attr,
  1012. &dev_attr_addr_stop.attr,
  1013. &dev_attr_addr_acctype.attr,
  1014. &dev_attr_cntr_idx.attr,
  1015. &dev_attr_cntr_rld_val.attr,
  1016. &dev_attr_cntr_event.attr,
  1017. &dev_attr_cntr_rld_event.attr,
  1018. &dev_attr_cntr_val.attr,
  1019. &dev_attr_seq_12_event.attr,
  1020. &dev_attr_seq_21_event.attr,
  1021. &dev_attr_seq_23_event.attr,
  1022. &dev_attr_seq_31_event.attr,
  1023. &dev_attr_seq_32_event.attr,
  1024. &dev_attr_seq_13_event.attr,
  1025. &dev_attr_seq_curr_state.attr,
  1026. &dev_attr_ctxid_idx.attr,
  1027. &dev_attr_ctxid_pid.attr,
  1028. &dev_attr_ctxid_mask.attr,
  1029. &dev_attr_sync_freq.attr,
  1030. &dev_attr_timestamp_event.attr,
  1031. &dev_attr_traceid.attr,
  1032. &dev_attr_cpu.attr,
  1033. NULL,
  1034. };
  1035. #define coresight_etm3x_reg(name, offset) \
  1036. coresight_simple_reg32(struct etm_drvdata, name, offset)
  1037. coresight_etm3x_reg(etmccr, ETMCCR);
  1038. coresight_etm3x_reg(etmccer, ETMCCER);
  1039. coresight_etm3x_reg(etmscr, ETMSCR);
  1040. coresight_etm3x_reg(etmidr, ETMIDR);
  1041. coresight_etm3x_reg(etmcr, ETMCR);
  1042. coresight_etm3x_reg(etmtraceidr, ETMTRACEIDR);
  1043. coresight_etm3x_reg(etmteevr, ETMTEEVR);
  1044. coresight_etm3x_reg(etmtssvr, ETMTSSCR);
  1045. coresight_etm3x_reg(etmtecr1, ETMTECR1);
  1046. coresight_etm3x_reg(etmtecr2, ETMTECR2);
  1047. static struct attribute *coresight_etm_mgmt_attrs[] = {
  1048. &dev_attr_etmccr.attr,
  1049. &dev_attr_etmccer.attr,
  1050. &dev_attr_etmscr.attr,
  1051. &dev_attr_etmidr.attr,
  1052. &dev_attr_etmcr.attr,
  1053. &dev_attr_etmtraceidr.attr,
  1054. &dev_attr_etmteevr.attr,
  1055. &dev_attr_etmtssvr.attr,
  1056. &dev_attr_etmtecr1.attr,
  1057. &dev_attr_etmtecr2.attr,
  1058. NULL,
  1059. };
  1060. static const struct attribute_group coresight_etm_group = {
  1061. .attrs = coresight_etm_attrs,
  1062. };
  1063. static const struct attribute_group coresight_etm_mgmt_group = {
  1064. .attrs = coresight_etm_mgmt_attrs,
  1065. .name = "mgmt",
  1066. };
  1067. const struct attribute_group *coresight_etm_groups[] = {
  1068. &coresight_etm_group,
  1069. &coresight_etm_mgmt_group,
  1070. NULL,
  1071. };