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