.. | .. |
---|
1 | | -/** |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
| 2 | +/* |
---|
2 | 3 | * IBM Accelerator Family 'GenWQE' |
---|
3 | 4 | * |
---|
4 | 5 | * (C) Copyright IBM Corp. 2013 |
---|
.. | .. |
---|
7 | 8 | * Author: Joerg-Stephan Vogt <jsvogt@de.ibm.com> |
---|
8 | 9 | * Author: Michael Jung <mijung@gmx.net> |
---|
9 | 10 | * Author: Michael Ruettger <michael@ibmra.de> |
---|
10 | | - * |
---|
11 | | - * This program is free software; you can redistribute it and/or modify |
---|
12 | | - * it under the terms of the GNU General Public License (version 2 only) |
---|
13 | | - * as published by the Free Software Foundation. |
---|
14 | | - * |
---|
15 | | - * This program is distributed in the hope that it will be useful, |
---|
16 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 | | - * GNU General Public License for more details. |
---|
19 | 11 | */ |
---|
20 | 12 | |
---|
21 | 13 | /* |
---|
.. | .. |
---|
32 | 24 | |
---|
33 | 25 | #include "card_base.h" |
---|
34 | 26 | #include "card_ddcb.h" |
---|
35 | | - |
---|
36 | | -#define GENWQE_DEBUGFS_RO(_name, _showfn) \ |
---|
37 | | - static int genwqe_debugfs_##_name##_open(struct inode *inode, \ |
---|
38 | | - struct file *file) \ |
---|
39 | | - { \ |
---|
40 | | - return single_open(file, _showfn, inode->i_private); \ |
---|
41 | | - } \ |
---|
42 | | - static const struct file_operations genwqe_##_name##_fops = { \ |
---|
43 | | - .open = genwqe_debugfs_##_name##_open, \ |
---|
44 | | - .read = seq_read, \ |
---|
45 | | - .llseek = seq_lseek, \ |
---|
46 | | - .release = single_release, \ |
---|
47 | | - } |
---|
48 | 27 | |
---|
49 | 28 | static void dbg_uidn_show(struct seq_file *s, struct genwqe_reg *regs, |
---|
50 | 29 | int entries) |
---|
.. | .. |
---|
87 | 66 | return 0; |
---|
88 | 67 | } |
---|
89 | 68 | |
---|
90 | | -static int genwqe_curr_dbg_uid0_show(struct seq_file *s, void *unused) |
---|
| 69 | +static int curr_dbg_uid0_show(struct seq_file *s, void *unused) |
---|
91 | 70 | { |
---|
92 | 71 | return curr_dbg_uidn_show(s, unused, 0); |
---|
93 | 72 | } |
---|
94 | 73 | |
---|
95 | | -GENWQE_DEBUGFS_RO(curr_dbg_uid0, genwqe_curr_dbg_uid0_show); |
---|
| 74 | +DEFINE_SHOW_ATTRIBUTE(curr_dbg_uid0); |
---|
96 | 75 | |
---|
97 | | -static int genwqe_curr_dbg_uid1_show(struct seq_file *s, void *unused) |
---|
| 76 | +static int curr_dbg_uid1_show(struct seq_file *s, void *unused) |
---|
98 | 77 | { |
---|
99 | 78 | return curr_dbg_uidn_show(s, unused, 1); |
---|
100 | 79 | } |
---|
101 | 80 | |
---|
102 | | -GENWQE_DEBUGFS_RO(curr_dbg_uid1, genwqe_curr_dbg_uid1_show); |
---|
| 81 | +DEFINE_SHOW_ATTRIBUTE(curr_dbg_uid1); |
---|
103 | 82 | |
---|
104 | | -static int genwqe_curr_dbg_uid2_show(struct seq_file *s, void *unused) |
---|
| 83 | +static int curr_dbg_uid2_show(struct seq_file *s, void *unused) |
---|
105 | 84 | { |
---|
106 | 85 | return curr_dbg_uidn_show(s, unused, 2); |
---|
107 | 86 | } |
---|
108 | 87 | |
---|
109 | | -GENWQE_DEBUGFS_RO(curr_dbg_uid2, genwqe_curr_dbg_uid2_show); |
---|
| 88 | +DEFINE_SHOW_ATTRIBUTE(curr_dbg_uid2); |
---|
110 | 89 | |
---|
111 | 90 | static int prev_dbg_uidn_show(struct seq_file *s, void *unused, int uid) |
---|
112 | 91 | { |
---|
.. | .. |
---|
116 | 95 | return 0; |
---|
117 | 96 | } |
---|
118 | 97 | |
---|
119 | | -static int genwqe_prev_dbg_uid0_show(struct seq_file *s, void *unused) |
---|
| 98 | +static int prev_dbg_uid0_show(struct seq_file *s, void *unused) |
---|
120 | 99 | { |
---|
121 | 100 | return prev_dbg_uidn_show(s, unused, 0); |
---|
122 | 101 | } |
---|
123 | 102 | |
---|
124 | | -GENWQE_DEBUGFS_RO(prev_dbg_uid0, genwqe_prev_dbg_uid0_show); |
---|
| 103 | +DEFINE_SHOW_ATTRIBUTE(prev_dbg_uid0); |
---|
125 | 104 | |
---|
126 | | -static int genwqe_prev_dbg_uid1_show(struct seq_file *s, void *unused) |
---|
| 105 | +static int prev_dbg_uid1_show(struct seq_file *s, void *unused) |
---|
127 | 106 | { |
---|
128 | 107 | return prev_dbg_uidn_show(s, unused, 1); |
---|
129 | 108 | } |
---|
130 | 109 | |
---|
131 | | -GENWQE_DEBUGFS_RO(prev_dbg_uid1, genwqe_prev_dbg_uid1_show); |
---|
| 110 | +DEFINE_SHOW_ATTRIBUTE(prev_dbg_uid1); |
---|
132 | 111 | |
---|
133 | | -static int genwqe_prev_dbg_uid2_show(struct seq_file *s, void *unused) |
---|
| 112 | +static int prev_dbg_uid2_show(struct seq_file *s, void *unused) |
---|
134 | 113 | { |
---|
135 | 114 | return prev_dbg_uidn_show(s, unused, 2); |
---|
136 | 115 | } |
---|
137 | 116 | |
---|
138 | | -GENWQE_DEBUGFS_RO(prev_dbg_uid2, genwqe_prev_dbg_uid2_show); |
---|
| 117 | +DEFINE_SHOW_ATTRIBUTE(prev_dbg_uid2); |
---|
139 | 118 | |
---|
140 | | -static int genwqe_curr_regs_show(struct seq_file *s, void *unused) |
---|
| 119 | +static int curr_regs_show(struct seq_file *s, void *unused) |
---|
141 | 120 | { |
---|
142 | 121 | struct genwqe_dev *cd = s->private; |
---|
143 | 122 | unsigned int i; |
---|
.. | .. |
---|
164 | 143 | return 0; |
---|
165 | 144 | } |
---|
166 | 145 | |
---|
167 | | -GENWQE_DEBUGFS_RO(curr_regs, genwqe_curr_regs_show); |
---|
| 146 | +DEFINE_SHOW_ATTRIBUTE(curr_regs); |
---|
168 | 147 | |
---|
169 | | -static int genwqe_prev_regs_show(struct seq_file *s, void *unused) |
---|
| 148 | +static int prev_regs_show(struct seq_file *s, void *unused) |
---|
170 | 149 | { |
---|
171 | 150 | struct genwqe_dev *cd = s->private; |
---|
172 | 151 | unsigned int i; |
---|
.. | .. |
---|
188 | 167 | return 0; |
---|
189 | 168 | } |
---|
190 | 169 | |
---|
191 | | -GENWQE_DEBUGFS_RO(prev_regs, genwqe_prev_regs_show); |
---|
| 170 | +DEFINE_SHOW_ATTRIBUTE(prev_regs); |
---|
192 | 171 | |
---|
193 | | -static int genwqe_jtimer_show(struct seq_file *s, void *unused) |
---|
| 172 | +static int jtimer_show(struct seq_file *s, void *unused) |
---|
194 | 173 | { |
---|
195 | 174 | struct genwqe_dev *cd = s->private; |
---|
196 | 175 | unsigned int vf_num; |
---|
.. | .. |
---|
209 | 188 | return 0; |
---|
210 | 189 | } |
---|
211 | 190 | |
---|
212 | | -GENWQE_DEBUGFS_RO(jtimer, genwqe_jtimer_show); |
---|
| 191 | +DEFINE_SHOW_ATTRIBUTE(jtimer); |
---|
213 | 192 | |
---|
214 | | -static int genwqe_queue_working_time_show(struct seq_file *s, void *unused) |
---|
| 193 | +static int queue_working_time_show(struct seq_file *s, void *unused) |
---|
215 | 194 | { |
---|
216 | 195 | struct genwqe_dev *cd = s->private; |
---|
217 | 196 | unsigned int vf_num; |
---|
.. | .. |
---|
227 | 206 | return 0; |
---|
228 | 207 | } |
---|
229 | 208 | |
---|
230 | | -GENWQE_DEBUGFS_RO(queue_working_time, genwqe_queue_working_time_show); |
---|
| 209 | +DEFINE_SHOW_ATTRIBUTE(queue_working_time); |
---|
231 | 210 | |
---|
232 | | -static int genwqe_ddcb_info_show(struct seq_file *s, void *unused) |
---|
| 211 | +static int ddcb_info_show(struct seq_file *s, void *unused) |
---|
233 | 212 | { |
---|
234 | 213 | struct genwqe_dev *cd = s->private; |
---|
235 | 214 | unsigned int i; |
---|
.. | .. |
---|
240 | 219 | seq_puts(s, "DDCB QUEUE:\n"); |
---|
241 | 220 | seq_printf(s, " ddcb_max: %d\n" |
---|
242 | 221 | " ddcb_daddr: %016llx - %016llx\n" |
---|
243 | | - " ddcb_vaddr: %016llx\n" |
---|
| 222 | + " ddcb_vaddr: %p\n" |
---|
244 | 223 | " ddcbs_in_flight: %u\n" |
---|
245 | 224 | " ddcbs_max_in_flight: %u\n" |
---|
246 | 225 | " ddcbs_completed: %u\n" |
---|
.. | .. |
---|
250 | 229 | queue->ddcb_max, (long long)queue->ddcb_daddr, |
---|
251 | 230 | (long long)queue->ddcb_daddr + |
---|
252 | 231 | (queue->ddcb_max * DDCB_LENGTH), |
---|
253 | | - (long long)queue->ddcb_vaddr, queue->ddcbs_in_flight, |
---|
| 232 | + queue->ddcb_vaddr, queue->ddcbs_in_flight, |
---|
254 | 233 | queue->ddcbs_max_in_flight, queue->ddcbs_completed, |
---|
255 | 234 | queue->return_on_busy, queue->wait_on_busy, |
---|
256 | 235 | cd->irqs_processed); |
---|
.. | .. |
---|
300 | 279 | return 0; |
---|
301 | 280 | } |
---|
302 | 281 | |
---|
303 | | -GENWQE_DEBUGFS_RO(ddcb_info, genwqe_ddcb_info_show); |
---|
| 282 | +DEFINE_SHOW_ATTRIBUTE(ddcb_info); |
---|
304 | 283 | |
---|
305 | | -static int genwqe_info_show(struct seq_file *s, void *unused) |
---|
| 284 | +static int info_show(struct seq_file *s, void *unused) |
---|
306 | 285 | { |
---|
307 | 286 | struct genwqe_dev *cd = s->private; |
---|
308 | 287 | u64 app_id, slu_id, bitstream = -1; |
---|
.. | .. |
---|
335 | 314 | return 0; |
---|
336 | 315 | } |
---|
337 | 316 | |
---|
338 | | -GENWQE_DEBUGFS_RO(info, genwqe_info_show); |
---|
| 317 | +DEFINE_SHOW_ATTRIBUTE(info); |
---|
339 | 318 | |
---|
340 | | -int genwqe_init_debugfs(struct genwqe_dev *cd) |
---|
| 319 | +void genwqe_init_debugfs(struct genwqe_dev *cd) |
---|
341 | 320 | { |
---|
342 | 321 | struct dentry *root; |
---|
343 | | - struct dentry *file; |
---|
344 | | - int ret; |
---|
345 | 322 | char card_name[64]; |
---|
346 | 323 | char name[64]; |
---|
347 | 324 | unsigned int i; |
---|
.. | .. |
---|
349 | 326 | sprintf(card_name, "%s%d_card", GENWQE_DEVNAME, cd->card_idx); |
---|
350 | 327 | |
---|
351 | 328 | root = debugfs_create_dir(card_name, cd->debugfs_genwqe); |
---|
352 | | - if (!root) { |
---|
353 | | - ret = -ENOMEM; |
---|
354 | | - goto err0; |
---|
355 | | - } |
---|
356 | 329 | |
---|
357 | 330 | /* non privileged interfaces are done here */ |
---|
358 | | - file = debugfs_create_file("ddcb_info", S_IRUGO, root, cd, |
---|
359 | | - &genwqe_ddcb_info_fops); |
---|
360 | | - if (!file) { |
---|
361 | | - ret = -ENOMEM; |
---|
362 | | - goto err1; |
---|
363 | | - } |
---|
364 | | - |
---|
365 | | - file = debugfs_create_file("info", S_IRUGO, root, cd, |
---|
366 | | - &genwqe_info_fops); |
---|
367 | | - if (!file) { |
---|
368 | | - ret = -ENOMEM; |
---|
369 | | - goto err1; |
---|
370 | | - } |
---|
371 | | - |
---|
372 | | - file = debugfs_create_x64("err_inject", 0666, root, &cd->err_inject); |
---|
373 | | - if (!file) { |
---|
374 | | - ret = -ENOMEM; |
---|
375 | | - goto err1; |
---|
376 | | - } |
---|
377 | | - |
---|
378 | | - file = debugfs_create_u32("ddcb_software_timeout", 0666, root, |
---|
379 | | - &cd->ddcb_software_timeout); |
---|
380 | | - if (!file) { |
---|
381 | | - ret = -ENOMEM; |
---|
382 | | - goto err1; |
---|
383 | | - } |
---|
384 | | - |
---|
385 | | - file = debugfs_create_u32("kill_timeout", 0666, root, |
---|
386 | | - &cd->kill_timeout); |
---|
387 | | - if (!file) { |
---|
388 | | - ret = -ENOMEM; |
---|
389 | | - goto err1; |
---|
390 | | - } |
---|
| 331 | + debugfs_create_file("ddcb_info", S_IRUGO, root, cd, &ddcb_info_fops); |
---|
| 332 | + debugfs_create_file("info", S_IRUGO, root, cd, &info_fops); |
---|
| 333 | + debugfs_create_x64("err_inject", 0666, root, &cd->err_inject); |
---|
| 334 | + debugfs_create_u32("ddcb_software_timeout", 0666, root, |
---|
| 335 | + &cd->ddcb_software_timeout); |
---|
| 336 | + debugfs_create_u32("kill_timeout", 0666, root, &cd->kill_timeout); |
---|
391 | 337 | |
---|
392 | 338 | /* privileged interfaces follow here */ |
---|
393 | 339 | if (!genwqe_is_privileged(cd)) { |
---|
394 | 340 | cd->debugfs_root = root; |
---|
395 | | - return 0; |
---|
| 341 | + return; |
---|
396 | 342 | } |
---|
397 | 343 | |
---|
398 | | - file = debugfs_create_file("curr_regs", S_IRUGO, root, cd, |
---|
399 | | - &genwqe_curr_regs_fops); |
---|
400 | | - if (!file) { |
---|
401 | | - ret = -ENOMEM; |
---|
402 | | - goto err1; |
---|
403 | | - } |
---|
404 | | - |
---|
405 | | - file = debugfs_create_file("curr_dbg_uid0", S_IRUGO, root, cd, |
---|
406 | | - &genwqe_curr_dbg_uid0_fops); |
---|
407 | | - if (!file) { |
---|
408 | | - ret = -ENOMEM; |
---|
409 | | - goto err1; |
---|
410 | | - } |
---|
411 | | - |
---|
412 | | - file = debugfs_create_file("curr_dbg_uid1", S_IRUGO, root, cd, |
---|
413 | | - &genwqe_curr_dbg_uid1_fops); |
---|
414 | | - if (!file) { |
---|
415 | | - ret = -ENOMEM; |
---|
416 | | - goto err1; |
---|
417 | | - } |
---|
418 | | - |
---|
419 | | - file = debugfs_create_file("curr_dbg_uid2", S_IRUGO, root, cd, |
---|
420 | | - &genwqe_curr_dbg_uid2_fops); |
---|
421 | | - if (!file) { |
---|
422 | | - ret = -ENOMEM; |
---|
423 | | - goto err1; |
---|
424 | | - } |
---|
425 | | - |
---|
426 | | - file = debugfs_create_file("prev_regs", S_IRUGO, root, cd, |
---|
427 | | - &genwqe_prev_regs_fops); |
---|
428 | | - if (!file) { |
---|
429 | | - ret = -ENOMEM; |
---|
430 | | - goto err1; |
---|
431 | | - } |
---|
432 | | - |
---|
433 | | - file = debugfs_create_file("prev_dbg_uid0", S_IRUGO, root, cd, |
---|
434 | | - &genwqe_prev_dbg_uid0_fops); |
---|
435 | | - if (!file) { |
---|
436 | | - ret = -ENOMEM; |
---|
437 | | - goto err1; |
---|
438 | | - } |
---|
439 | | - |
---|
440 | | - file = debugfs_create_file("prev_dbg_uid1", S_IRUGO, root, cd, |
---|
441 | | - &genwqe_prev_dbg_uid1_fops); |
---|
442 | | - if (!file) { |
---|
443 | | - ret = -ENOMEM; |
---|
444 | | - goto err1; |
---|
445 | | - } |
---|
446 | | - |
---|
447 | | - file = debugfs_create_file("prev_dbg_uid2", S_IRUGO, root, cd, |
---|
448 | | - &genwqe_prev_dbg_uid2_fops); |
---|
449 | | - if (!file) { |
---|
450 | | - ret = -ENOMEM; |
---|
451 | | - goto err1; |
---|
452 | | - } |
---|
| 344 | + debugfs_create_file("curr_regs", S_IRUGO, root, cd, &curr_regs_fops); |
---|
| 345 | + debugfs_create_file("curr_dbg_uid0", S_IRUGO, root, cd, |
---|
| 346 | + &curr_dbg_uid0_fops); |
---|
| 347 | + debugfs_create_file("curr_dbg_uid1", S_IRUGO, root, cd, |
---|
| 348 | + &curr_dbg_uid1_fops); |
---|
| 349 | + debugfs_create_file("curr_dbg_uid2", S_IRUGO, root, cd, |
---|
| 350 | + &curr_dbg_uid2_fops); |
---|
| 351 | + debugfs_create_file("prev_regs", S_IRUGO, root, cd, &prev_regs_fops); |
---|
| 352 | + debugfs_create_file("prev_dbg_uid0", S_IRUGO, root, cd, |
---|
| 353 | + &prev_dbg_uid0_fops); |
---|
| 354 | + debugfs_create_file("prev_dbg_uid1", S_IRUGO, root, cd, |
---|
| 355 | + &prev_dbg_uid1_fops); |
---|
| 356 | + debugfs_create_file("prev_dbg_uid2", S_IRUGO, root, cd, |
---|
| 357 | + &prev_dbg_uid2_fops); |
---|
453 | 358 | |
---|
454 | 359 | for (i = 0; i < GENWQE_MAX_VFS; i++) { |
---|
455 | 360 | sprintf(name, "vf%u_jobtimeout_msec", i); |
---|
456 | | - |
---|
457 | | - file = debugfs_create_u32(name, 0666, root, |
---|
458 | | - &cd->vf_jobtimeout_msec[i]); |
---|
459 | | - if (!file) { |
---|
460 | | - ret = -ENOMEM; |
---|
461 | | - goto err1; |
---|
462 | | - } |
---|
| 361 | + debugfs_create_u32(name, 0666, root, |
---|
| 362 | + &cd->vf_jobtimeout_msec[i]); |
---|
463 | 363 | } |
---|
464 | 364 | |
---|
465 | | - file = debugfs_create_file("jobtimer", S_IRUGO, root, cd, |
---|
466 | | - &genwqe_jtimer_fops); |
---|
467 | | - if (!file) { |
---|
468 | | - ret = -ENOMEM; |
---|
469 | | - goto err1; |
---|
470 | | - } |
---|
471 | | - |
---|
472 | | - file = debugfs_create_file("queue_working_time", S_IRUGO, root, cd, |
---|
473 | | - &genwqe_queue_working_time_fops); |
---|
474 | | - if (!file) { |
---|
475 | | - ret = -ENOMEM; |
---|
476 | | - goto err1; |
---|
477 | | - } |
---|
478 | | - |
---|
479 | | - file = debugfs_create_u32("skip_recovery", 0666, root, |
---|
480 | | - &cd->skip_recovery); |
---|
481 | | - if (!file) { |
---|
482 | | - ret = -ENOMEM; |
---|
483 | | - goto err1; |
---|
484 | | - } |
---|
485 | | - |
---|
486 | | - file = debugfs_create_u32("use_platform_recovery", 0666, root, |
---|
487 | | - &cd->use_platform_recovery); |
---|
488 | | - if (!file) { |
---|
489 | | - ret = -ENOMEM; |
---|
490 | | - goto err1; |
---|
491 | | - } |
---|
| 365 | + debugfs_create_file("jobtimer", S_IRUGO, root, cd, &jtimer_fops); |
---|
| 366 | + debugfs_create_file("queue_working_time", S_IRUGO, root, cd, |
---|
| 367 | + &queue_working_time_fops); |
---|
| 368 | + debugfs_create_u32("skip_recovery", 0666, root, &cd->skip_recovery); |
---|
| 369 | + debugfs_create_u32("use_platform_recovery", 0666, root, |
---|
| 370 | + &cd->use_platform_recovery); |
---|
492 | 371 | |
---|
493 | 372 | cd->debugfs_root = root; |
---|
494 | | - return 0; |
---|
495 | | -err1: |
---|
496 | | - debugfs_remove_recursive(root); |
---|
497 | | -err0: |
---|
498 | | - return ret; |
---|
499 | 373 | } |
---|
500 | 374 | |
---|
501 | 375 | void genqwe_exit_debugfs(struct genwqe_dev *cd) |
---|