diff options
author | Joshua Bakita <bakitajoshua@gmail.com> | 2024-09-25 16:09:09 -0400 |
---|---|---|
committer | Joshua Bakita <bakitajoshua@gmail.com> | 2024-09-25 16:09:09 -0400 |
commit | f347fde22f1297e4f022600d201780d5ead78114 (patch) | |
tree | 76be305d6187003a1e0486ff6e91efb1062ae118 /include/os/linux/debug_xve.c | |
parent | 8340d234d78a7d0f46c11a584de538148b78b7cb (diff) |
Delete no-longer-needed nvgpu headersHEADmasterjbakita-wip
The dependency on these was removed in commit 8340d234.
Diffstat (limited to 'include/os/linux/debug_xve.c')
-rw-r--r-- | include/os/linux/debug_xve.c | 177 |
1 files changed, 0 insertions, 177 deletions
diff --git a/include/os/linux/debug_xve.c b/include/os/linux/debug_xve.c deleted file mode 100644 index 128d316..0000000 --- a/include/os/linux/debug_xve.c +++ /dev/null | |||
@@ -1,177 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2017 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 <nvgpu/types.h> | ||
16 | #include <nvgpu/xve.h> | ||
17 | #include <nvgpu/timers.h> | ||
18 | |||
19 | #include "debug_xve.h" | ||
20 | #include "os_linux.h" | ||
21 | |||
22 | #include <linux/debugfs.h> | ||
23 | #include <linux/uaccess.h> | ||
24 | |||
25 | static ssize_t xve_link_speed_write(struct file *filp, | ||
26 | const char __user *buff, | ||
27 | size_t len, loff_t *off) | ||
28 | { | ||
29 | struct gk20a *g = ((struct seq_file *)filp->private_data)->private; | ||
30 | char kbuff[16]; | ||
31 | u32 buff_size, check_len; | ||
32 | u32 link_speed = 0; | ||
33 | int ret; | ||
34 | |||
35 | buff_size = min_t(size_t, 16, len); | ||
36 | |||
37 | memset(kbuff, 0, 16); | ||
38 | if (copy_from_user(kbuff, buff, buff_size)) | ||
39 | return -EFAULT; | ||
40 | |||
41 | check_len = strlen("Gen1"); | ||
42 | if (strncmp(kbuff, "Gen1", check_len) == 0) | ||
43 | link_speed = GPU_XVE_SPEED_2P5; | ||
44 | else if (strncmp(kbuff, "Gen2", check_len) == 0) | ||
45 | link_speed = GPU_XVE_SPEED_5P0; | ||
46 | else if (strncmp(kbuff, "Gen3", check_len) == 0) | ||
47 | link_speed = GPU_XVE_SPEED_8P0; | ||
48 | else | ||
49 | nvgpu_err(g, "%s: Unknown PCIe speed: %s", | ||
50 | __func__, kbuff); | ||
51 | |||
52 | if (!link_speed) | ||
53 | return -EINVAL; | ||
54 | |||
55 | /* Brief pause... To help rate limit this. */ | ||
56 | nvgpu_msleep(250); | ||
57 | |||
58 | /* | ||
59 | * And actually set the speed. Yay. | ||
60 | */ | ||
61 | ret = g->ops.xve.set_speed(g, link_speed); | ||
62 | if (ret) | ||
63 | return ret; | ||
64 | |||
65 | return len; | ||
66 | } | ||
67 | |||
68 | static int xve_link_speed_show(struct seq_file *s, void *unused) | ||
69 | { | ||
70 | struct gk20a *g = s->private; | ||
71 | u32 speed; | ||
72 | int err; | ||
73 | |||
74 | err = g->ops.xve.get_speed(g, &speed); | ||
75 | if (err) | ||
76 | return err; | ||
77 | |||
78 | seq_printf(s, "Current PCIe speed:\n %s\n", xve_speed_to_str(speed)); | ||
79 | |||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | static int xve_link_speed_open(struct inode *inode, struct file *file) | ||
84 | { | ||
85 | return single_open(file, xve_link_speed_show, inode->i_private); | ||
86 | } | ||
87 | |||
88 | static const struct file_operations xve_link_speed_fops = { | ||
89 | .open = xve_link_speed_open, | ||
90 | .read = seq_read, | ||
91 | .write = xve_link_speed_write, | ||
92 | .llseek = seq_lseek, | ||
93 | .release = single_release, | ||
94 | }; | ||
95 | |||
96 | static int xve_available_speeds_show(struct seq_file *s, void *unused) | ||
97 | { | ||
98 | struct gk20a *g = s->private; | ||
99 | u32 available_speeds; | ||
100 | |||
101 | g->ops.xve.available_speeds(g, &available_speeds); | ||
102 | |||
103 | seq_puts(s, "Available PCIe bus speeds:\n"); | ||
104 | if (available_speeds & GPU_XVE_SPEED_2P5) | ||
105 | seq_puts(s, " Gen1\n"); | ||
106 | if (available_speeds & GPU_XVE_SPEED_5P0) | ||
107 | seq_puts(s, " Gen2\n"); | ||
108 | if (available_speeds & GPU_XVE_SPEED_8P0) | ||
109 | seq_puts(s, " Gen3\n"); | ||
110 | |||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | static int xve_available_speeds_open(struct inode *inode, struct file *file) | ||
115 | { | ||
116 | return single_open(file, xve_available_speeds_show, inode->i_private); | ||
117 | } | ||
118 | |||
119 | static const struct file_operations xve_available_speeds_fops = { | ||
120 | .open = xve_available_speeds_open, | ||
121 | .read = seq_read, | ||
122 | .llseek = seq_lseek, | ||
123 | .release = single_release, | ||
124 | }; | ||
125 | |||
126 | static int xve_link_control_status_show(struct seq_file *s, void *unused) | ||
127 | { | ||
128 | struct gk20a *g = s->private; | ||
129 | u32 link_status; | ||
130 | |||
131 | link_status = g->ops.xve.get_link_control_status(g); | ||
132 | seq_printf(s, "0x%08x\n", link_status); | ||
133 | |||
134 | return 0; | ||
135 | } | ||
136 | |||
137 | static int xve_link_control_status_open(struct inode *inode, struct file *file) | ||
138 | { | ||
139 | return single_open(file, xve_link_control_status_show, inode->i_private); | ||
140 | } | ||
141 | |||
142 | static const struct file_operations xve_link_control_status_fops = { | ||
143 | .open = xve_link_control_status_open, | ||
144 | .read = seq_read, | ||
145 | .llseek = seq_lseek, | ||
146 | .release = single_release, | ||
147 | }; | ||
148 | |||
149 | int nvgpu_xve_debugfs_init(struct gk20a *g) | ||
150 | { | ||
151 | int err = -ENODEV; | ||
152 | |||
153 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | ||
154 | struct dentry *gpu_root = l->debugfs; | ||
155 | |||
156 | l->debugfs_xve = debugfs_create_dir("xve", gpu_root); | ||
157 | if (IS_ERR_OR_NULL(l->debugfs_xve)) | ||
158 | goto fail; | ||
159 | |||
160 | /* | ||
161 | * These are just debug nodes. If they fail to get made it's not worth | ||
162 | * worrying the higher level SW. | ||
163 | */ | ||
164 | debugfs_create_file("link_speed", S_IRUGO, | ||
165 | l->debugfs_xve, g, | ||
166 | &xve_link_speed_fops); | ||
167 | debugfs_create_file("available_speeds", S_IRUGO, | ||
168 | l->debugfs_xve, g, | ||
169 | &xve_available_speeds_fops); | ||
170 | debugfs_create_file("link_control_status", S_IRUGO, | ||
171 | l->debugfs_xve, g, | ||
172 | &xve_link_control_status_fops); | ||
173 | |||
174 | err = 0; | ||
175 | fail: | ||
176 | return err; | ||
177 | } | ||