diff options
Diffstat (limited to 'include/os/linux/debug_ltc.c')
-rw-r--r-- | include/os/linux/debug_ltc.c | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/include/os/linux/debug_ltc.c b/include/os/linux/debug_ltc.c deleted file mode 100644 index 1b4c221..0000000 --- a/include/os/linux/debug_ltc.c +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2018 NVIDIA Corporation. All rights reserved. | ||
3 | * | ||
4 | * This software is licensed under the terms of the GNU General Public | ||
5 | * License version 2, as published by the Free Software Foundation, and | ||
6 | * may be copied, distributed, and modified under those terms. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include "debug_ltc.h" | ||
16 | #include "os_linux.h" | ||
17 | |||
18 | #include <nvgpu/gk20a.h> | ||
19 | |||
20 | #include <linux/debugfs.h> | ||
21 | #include <linux/uaccess.h> | ||
22 | |||
23 | static ssize_t ltc_intr_illegal_compstat_read(struct file *file, | ||
24 | char __user *user_buf, size_t count, loff_t *ppos) | ||
25 | { | ||
26 | char buf[3]; | ||
27 | struct gk20a *g = file->private_data; | ||
28 | |||
29 | if (g->ltc_intr_en_illegal_compstat) | ||
30 | buf[0] = 'Y'; | ||
31 | else | ||
32 | buf[0] = 'N'; | ||
33 | buf[1] = '\n'; | ||
34 | buf[2] = 0x00; | ||
35 | |||
36 | return simple_read_from_buffer(user_buf, count, ppos, buf, 2); | ||
37 | } | ||
38 | |||
39 | static ssize_t ltc_intr_illegal_compstat_write(struct file *file, | ||
40 | const char __user *user_buf, size_t count, loff_t *ppos) | ||
41 | { | ||
42 | char buf[3]; | ||
43 | int buf_size; | ||
44 | bool intr_illegal_compstat_enabled; | ||
45 | struct gk20a *g = file->private_data; | ||
46 | int err; | ||
47 | |||
48 | if (!g->ops.ltc.intr_en_illegal_compstat) | ||
49 | return -EINVAL; | ||
50 | |||
51 | buf_size = min(count, (sizeof(buf)-1)); | ||
52 | if (copy_from_user(buf, user_buf, buf_size)) | ||
53 | return -EFAULT; | ||
54 | |||
55 | err = gk20a_busy(g); | ||
56 | if (err) | ||
57 | return err; | ||
58 | |||
59 | if (strtobool(buf, &intr_illegal_compstat_enabled) == 0) { | ||
60 | g->ops.ltc.intr_en_illegal_compstat(g, | ||
61 | intr_illegal_compstat_enabled); | ||
62 | g->ltc_intr_en_illegal_compstat = intr_illegal_compstat_enabled; | ||
63 | } | ||
64 | |||
65 | gk20a_idle(g); | ||
66 | |||
67 | return buf_size; | ||
68 | } | ||
69 | |||
70 | static const struct file_operations ltc_intr_illegal_compstat_fops = { | ||
71 | .open = simple_open, | ||
72 | .read = ltc_intr_illegal_compstat_read, | ||
73 | .write = ltc_intr_illegal_compstat_write, | ||
74 | }; | ||
75 | |||
76 | int nvgpu_ltc_debugfs_init(struct gk20a *g) | ||
77 | { | ||
78 | struct dentry *d; | ||
79 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | ||
80 | struct dentry *gpu_root = l->debugfs; | ||
81 | |||
82 | l->debugfs_ltc = debugfs_create_dir("ltc", gpu_root); | ||
83 | if (IS_ERR_OR_NULL(l->debugfs_ltc)) | ||
84 | return -ENODEV; | ||
85 | |||
86 | /* Debug fs node to enable/disable illegal_compstat */ | ||
87 | d = debugfs_create_file("intr_illegal_compstat_enable", 0600, | ||
88 | l->debugfs_ltc, g, | ||
89 | <c_intr_illegal_compstat_fops); | ||
90 | if (!d) | ||
91 | return -ENOMEM; | ||
92 | |||
93 | return 0; | ||
94 | } | ||