aboutsummaryrefslogtreecommitdiffstats
path: root/nvdebug_entry.c
diff options
context:
space:
mode:
Diffstat (limited to 'nvdebug_entry.c')
-rw-r--r--nvdebug_entry.c39
1 files changed, 6 insertions, 33 deletions
diff --git a/nvdebug_entry.c b/nvdebug_entry.c
index cae5aea..0754f12 100644
--- a/nvdebug_entry.c
+++ b/nvdebug_entry.c
@@ -138,8 +138,8 @@ int probe_and_cache_device(void) {
138} 138}
139 139
140// Create files `/proc/gpu#/runlist#`, world readable 140// Create files `/proc/gpu#/runlist#`, world readable
141int create_runlist_files_previous(int device_id, struct proc_dir_entry *dir) { 141int create_runlist_files(int device_id, struct proc_dir_entry *dir) {
142 ptop_device_info_previous_t info; 142 ptop_device_info_gk104_t info;
143 struct proc_dir_entry *rl_entry; 143 struct proc_dir_entry *rl_entry;
144 int i, rl_id; 144 int i, rl_id;
145 char runlist_name[12]; 145 char runlist_name[12];
@@ -147,8 +147,8 @@ int create_runlist_files_previous(int device_id, struct proc_dir_entry *dir) {
147 // Figure out how many runlists there are by checking the device info 147 // Figure out how many runlists there are by checking the device info
148 // registers. Runlists are always numbered sequentially, so we just have 148 // registers. Runlists are always numbered sequentially, so we just have
149 // to find the highest-valued one and add 1 to get the number of runlists. 149 // to find the highest-valued one and add 1 to get the number of runlists.
150 for (i = 0; i < NV_PTOP_DEVICE_INFO__SIZE_1_PREVIOUS; i++) { 150 for (i = 0; i < NV_PTOP_DEVICE_INFO__SIZE_1_GK104; i++) {
151 info.raw = nvdebug_readl(&g_nvdebug_state[device_id], NV_PTOP_DEVICE_INFO_PREVIOUS(i)); 151 info.raw = nvdebug_readl(&g_nvdebug_state[device_id], NV_PTOP_DEVICE_INFO_GK104(i));
152 if (info.info_type != INFO_TYPE_ENUM || !info.runlist_is_valid) 152 if (info.info_type != INFO_TYPE_ENUM || !info.runlist_is_valid)
153 continue; 153 continue;
154 if (info.runlist_enum > max_rl_id) 154 if (info.runlist_enum > max_rl_id)
@@ -167,34 +167,6 @@ int create_runlist_files_previous(int device_id, struct proc_dir_entry *dir) {
167 return 0; 167 return 0;
168} 168}
169 169
170// Create files `/proc/gpu#/runlist#`, world readable
171int create_runlist_files_ampere(int device_id, struct proc_dir_entry *dir) {
172 ptop_device_info_ampere_t info;
173 struct proc_dir_entry *rl_entry;
174 int i, rl_id;
175 char runlist_name[12];
176 int max_rl_id = 0; // Always at least one runlist
177 // Figure out how many runlists there are by checking the device info
178 // registers. Runlists are always numbered sequentially, so we just have
179 // to find the highest-valued one and add 1 to get the number of runlists.
180 for (i = 0; i < NV_PTOP_DEVICE_INFO__SIZE_1_AMPERE(&g_nvdebug_state[device_id]); i++) {
181 info.raw = nvdebug_readl(&g_nvdebug_state[device_id], NV_PTOP_DEVICE_INFO_AMPERE(i));
182 if (info.runlist_enum > max_rl_id)
183 max_rl_id = info.runlist_enum;
184 }
185 // Create files to read each runlist. The read handling code looks at the
186 // PDE_DATA associated with the file to determine what the runlist ID is.
187 for (rl_id = 0; rl_id <= 0 * max_rl_id; rl_id++) {
188 snprintf(runlist_name, 12, "runlist%d", rl_id);
189 rl_entry = proc_create_data(
190 runlist_name, 0444, dir, compat_ops(&runlist_file_ops),
191 (void*)(uintptr_t)rl_id);
192 if (!rl_entry)
193 return -ENOMEM;
194 }
195 return 0;
196}
197
198// Create files /proc/gpu# 170// Create files /proc/gpu#
199// TODO: Don't run this on unsupported GPUs 171// TODO: Don't run this on unsupported GPUs
200int create_tpc_mask_files(int device_id, struct proc_dir_entry *dir) { 172int create_tpc_mask_files(int device_id, struct proc_dir_entry *dir) {
@@ -240,7 +212,8 @@ int __init nvdebug_init(void) {
240 if (!(dir = proc_mkdir_data(device_id_str, 0555, NULL, (void*)device_id))) 212 if (!(dir = proc_mkdir_data(device_id_str, 0555, NULL, (void*)device_id)))
241 goto out_nomem; 213 goto out_nomem;
242 // Create files `/proc/gpu#/runlist#`, world readable 214 // Create files `/proc/gpu#/runlist#`, world readable
243 rl_create_err = (g_nvdebug_state[device_id].chip_id >= NV_CHIP_ID_AMPERE) ? create_runlist_files_ampere(device_id, dir) : create_runlist_files_previous(device_id, dir); 215 if (g_nvdebug_state[device_id].chip_id < NV_CHIP_ID_AMPERE)
216 create_runlist_files(device_id, dir);
244 // Create files `/proc/gpu#/gpc#_tpc_mask`, world readable 217 // Create files `/proc/gpu#/gpc#_tpc_mask`, world readable
245 tpc_masks_create_err = create_tpc_mask_files(device_id, dir); 218 tpc_masks_create_err = create_tpc_mask_files(device_id, dir);
246 // Create file `/proc/gpu#/preempt_tsg`, world writable 219 // Create file `/proc/gpu#/preempt_tsg`, world writable