sysinfo.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright IBM Corp. 2001, 2009
  4. * Author(s): Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
  5. * Martin Schwidefsky <schwidefsky@de.ibm.com>,
  6. */
  7. #include <linux/debugfs.h>
  8. #include <linux/kernel.h>
  9. #include <linux/mm.h>
  10. #include <linux/proc_fs.h>
  11. #include <linux/seq_file.h>
  12. #include <linux/init.h>
  13. #include <linux/delay.h>
  14. #include <linux/export.h>
  15. #include <linux/slab.h>
  16. #include <asm/asm-extable.h>
  17. #include <asm/ebcdic.h>
  18. #include <asm/debug.h>
  19. #include <asm/sysinfo.h>
  20. #include <asm/cpcmd.h>
  21. #include <asm/topology.h>
  22. #include <asm/fpu.h>
  23. int topology_max_mnest;
  24. static inline int __stsi(void *sysinfo, int fc, int sel1, int sel2, int *lvl)
  25. {
  26. int r0 = (fc << 28) | sel1;
  27. int rc = 0;
  28. asm volatile(
  29. " lr 0,%[r0]\n"
  30. " lr 1,%[r1]\n"
  31. " stsi 0(%[sysinfo])\n"
  32. "0: jz 2f\n"
  33. "1: lhi %[rc],%[retval]\n"
  34. "2: lr %[r0],0\n"
  35. EX_TABLE(0b, 1b)
  36. : [r0] "+d" (r0), [rc] "+d" (rc)
  37. : [r1] "d" (sel2),
  38. [sysinfo] "a" (sysinfo),
  39. [retval] "K" (-EOPNOTSUPP)
  40. : "cc", "0", "1", "memory");
  41. *lvl = ((unsigned int) r0) >> 28;
  42. return rc;
  43. }
  44. /*
  45. * stsi - store system information
  46. *
  47. * Returns the current configuration level if function code 0 was specified.
  48. * Otherwise returns 0 on success or a negative value on error.
  49. */
  50. int stsi(void *sysinfo, int fc, int sel1, int sel2)
  51. {
  52. int lvl, rc;
  53. rc = __stsi(sysinfo, fc, sel1, sel2, &lvl);
  54. if (rc)
  55. return rc;
  56. return fc ? 0 : lvl;
  57. }
  58. EXPORT_SYMBOL(stsi);
  59. #ifdef CONFIG_PROC_FS
  60. static bool convert_ext_name(unsigned char encoding, char *name, size_t len)
  61. {
  62. switch (encoding) {
  63. case 1: /* EBCDIC */
  64. EBCASC(name, len);
  65. break;
  66. case 2: /* UTF-8 */
  67. break;
  68. default:
  69. return false;
  70. }
  71. return true;
  72. }
  73. static void stsi_1_1_1(struct seq_file *m, struct sysinfo_1_1_1 *info)
  74. {
  75. bool has_var_cap;
  76. int i;
  77. if (stsi(info, 1, 1, 1))
  78. return;
  79. has_var_cap = !!info->model_var_cap[0];
  80. EBCASC(info->manufacturer, sizeof(info->manufacturer));
  81. EBCASC(info->type, sizeof(info->type));
  82. EBCASC(info->model, sizeof(info->model));
  83. EBCASC(info->sequence, sizeof(info->sequence));
  84. EBCASC(info->plant, sizeof(info->plant));
  85. EBCASC(info->model_capacity, sizeof(info->model_capacity));
  86. EBCASC(info->model_perm_cap, sizeof(info->model_perm_cap));
  87. EBCASC(info->model_temp_cap, sizeof(info->model_temp_cap));
  88. if (has_var_cap)
  89. EBCASC(info->model_var_cap, sizeof(info->model_var_cap));
  90. seq_printf(m, "Manufacturer: %-16.16s\n", info->manufacturer);
  91. seq_printf(m, "Type: %-4.4s\n", info->type);
  92. if (info->lic)
  93. seq_printf(m, "LIC Identifier: %016lx\n", info->lic);
  94. /*
  95. * Sigh: the model field has been renamed with System z9
  96. * to model_capacity and a new model field has been added
  97. * after the plant field. To avoid confusing older programs
  98. * the "Model:" prints "model_capacity model" or just
  99. * "model_capacity" if the model string is empty .
  100. */
  101. seq_printf(m, "Model: %-16.16s", info->model_capacity);
  102. if (info->model[0] != '\0')
  103. seq_printf(m, " %-16.16s", info->model);
  104. seq_putc(m, '\n');
  105. seq_printf(m, "Sequence Code: %-16.16s\n", info->sequence);
  106. seq_printf(m, "Plant: %-4.4s\n", info->plant);
  107. seq_printf(m, "Model Capacity: %-16.16s %08u\n",
  108. info->model_capacity, info->model_cap_rating);
  109. if (info->model_perm_cap_rating)
  110. seq_printf(m, "Model Perm. Capacity: %-16.16s %08u\n",
  111. info->model_perm_cap,
  112. info->model_perm_cap_rating);
  113. if (info->model_temp_cap_rating)
  114. seq_printf(m, "Model Temp. Capacity: %-16.16s %08u\n",
  115. info->model_temp_cap,
  116. info->model_temp_cap_rating);
  117. if (has_var_cap && info->model_var_cap_rating)
  118. seq_printf(m, "Model Var. Capacity: %-16.16s %08u\n",
  119. info->model_var_cap,
  120. info->model_var_cap_rating);
  121. if (info->ncr)
  122. seq_printf(m, "Nominal Cap. Rating: %08u\n", info->ncr);
  123. if (info->npr)
  124. seq_printf(m, "Nominal Perm. Rating: %08u\n", info->npr);
  125. if (info->ntr)
  126. seq_printf(m, "Nominal Temp. Rating: %08u\n", info->ntr);
  127. if (has_var_cap && info->nvr)
  128. seq_printf(m, "Nominal Var. Rating: %08u\n", info->nvr);
  129. if (info->cai) {
  130. seq_printf(m, "Capacity Adj. Ind.: %d\n", info->cai);
  131. seq_printf(m, "Capacity Ch. Reason: %d\n", info->ccr);
  132. seq_printf(m, "Capacity Transient: %d\n", info->t);
  133. }
  134. if (info->p) {
  135. for (i = 1; i <= ARRAY_SIZE(info->typepct); i++) {
  136. seq_printf(m, "Type %d Percentage: %d\n",
  137. i, info->typepct[i - 1]);
  138. }
  139. }
  140. }
  141. static void stsi_15_1_x(struct seq_file *m, struct sysinfo_15_1_x *info)
  142. {
  143. int i;
  144. seq_putc(m, '\n');
  145. if (!MACHINE_HAS_TOPOLOGY)
  146. return;
  147. if (stsi(info, 15, 1, topology_max_mnest))
  148. return;
  149. seq_printf(m, "CPU Topology HW: ");
  150. for (i = 0; i < TOPOLOGY_NR_MAG; i++)
  151. seq_printf(m, " %d", info->mag[i]);
  152. seq_putc(m, '\n');
  153. #ifdef CONFIG_SCHED_TOPOLOGY
  154. store_topology(info);
  155. seq_printf(m, "CPU Topology SW: ");
  156. for (i = 0; i < TOPOLOGY_NR_MAG; i++)
  157. seq_printf(m, " %d", info->mag[i]);
  158. seq_putc(m, '\n');
  159. #endif
  160. }
  161. static void stsi_1_2_2(struct seq_file *m, struct sysinfo_1_2_2 *info)
  162. {
  163. struct sysinfo_1_2_2_extension *ext;
  164. int i;
  165. if (stsi(info, 1, 2, 2))
  166. return;
  167. ext = (struct sysinfo_1_2_2_extension *)
  168. ((unsigned long) info + info->acc_offset);
  169. seq_printf(m, "CPUs Total: %d\n", info->cpus_total);
  170. seq_printf(m, "CPUs Configured: %d\n", info->cpus_configured);
  171. seq_printf(m, "CPUs Standby: %d\n", info->cpus_standby);
  172. seq_printf(m, "CPUs Reserved: %d\n", info->cpus_reserved);
  173. if (info->mt_installed) {
  174. seq_printf(m, "CPUs G-MTID: %d\n", info->mt_gtid);
  175. seq_printf(m, "CPUs S-MTID: %d\n", info->mt_stid);
  176. }
  177. /*
  178. * Sigh 2. According to the specification the alternate
  179. * capability field is a 32 bit floating point number
  180. * if the higher order 8 bits are not zero. Printing
  181. * a floating point number in the kernel is a no-no,
  182. * always print the number as 32 bit unsigned integer.
  183. * The user-space needs to know about the strange
  184. * encoding of the alternate cpu capability.
  185. */
  186. seq_printf(m, "Capability: %u", info->capability);
  187. if (info->format == 1)
  188. seq_printf(m, " %u", ext->alt_capability);
  189. seq_putc(m, '\n');
  190. if (info->nominal_cap)
  191. seq_printf(m, "Nominal Capability: %d\n", info->nominal_cap);
  192. if (info->secondary_cap)
  193. seq_printf(m, "Secondary Capability: %d\n", info->secondary_cap);
  194. for (i = 2; i <= info->cpus_total; i++) {
  195. seq_printf(m, "Adjustment %02d-way: %u",
  196. i, info->adjustment[i-2]);
  197. if (info->format == 1)
  198. seq_printf(m, " %u", ext->alt_adjustment[i-2]);
  199. seq_putc(m, '\n');
  200. }
  201. }
  202. static void stsi_2_2_2(struct seq_file *m, struct sysinfo_2_2_2 *info)
  203. {
  204. if (stsi(info, 2, 2, 2))
  205. return;
  206. EBCASC(info->name, sizeof(info->name));
  207. seq_putc(m, '\n');
  208. seq_printf(m, "LPAR Number: %d\n", info->lpar_number);
  209. seq_printf(m, "LPAR Characteristics: ");
  210. if (info->characteristics & LPAR_CHAR_DEDICATED)
  211. seq_printf(m, "Dedicated ");
  212. if (info->characteristics & LPAR_CHAR_SHARED)
  213. seq_printf(m, "Shared ");
  214. if (info->characteristics & LPAR_CHAR_LIMITED)
  215. seq_printf(m, "Limited ");
  216. seq_putc(m, '\n');
  217. seq_printf(m, "LPAR Name: %-8.8s\n", info->name);
  218. seq_printf(m, "LPAR Adjustment: %d\n", info->caf);
  219. seq_printf(m, "LPAR CPUs Total: %d\n", info->cpus_total);
  220. seq_printf(m, "LPAR CPUs Configured: %d\n", info->cpus_configured);
  221. seq_printf(m, "LPAR CPUs Standby: %d\n", info->cpus_standby);
  222. seq_printf(m, "LPAR CPUs Reserved: %d\n", info->cpus_reserved);
  223. seq_printf(m, "LPAR CPUs Dedicated: %d\n", info->cpus_dedicated);
  224. seq_printf(m, "LPAR CPUs Shared: %d\n", info->cpus_shared);
  225. if (info->mt_installed) {
  226. seq_printf(m, "LPAR CPUs G-MTID: %d\n", info->mt_gtid);
  227. seq_printf(m, "LPAR CPUs S-MTID: %d\n", info->mt_stid);
  228. seq_printf(m, "LPAR CPUs PS-MTID: %d\n", info->mt_psmtid);
  229. }
  230. if (convert_ext_name(info->vsne, info->ext_name, sizeof(info->ext_name))) {
  231. seq_printf(m, "LPAR Extended Name: %-.256s\n", info->ext_name);
  232. seq_printf(m, "LPAR UUID: %pUb\n", &info->uuid);
  233. }
  234. }
  235. static void print_ext_name(struct seq_file *m, int lvl,
  236. struct sysinfo_3_2_2 *info)
  237. {
  238. size_t len = sizeof(info->ext_names[lvl]);
  239. if (!convert_ext_name(info->vm[lvl].evmne, info->ext_names[lvl], len))
  240. return;
  241. seq_printf(m, "VM%02d Extended Name: %-.256s\n", lvl,
  242. info->ext_names[lvl]);
  243. }
  244. static void print_uuid(struct seq_file *m, int i, struct sysinfo_3_2_2 *info)
  245. {
  246. if (uuid_is_null(&info->vm[i].uuid))
  247. return;
  248. seq_printf(m, "VM%02d UUID: %pUb\n", i, &info->vm[i].uuid);
  249. }
  250. static void stsi_3_2_2(struct seq_file *m, struct sysinfo_3_2_2 *info)
  251. {
  252. int i;
  253. if (stsi(info, 3, 2, 2))
  254. return;
  255. for (i = 0; i < info->count; i++) {
  256. EBCASC(info->vm[i].name, sizeof(info->vm[i].name));
  257. EBCASC(info->vm[i].cpi, sizeof(info->vm[i].cpi));
  258. seq_putc(m, '\n');
  259. seq_printf(m, "VM%02d Name: %-8.8s\n", i, info->vm[i].name);
  260. seq_printf(m, "VM%02d Control Program: %-16.16s\n", i, info->vm[i].cpi);
  261. seq_printf(m, "VM%02d Adjustment: %d\n", i, info->vm[i].caf);
  262. seq_printf(m, "VM%02d CPUs Total: %d\n", i, info->vm[i].cpus_total);
  263. seq_printf(m, "VM%02d CPUs Configured: %d\n", i, info->vm[i].cpus_configured);
  264. seq_printf(m, "VM%02d CPUs Standby: %d\n", i, info->vm[i].cpus_standby);
  265. seq_printf(m, "VM%02d CPUs Reserved: %d\n", i, info->vm[i].cpus_reserved);
  266. print_ext_name(m, i, info);
  267. print_uuid(m, i, info);
  268. }
  269. }
  270. static int sysinfo_show(struct seq_file *m, void *v)
  271. {
  272. void *info = (void *)get_zeroed_page(GFP_KERNEL);
  273. int level;
  274. if (!info)
  275. return 0;
  276. level = stsi(NULL, 0, 0, 0);
  277. if (level >= 1)
  278. stsi_1_1_1(m, info);
  279. if (level >= 1)
  280. stsi_15_1_x(m, info);
  281. if (level >= 1)
  282. stsi_1_2_2(m, info);
  283. if (level >= 2)
  284. stsi_2_2_2(m, info);
  285. if (level >= 3)
  286. stsi_3_2_2(m, info);
  287. free_page((unsigned long)info);
  288. return 0;
  289. }
  290. static int __init sysinfo_create_proc(void)
  291. {
  292. proc_create_single("sysinfo", 0444, NULL, sysinfo_show);
  293. return 0;
  294. }
  295. device_initcall(sysinfo_create_proc);
  296. #endif /* CONFIG_PROC_FS */
  297. /*
  298. * Service levels interface.
  299. */
  300. static DECLARE_RWSEM(service_level_sem);
  301. static LIST_HEAD(service_level_list);
  302. int register_service_level(struct service_level *slr)
  303. {
  304. struct service_level *ptr;
  305. down_write(&service_level_sem);
  306. list_for_each_entry(ptr, &service_level_list, list)
  307. if (ptr == slr) {
  308. up_write(&service_level_sem);
  309. return -EEXIST;
  310. }
  311. list_add_tail(&slr->list, &service_level_list);
  312. up_write(&service_level_sem);
  313. return 0;
  314. }
  315. EXPORT_SYMBOL(register_service_level);
  316. int unregister_service_level(struct service_level *slr)
  317. {
  318. struct service_level *ptr, *next;
  319. int rc = -ENOENT;
  320. down_write(&service_level_sem);
  321. list_for_each_entry_safe(ptr, next, &service_level_list, list) {
  322. if (ptr != slr)
  323. continue;
  324. list_del(&ptr->list);
  325. rc = 0;
  326. break;
  327. }
  328. up_write(&service_level_sem);
  329. return rc;
  330. }
  331. EXPORT_SYMBOL(unregister_service_level);
  332. static void *service_level_start(struct seq_file *m, loff_t *pos)
  333. {
  334. down_read(&service_level_sem);
  335. return seq_list_start(&service_level_list, *pos);
  336. }
  337. static void *service_level_next(struct seq_file *m, void *p, loff_t *pos)
  338. {
  339. return seq_list_next(p, &service_level_list, pos);
  340. }
  341. static void service_level_stop(struct seq_file *m, void *p)
  342. {
  343. up_read(&service_level_sem);
  344. }
  345. static int service_level_show(struct seq_file *m, void *p)
  346. {
  347. struct service_level *slr;
  348. slr = list_entry(p, struct service_level, list);
  349. slr->seq_print(m, slr);
  350. return 0;
  351. }
  352. static const struct seq_operations service_level_seq_ops = {
  353. .start = service_level_start,
  354. .next = service_level_next,
  355. .stop = service_level_stop,
  356. .show = service_level_show
  357. };
  358. static void service_level_vm_print(struct seq_file *m,
  359. struct service_level *slr)
  360. {
  361. char *query_buffer, *str;
  362. query_buffer = kmalloc(1024, GFP_KERNEL);
  363. if (!query_buffer)
  364. return;
  365. cpcmd("QUERY CPLEVEL", query_buffer, 1024, NULL);
  366. str = strchr(query_buffer, '\n');
  367. if (str)
  368. *str = 0;
  369. seq_printf(m, "VM: %s\n", query_buffer);
  370. kfree(query_buffer);
  371. }
  372. static struct service_level service_level_vm = {
  373. .seq_print = service_level_vm_print
  374. };
  375. static __init int create_proc_service_level(void)
  376. {
  377. proc_create_seq("service_levels", 0, NULL, &service_level_seq_ops);
  378. if (MACHINE_IS_VM)
  379. register_service_level(&service_level_vm);
  380. return 0;
  381. }
  382. subsys_initcall(create_proc_service_level);
  383. /*
  384. * CPU capability might have changed. Therefore recalculate loops_per_jiffy.
  385. */
  386. void s390_adjust_jiffies(void)
  387. {
  388. DECLARE_KERNEL_FPU_ONSTACK16(fpu);
  389. struct sysinfo_1_2_2 *info;
  390. unsigned long capability;
  391. info = (void *) get_zeroed_page(GFP_KERNEL);
  392. if (!info)
  393. return;
  394. if (stsi(info, 1, 2, 2) == 0) {
  395. /*
  396. * Major sigh. The cpu capability encoding is "special".
  397. * If the first 9 bits of info->capability are 0 then it
  398. * is a 32 bit unsigned integer in the range 0 .. 2^23.
  399. * If the first 9 bits are != 0 then it is a 32 bit float.
  400. * In addition a lower value indicates a proportionally
  401. * higher cpu capacity. Bogomips are the other way round.
  402. * To get to a halfway suitable number we divide 1e7
  403. * by the cpu capability number. Yes, that means a floating
  404. * point division ..
  405. */
  406. kernel_fpu_begin(&fpu, KERNEL_FPR);
  407. fpu_sfpc(0);
  408. if (info->capability & 0xff800000)
  409. fpu_ldgr(2, info->capability);
  410. else
  411. fpu_cefbr(2, info->capability);
  412. fpu_cefbr(0, 10000000);
  413. fpu_debr(0, 2);
  414. capability = fpu_cgebr(0, 5);
  415. kernel_fpu_end(&fpu, KERNEL_FPR);
  416. } else
  417. /*
  418. * Really old machine without stsi block for basic
  419. * cpu information. Report 42.0 bogomips.
  420. */
  421. capability = 42;
  422. loops_per_jiffy = capability * (500000/HZ);
  423. free_page((unsigned long) info);
  424. }
  425. /*
  426. * calibrate the delay loop
  427. */
  428. void calibrate_delay(void)
  429. {
  430. s390_adjust_jiffies();
  431. /* Print the good old Bogomips line .. */
  432. printk(KERN_DEBUG "Calibrating delay loop (skipped)... "
  433. "%lu.%02lu BogoMIPS preset\n", loops_per_jiffy/(500000/HZ),
  434. (loops_per_jiffy/(5000/HZ)) % 100);
  435. }
  436. #ifdef CONFIG_DEBUG_FS
  437. #define STSI_FILE(fc, s1, s2) \
  438. static int stsi_open_##fc##_##s1##_##s2(struct inode *inode, struct file *file)\
  439. { \
  440. file->private_data = (void *) get_zeroed_page(GFP_KERNEL); \
  441. if (!file->private_data) \
  442. return -ENOMEM; \
  443. if (stsi(file->private_data, fc, s1, s2)) { \
  444. free_page((unsigned long)file->private_data); \
  445. file->private_data = NULL; \
  446. return -EACCES; \
  447. } \
  448. return nonseekable_open(inode, file); \
  449. } \
  450. \
  451. static const struct file_operations stsi_##fc##_##s1##_##s2##_fs_ops = { \
  452. .open = stsi_open_##fc##_##s1##_##s2, \
  453. .release = stsi_release, \
  454. .read = stsi_read, \
  455. };
  456. static int stsi_release(struct inode *inode, struct file *file)
  457. {
  458. free_page((unsigned long)file->private_data);
  459. return 0;
  460. }
  461. static ssize_t stsi_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
  462. {
  463. return simple_read_from_buffer(buf, size, ppos, file->private_data, PAGE_SIZE);
  464. }
  465. STSI_FILE( 1, 1, 1);
  466. STSI_FILE( 1, 2, 1);
  467. STSI_FILE( 1, 2, 2);
  468. STSI_FILE( 2, 2, 1);
  469. STSI_FILE( 2, 2, 2);
  470. STSI_FILE( 3, 2, 2);
  471. STSI_FILE(15, 1, 2);
  472. STSI_FILE(15, 1, 3);
  473. STSI_FILE(15, 1, 4);
  474. STSI_FILE(15, 1, 5);
  475. STSI_FILE(15, 1, 6);
  476. struct stsi_file {
  477. const struct file_operations *fops;
  478. char *name;
  479. };
  480. static struct stsi_file stsi_file[] __initdata = {
  481. {.fops = &stsi_1_1_1_fs_ops, .name = "1_1_1"},
  482. {.fops = &stsi_1_2_1_fs_ops, .name = "1_2_1"},
  483. {.fops = &stsi_1_2_2_fs_ops, .name = "1_2_2"},
  484. {.fops = &stsi_2_2_1_fs_ops, .name = "2_2_1"},
  485. {.fops = &stsi_2_2_2_fs_ops, .name = "2_2_2"},
  486. {.fops = &stsi_3_2_2_fs_ops, .name = "3_2_2"},
  487. {.fops = &stsi_15_1_2_fs_ops, .name = "15_1_2"},
  488. {.fops = &stsi_15_1_3_fs_ops, .name = "15_1_3"},
  489. {.fops = &stsi_15_1_4_fs_ops, .name = "15_1_4"},
  490. {.fops = &stsi_15_1_5_fs_ops, .name = "15_1_5"},
  491. {.fops = &stsi_15_1_6_fs_ops, .name = "15_1_6"},
  492. };
  493. static u8 stsi_0_0_0;
  494. static __init int stsi_init_debugfs(void)
  495. {
  496. struct dentry *stsi_root;
  497. struct stsi_file *sf;
  498. int lvl, i;
  499. stsi_root = debugfs_create_dir("stsi", arch_debugfs_dir);
  500. lvl = stsi(NULL, 0, 0, 0);
  501. if (lvl > 0)
  502. stsi_0_0_0 = lvl;
  503. debugfs_create_u8("0_0_0", 0400, stsi_root, &stsi_0_0_0);
  504. for (i = 0; i < ARRAY_SIZE(stsi_file); i++) {
  505. sf = &stsi_file[i];
  506. debugfs_create_file(sf->name, 0400, stsi_root, NULL, sf->fops);
  507. }
  508. if (IS_ENABLED(CONFIG_SCHED_TOPOLOGY) && MACHINE_HAS_TOPOLOGY) {
  509. char link_to[10];
  510. sprintf(link_to, "15_1_%d", topology_mnest_limit());
  511. debugfs_create_symlink("topology", stsi_root, link_to);
  512. }
  513. return 0;
  514. }
  515. device_initcall(stsi_init_debugfs);
  516. #endif /* CONFIG_DEBUG_FS */