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