summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-07-27 16:31:32 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-08-04 12:24:02 -0400
commit972c42fddf13f658242a4f92124e5fcf194672b3 (patch)
tree8b679b522be90f8980fb05d2641fbb9eaca768d6 /drivers/gpu/nvgpu/common
parentb8efd9d04537d6129e2ce8b067417e46b0e7436f (diff)
gpu: nvgpu: Move debugfs fields to os_linux
Move all Linux specific debugfs dentry fields to struct nvgpu_os_linux. JIRA NVGPU-62 Change-Id: I615620005f5d042943dd2e478c1629bcc912c550 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1528263 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug.c84
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug_allocator.c17
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug_cde.c11
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug_ce.c9
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug_clk.c22
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug_fifo.c6
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug_gr.c7
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug_mm.c5
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug_pmu.c23
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug_sched.c5
-rw-r--r--drivers/gpu/nvgpu/common/linux/os_linux.h24
-rw-r--r--drivers/gpu/nvgpu/common/linux/pci.c5
12 files changed, 119 insertions, 99 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/debug.c b/drivers/gpu/nvgpu/common/linux/debug.c
index a846493e..36f142d7 100644
--- a/drivers/gpu/nvgpu/common/linux/debug.c
+++ b/drivers/gpu/nvgpu/common/linux/debug.c
@@ -223,14 +223,14 @@ static const struct file_operations railgate_residency_fops = {
223 223
224static int gk20a_railgating_debugfs_init(struct gk20a *g) 224static int gk20a_railgating_debugfs_init(struct gk20a *g)
225{ 225{
226 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); 226 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
227 struct dentry *d; 227 struct dentry *d;
228 228
229 if (!g->can_railgate) 229 if (!g->can_railgate)
230 return 0; 230 return 0;
231 231
232 d = debugfs_create_file( 232 d = debugfs_create_file(
233 "railgate_residency", S_IRUGO|S_IWUSR, platform->debugfs, g, 233 "railgate_residency", S_IRUGO|S_IWUSR, l->debugfs, g,
234 &railgate_residency_fops); 234 &railgate_residency_fops);
235 if (!d) 235 if (!d)
236 return -ENOMEM; 236 return -ENOMEM;
@@ -240,101 +240,101 @@ static int gk20a_railgating_debugfs_init(struct gk20a *g)
240 240
241void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink) 241void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink)
242{ 242{
243 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
243 struct device *dev = dev_from_gk20a(g); 244 struct device *dev = dev_from_gk20a(g);
244 struct gk20a_platform *platform = dev_get_drvdata(dev);
245 245
246 platform->debugfs = debugfs_create_dir(dev_name(dev), NULL); 246 l->debugfs = debugfs_create_dir(dev_name(dev), NULL);
247 if (!platform->debugfs) 247 if (!l->debugfs)
248 return; 248 return;
249 249
250 if (debugfs_symlink) 250 if (debugfs_symlink)
251 platform->debugfs_alias = 251 l->debugfs_alias =
252 debugfs_create_symlink(debugfs_symlink, 252 debugfs_create_symlink(debugfs_symlink,
253 NULL, dev_name(dev)); 253 NULL, dev_name(dev));
254 254
255 debugfs_create_file("status", S_IRUGO, platform->debugfs, 255 debugfs_create_file("status", S_IRUGO, l->debugfs,
256 dev, &gk20a_debug_fops); 256 dev, &gk20a_debug_fops);
257 debugfs_create_file("gr_status", S_IRUGO, platform->debugfs, 257 debugfs_create_file("gr_status", S_IRUGO, l->debugfs,
258 dev, &gk20a_gr_debug_fops); 258 dev, &gk20a_gr_debug_fops);
259 debugfs_create_u32("trace_cmdbuf", S_IRUGO|S_IWUSR, 259 debugfs_create_u32("trace_cmdbuf", S_IRUGO|S_IWUSR,
260 platform->debugfs, &gk20a_debug_trace_cmdbuf); 260 l->debugfs, &gk20a_debug_trace_cmdbuf);
261 261
262 debugfs_create_u32("ch_wdt_timeout_ms", S_IRUGO|S_IWUSR, 262 debugfs_create_u32("ch_wdt_timeout_ms", S_IRUGO|S_IWUSR,
263 platform->debugfs, &g->ch_wdt_timeout_ms); 263 l->debugfs, &g->ch_wdt_timeout_ms);
264 264
265 debugfs_create_u32("disable_syncpoints", S_IRUGO|S_IWUSR, 265 debugfs_create_u32("disable_syncpoints", S_IRUGO|S_IWUSR,
266 platform->debugfs, &g->disable_syncpoints); 266 l->debugfs, &g->disable_syncpoints);
267 267
268 /* Legacy debugging API. */ 268 /* Legacy debugging API. */
269 debugfs_create_u32("dbg_mask", S_IRUGO|S_IWUSR, 269 debugfs_create_u32("dbg_mask", S_IRUGO|S_IWUSR,
270 platform->debugfs, &nvgpu_dbg_mask); 270 l->debugfs, &nvgpu_dbg_mask);
271 271
272 /* New debug logging API. */ 272 /* New debug logging API. */
273 debugfs_create_u32("log_mask", S_IRUGO|S_IWUSR, 273 debugfs_create_u32("log_mask", S_IRUGO|S_IWUSR,
274 platform->debugfs, &g->log_mask); 274 l->debugfs, &g->log_mask);
275 debugfs_create_u32("log_trace", S_IRUGO|S_IWUSR, 275 debugfs_create_u32("log_trace", S_IRUGO|S_IWUSR,
276 platform->debugfs, &g->log_trace); 276 l->debugfs, &g->log_trace);
277 277
278 g->debugfs_ltc_enabled = 278 l->debugfs_ltc_enabled =
279 debugfs_create_bool("ltc_enabled", S_IRUGO|S_IWUSR, 279 debugfs_create_bool("ltc_enabled", S_IRUGO|S_IWUSR,
280 platform->debugfs, 280 l->debugfs,
281 &g->mm.ltc_enabled_target); 281 &g->mm.ltc_enabled_target);
282 282
283 g->debugfs_gr_idle_timeout_default = 283 l->debugfs_gr_idle_timeout_default =
284 debugfs_create_u32("gr_idle_timeout_default_us", 284 debugfs_create_u32("gr_idle_timeout_default_us",
285 S_IRUGO|S_IWUSR, platform->debugfs, 285 S_IRUGO|S_IWUSR, l->debugfs,
286 &g->gr_idle_timeout_default); 286 &g->gr_idle_timeout_default);
287 g->debugfs_timeouts_enabled = 287 l->debugfs_timeouts_enabled =
288 debugfs_create_bool("timeouts_enabled", 288 debugfs_create_bool("timeouts_enabled",
289 S_IRUGO|S_IWUSR, 289 S_IRUGO|S_IWUSR,
290 platform->debugfs, 290 l->debugfs,
291 &g->timeouts_enabled); 291 &g->timeouts_enabled);
292 292
293 g->debugfs_bypass_smmu = 293 l->debugfs_bypass_smmu =
294 debugfs_create_bool("bypass_smmu", 294 debugfs_create_bool("bypass_smmu",
295 S_IRUGO|S_IWUSR, 295 S_IRUGO|S_IWUSR,
296 platform->debugfs, 296 l->debugfs,
297 &g->mm.bypass_smmu); 297 &g->mm.bypass_smmu);
298 g->debugfs_disable_bigpage = 298 l->debugfs_disable_bigpage =
299 debugfs_create_bool("disable_bigpage", 299 debugfs_create_bool("disable_bigpage",
300 S_IRUGO|S_IWUSR, 300 S_IRUGO|S_IWUSR,
301 platform->debugfs, 301 l->debugfs,
302 &g->mm.disable_bigpage); 302 &g->mm.disable_bigpage);
303 303
304 g->debugfs_timeslice_low_priority_us = 304 l->debugfs_timeslice_low_priority_us =
305 debugfs_create_u32("timeslice_low_priority_us", 305 debugfs_create_u32("timeslice_low_priority_us",
306 S_IRUGO|S_IWUSR, 306 S_IRUGO|S_IWUSR,
307 platform->debugfs, 307 l->debugfs,
308 &g->timeslice_low_priority_us); 308 &g->timeslice_low_priority_us);
309 g->debugfs_timeslice_medium_priority_us = 309 l->debugfs_timeslice_medium_priority_us =
310 debugfs_create_u32("timeslice_medium_priority_us", 310 debugfs_create_u32("timeslice_medium_priority_us",
311 S_IRUGO|S_IWUSR, 311 S_IRUGO|S_IWUSR,
312 platform->debugfs, 312 l->debugfs,
313 &g->timeslice_medium_priority_us); 313 &g->timeslice_medium_priority_us);
314 g->debugfs_timeslice_high_priority_us = 314 l->debugfs_timeslice_high_priority_us =
315 debugfs_create_u32("timeslice_high_priority_us", 315 debugfs_create_u32("timeslice_high_priority_us",
316 S_IRUGO|S_IWUSR, 316 S_IRUGO|S_IWUSR,
317 platform->debugfs, 317 l->debugfs,
318 &g->timeslice_high_priority_us); 318 &g->timeslice_high_priority_us);
319 g->debugfs_runlist_interleave = 319 l->debugfs_runlist_interleave =
320 debugfs_create_bool("runlist_interleave", 320 debugfs_create_bool("runlist_interleave",
321 S_IRUGO|S_IWUSR, 321 S_IRUGO|S_IWUSR,
322 platform->debugfs, 322 l->debugfs,
323 &g->runlist_interleave); 323 &g->runlist_interleave);
324#ifdef CONFIG_ARCH_TEGRA_18x_SOC 324#ifdef CONFIG_ARCH_TEGRA_18x_SOC
325 g->gr.t18x.ctx_vars.debugfs_force_preemption_gfxp = 325 l->debugfs_force_preemption_gfxp =
326 debugfs_create_bool("force_preemption_gfxp", S_IRUGO|S_IWUSR, 326 debugfs_create_bool("force_preemption_gfxp", S_IRUGO|S_IWUSR,
327 platform->debugfs, 327 l->debugfs,
328 &g->gr.t18x.ctx_vars.force_preemption_gfxp); 328 &g->gr.t18x.ctx_vars.force_preemption_gfxp);
329 329
330 g->gr.t18x.ctx_vars.debugfs_force_preemption_cilp = 330 l->debugfs_force_preemption_cilp =
331 debugfs_create_bool("force_preemption_cilp", S_IRUGO|S_IWUSR, 331 debugfs_create_bool("force_preemption_cilp", S_IRUGO|S_IWUSR,
332 platform->debugfs, 332 l->debugfs,
333 &g->gr.t18x.ctx_vars.force_preemption_cilp); 333 &g->gr.t18x.ctx_vars.force_preemption_cilp);
334 334
335 g->gr.t18x.ctx_vars.debugfs_dump_ctxsw_stats = 335 l->debugfs_dump_ctxsw_stats =
336 debugfs_create_bool("dump_ctxsw_stats_on_channel_close", 336 debugfs_create_bool("dump_ctxsw_stats_on_channel_close",
337 S_IRUGO|S_IWUSR, platform->debugfs, 337 S_IRUGO|S_IWUSR, l->debugfs,
338 &g->gr.t18x. 338 &g->gr.t18x.
339 ctx_vars.dump_ctxsw_stats_on_channel_close); 339 ctx_vars.dump_ctxsw_stats_on_channel_close);
340#endif 340#endif
@@ -355,13 +355,13 @@ void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink)
355 355
356void gk20a_debug_deinit(struct gk20a *g) 356void gk20a_debug_deinit(struct gk20a *g)
357{ 357{
358 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); 358 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
359 359
360 if (!platform->debugfs) 360 if (!l->debugfs)
361 return; 361 return;
362 362
363 gk20a_fifo_debugfs_deinit(g); 363 gk20a_fifo_debugfs_deinit(g);
364 364
365 debugfs_remove_recursive(platform->debugfs); 365 debugfs_remove_recursive(l->debugfs);
366 debugfs_remove_recursive(platform->debugfs_alias); 366 debugfs_remove_recursive(l->debugfs_alias);
367} 367}
diff --git a/drivers/gpu/nvgpu/common/linux/debug_allocator.c b/drivers/gpu/nvgpu/common/linux/debug_allocator.c
index dfc1dc41..6a0aa4c5 100644
--- a/drivers/gpu/nvgpu/common/linux/debug_allocator.c
+++ b/drivers/gpu/nvgpu/common/linux/debug_allocator.c
@@ -13,7 +13,6 @@
13 */ 13 */
14 14
15#include "debug_allocator.h" 15#include "debug_allocator.h"
16#include "gk20a/platform_gk20a.h"
17#include "os_linux.h" 16#include "os_linux.h"
18 17
19#include <linux/debugfs.h> 18#include <linux/debugfs.h>
@@ -52,11 +51,13 @@ static const struct file_operations __alloc_fops = {
52 51
53void nvgpu_init_alloc_debug(struct gk20a *g, struct nvgpu_allocator *a) 52void nvgpu_init_alloc_debug(struct gk20a *g, struct nvgpu_allocator *a)
54{ 53{
55 if (!g->debugfs_allocators) 54 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
55
56 if (!l->debugfs_allocators)
56 return; 57 return;
57 58
58 a->debugfs_entry = debugfs_create_file(a->name, S_IRUGO, 59 a->debugfs_entry = debugfs_create_file(a->name, S_IRUGO,
59 g->debugfs_allocators, 60 l->debugfs_allocators,
60 a, &__alloc_fops); 61 a, &__alloc_fops);
61} 62}
62 63
@@ -68,14 +69,14 @@ void nvgpu_fini_alloc_debug(struct nvgpu_allocator *a)
68 69
69void nvgpu_alloc_debugfs_init(struct gk20a *g) 70void nvgpu_alloc_debugfs_init(struct gk20a *g)
70{ 71{
71 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); 72 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
72 73
73 g->debugfs_allocators = debugfs_create_dir("allocators", platform->debugfs); 74 l->debugfs_allocators = debugfs_create_dir("allocators", l->debugfs);
74 if (IS_ERR_OR_NULL(g->debugfs_allocators)) { 75 if (IS_ERR_OR_NULL(l->debugfs_allocators)) {
75 g->debugfs_allocators = NULL; 76 l->debugfs_allocators = NULL;
76 return; 77 return;
77 } 78 }
78 79
79 debugfs_create_u32("tracing", 0664, g->debugfs_allocators, 80 debugfs_create_u32("tracing", 0664, l->debugfs_allocators,
80 &nvgpu_alloc_tracing_on); 81 &nvgpu_alloc_tracing_on);
81} 82}
diff --git a/drivers/gpu/nvgpu/common/linux/debug_cde.c b/drivers/gpu/nvgpu/common/linux/debug_cde.c
index 8fcc6e84..40cc64a4 100644
--- a/drivers/gpu/nvgpu/common/linux/debug_cde.c
+++ b/drivers/gpu/nvgpu/common/linux/debug_cde.c
@@ -34,19 +34,20 @@ static const struct file_operations gk20a_cde_reload_fops = {
34 34
35void gk20a_cde_debugfs_init(struct gk20a *g) 35void gk20a_cde_debugfs_init(struct gk20a *g)
36{ 36{
37 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
37 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); 38 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g));
38 39
39 if (!platform->has_cde) 40 if (!platform->has_cde)
40 return; 41 return;
41 42
42 debugfs_create_u32("cde_parameter", S_IWUSR | S_IRUGO, 43 debugfs_create_u32("cde_parameter", S_IWUSR | S_IRUGO,
43 platform->debugfs, &g->cde_app.shader_parameter); 44 l->debugfs, &g->cde_app.shader_parameter);
44 debugfs_create_u32("cde_ctx_count", S_IWUSR | S_IRUGO, 45 debugfs_create_u32("cde_ctx_count", S_IWUSR | S_IRUGO,
45 platform->debugfs, &g->cde_app.ctx_count); 46 l->debugfs, &g->cde_app.ctx_count);
46 debugfs_create_u32("cde_ctx_usecount", S_IWUSR | S_IRUGO, 47 debugfs_create_u32("cde_ctx_usecount", S_IWUSR | S_IRUGO,
47 platform->debugfs, &g->cde_app.ctx_usecount); 48 l->debugfs, &g->cde_app.ctx_usecount);
48 debugfs_create_u32("cde_ctx_count_top", S_IWUSR | S_IRUGO, 49 debugfs_create_u32("cde_ctx_count_top", S_IWUSR | S_IRUGO,
49 platform->debugfs, &g->cde_app.ctx_count_top); 50 l->debugfs, &g->cde_app.ctx_count_top);
50 debugfs_create_file("reload_cde_firmware", S_IWUSR, platform->debugfs, 51 debugfs_create_file("reload_cde_firmware", S_IWUSR, l->debugfs,
51 g, &gk20a_cde_reload_fops); 52 g, &gk20a_cde_reload_fops);
52} 53}
diff --git a/drivers/gpu/nvgpu/common/linux/debug_ce.c b/drivers/gpu/nvgpu/common/linux/debug_ce.c
index 1c2d4170..cea0bb47 100644
--- a/drivers/gpu/nvgpu/common/linux/debug_ce.c
+++ b/drivers/gpu/nvgpu/common/linux/debug_ce.c
@@ -13,19 +13,18 @@
13 */ 13 */
14 14
15#include "debug_ce.h" 15#include "debug_ce.h"
16#include "gk20a/platform_gk20a.h"
17#include "os_linux.h" 16#include "os_linux.h"
18 17
19#include <linux/debugfs.h> 18#include <linux/debugfs.h>
20 19
21void gk20a_ce_debugfs_init(struct gk20a *g) 20void gk20a_ce_debugfs_init(struct gk20a *g)
22{ 21{
23 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); 22 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
24 23
25 debugfs_create_u32("ce_app_ctx_count", S_IWUSR | S_IRUGO, 24 debugfs_create_u32("ce_app_ctx_count", S_IWUSR | S_IRUGO,
26 platform->debugfs, &g->ce_app.ctx_count); 25 l->debugfs, &g->ce_app.ctx_count);
27 debugfs_create_u32("ce_app_state", S_IWUSR | S_IRUGO, 26 debugfs_create_u32("ce_app_state", S_IWUSR | S_IRUGO,
28 platform->debugfs, &g->ce_app.app_state); 27 l->debugfs, &g->ce_app.app_state);
29 debugfs_create_u32("ce_app_next_ctx_id", S_IWUSR | S_IRUGO, 28 debugfs_create_u32("ce_app_next_ctx_id", S_IWUSR | S_IRUGO,
30 platform->debugfs, &g->ce_app.next_ctx_id); 29 l->debugfs, &g->ce_app.next_ctx_id);
31} 30}
diff --git a/drivers/gpu/nvgpu/common/linux/debug_clk.c b/drivers/gpu/nvgpu/common/linux/debug_clk.c
index 8ffba3c8..b265ca69 100644
--- a/drivers/gpu/nvgpu/common/linux/debug_clk.c
+++ b/drivers/gpu/nvgpu/common/linux/debug_clk.c
@@ -217,49 +217,49 @@ static const struct file_operations pll_param_fops = {
217 217
218int gm20b_clk_init_debugfs(struct gk20a *g) 218int gm20b_clk_init_debugfs(struct gk20a *g)
219{ 219{
220 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
220 struct dentry *d; 221 struct dentry *d;
221 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g));
222 222
223 if (!platform->debugfs) 223 if (!l->debugfs)
224 return -EINVAL; 224 return -EINVAL;
225 225
226 d = debugfs_create_file( 226 d = debugfs_create_file(
227 "rate", S_IRUGO|S_IWUSR, platform->debugfs, g, &rate_fops); 227 "rate", S_IRUGO|S_IWUSR, l->debugfs, g, &rate_fops);
228 if (!d) 228 if (!d)
229 goto err_out; 229 goto err_out;
230 230
231 d = debugfs_create_file( 231 d = debugfs_create_file(
232 "pll_reg", S_IRUGO, platform->debugfs, g, &pll_reg_fops); 232 "pll_reg", S_IRUGO, l->debugfs, g, &pll_reg_fops);
233 if (!d) 233 if (!d)
234 goto err_out; 234 goto err_out;
235 235
236 d = debugfs_create_file("pll_reg_raw", 236 d = debugfs_create_file("pll_reg_raw",
237 S_IRUGO, platform->debugfs, g, &pll_reg_raw_fops); 237 S_IRUGO, l->debugfs, g, &pll_reg_raw_fops);
238 if (!d) 238 if (!d)
239 goto err_out; 239 goto err_out;
240 240
241 d = debugfs_create_file( 241 d = debugfs_create_file(
242 "monitor", S_IRUGO, platform->debugfs, g, &monitor_fops); 242 "monitor", S_IRUGO, l->debugfs, g, &monitor_fops);
243 if (!d) 243 if (!d)
244 goto err_out; 244 goto err_out;
245 245
246 d = debugfs_create_file( 246 d = debugfs_create_file(
247 "voltage", S_IRUGO, platform->debugfs, g, &voltage_fops); 247 "voltage", S_IRUGO, l->debugfs, g, &voltage_fops);
248 if (!d) 248 if (!d)
249 goto err_out; 249 goto err_out;
250 250
251 d = debugfs_create_file( 251 d = debugfs_create_file(
252 "pll_param", S_IRUGO, platform->debugfs, g, &pll_param_fops); 252 "pll_param", S_IRUGO, l->debugfs, g, &pll_param_fops);
253 if (!d) 253 if (!d)
254 goto err_out; 254 goto err_out;
255 255
256 d = debugfs_create_u32("pll_na_mode", S_IRUGO, platform->debugfs, 256 d = debugfs_create_u32("pll_na_mode", S_IRUGO, l->debugfs,
257 (u32 *)&g->clk.gpc_pll.mode); 257 (u32 *)&g->clk.gpc_pll.mode);
258 if (!d) 258 if (!d)
259 goto err_out; 259 goto err_out;
260 260
261 d = debugfs_create_u32("fmax2x_at_vmin_safe_t", S_IRUGO, 261 d = debugfs_create_u32("fmax2x_at_vmin_safe_t", S_IRUGO,
262 platform->debugfs, (u32 *)&g->clk.dvfs_safe_max_freq); 262 l->debugfs, (u32 *)&g->clk.dvfs_safe_max_freq);
263 if (!d) 263 if (!d)
264 goto err_out; 264 goto err_out;
265 265
@@ -267,6 +267,6 @@ int gm20b_clk_init_debugfs(struct gk20a *g)
267 267
268err_out: 268err_out:
269 pr_err("%s: Failed to make debugfs node\n", __func__); 269 pr_err("%s: Failed to make debugfs node\n", __func__);
270 debugfs_remove_recursive(platform->debugfs); 270 debugfs_remove_recursive(l->debugfs);
271 return -ENOMEM; 271 return -ENOMEM;
272} 272}
diff --git a/drivers/gpu/nvgpu/common/linux/debug_fifo.c b/drivers/gpu/nvgpu/common/linux/debug_fifo.c
index 1245c093..a240a138 100644
--- a/drivers/gpu/nvgpu/common/linux/debug_fifo.c
+++ b/drivers/gpu/nvgpu/common/linux/debug_fifo.c
@@ -13,7 +13,6 @@
13 */ 13 */
14 14
15#include "debug_fifo.h" 15#include "debug_fifo.h"
16#include "gk20a/platform_gk20a.h"
17#include "os_linux.h" 16#include "os_linux.h"
18 17
19#include <linux/debugfs.h> 18#include <linux/debugfs.h>
@@ -292,9 +291,8 @@ static const struct file_operations gk20a_fifo_profile_stats_debugfs_fops = {
292 291
293void gk20a_fifo_debugfs_init(struct gk20a *g) 292void gk20a_fifo_debugfs_init(struct gk20a *g)
294{ 293{
295 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); 294 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
296 295 struct dentry *gpu_root = l->debugfs;
297 struct dentry *gpu_root = platform->debugfs;
298 struct dentry *fifo_root; 296 struct dentry *fifo_root;
299 struct dentry *profile_root; 297 struct dentry *profile_root;
300 298
diff --git a/drivers/gpu/nvgpu/common/linux/debug_gr.c b/drivers/gpu/nvgpu/common/linux/debug_gr.c
index 732c2a7e..d54c6d63 100644
--- a/drivers/gpu/nvgpu/common/linux/debug_gr.c
+++ b/drivers/gpu/nvgpu/common/linux/debug_gr.c
@@ -13,18 +13,17 @@
13 */ 13 */
14 14
15#include "debug_gr.h" 15#include "debug_gr.h"
16#include "gk20a/platform_gk20a.h"
17#include "os_linux.h" 16#include "os_linux.h"
18 17
19#include <linux/debugfs.h> 18#include <linux/debugfs.h>
20 19
21int gr_gk20a_debugfs_init(struct gk20a *g) 20int gr_gk20a_debugfs_init(struct gk20a *g)
22{ 21{
23 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); 22 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
24 23
25 g->debugfs_gr_default_attrib_cb_size = 24 l->debugfs_gr_default_attrib_cb_size =
26 debugfs_create_u32("gr_default_attrib_cb_size", 25 debugfs_create_u32("gr_default_attrib_cb_size",
27 S_IRUGO|S_IWUSR, platform->debugfs, 26 S_IRUGO|S_IWUSR, l->debugfs,
28 &g->gr.attrib_cb_default_size); 27 &g->gr.attrib_cb_default_size);
29 28
30 return 0; 29 return 0;
diff --git a/drivers/gpu/nvgpu/common/linux/debug_mm.c b/drivers/gpu/nvgpu/common/linux/debug_mm.c
index bed8d10b..f2c42e70 100644
--- a/drivers/gpu/nvgpu/common/linux/debug_mm.c
+++ b/drivers/gpu/nvgpu/common/linux/debug_mm.c
@@ -13,15 +13,14 @@
13 */ 13 */
14 14
15#include "debug_mm.h" 15#include "debug_mm.h"
16#include "gk20a/platform_gk20a.h"
17#include "os_linux.h" 16#include "os_linux.h"
18 17
19#include <linux/debugfs.h> 18#include <linux/debugfs.h>
20 19
21void gk20a_mm_debugfs_init(struct gk20a *g) 20void gk20a_mm_debugfs_init(struct gk20a *g)
22{ 21{
23 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); 22 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
24 23
25 debugfs_create_bool("force_pramin", 0664, platform->debugfs, 24 debugfs_create_bool("force_pramin", 0664, l->debugfs,
26 &g->mm.force_pramin); 25 &g->mm.force_pramin);
27} 26}
diff --git a/drivers/gpu/nvgpu/common/linux/debug_pmu.c b/drivers/gpu/nvgpu/common/linux/debug_pmu.c
index 1c0b2520..191fcb0e 100644
--- a/drivers/gpu/nvgpu/common/linux/debug_pmu.c
+++ b/drivers/gpu/nvgpu/common/linux/debug_pmu.c
@@ -14,7 +14,6 @@
14 14
15#include <nvgpu/enabled.h> 15#include <nvgpu/enabled.h>
16#include "debug_pmu.h" 16#include "debug_pmu.h"
17#include "gk20a/platform_gk20a.h"
18#include "os_linux.h" 17#include "os_linux.h"
19 18
20#include <linux/debugfs.h> 19#include <linux/debugfs.h>
@@ -420,64 +419,64 @@ static const struct file_operations security_fops = {
420int gk20a_pmu_debugfs_init(struct gk20a *g) 419int gk20a_pmu_debugfs_init(struct gk20a *g)
421{ 420{
422 struct dentry *d; 421 struct dentry *d;
423 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); 422 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
424 423
425 d = debugfs_create_file( 424 d = debugfs_create_file(
426 "lpwr_debug", S_IRUGO|S_IWUSR, platform->debugfs, g, 425 "lpwr_debug", S_IRUGO|S_IWUSR, l->debugfs, g,
427 &lpwr_debug_fops); 426 &lpwr_debug_fops);
428 if (!d) 427 if (!d)
429 goto err_out; 428 goto err_out;
430 429
431 d = debugfs_create_file( 430 d = debugfs_create_file(
432 "mscg_residency", S_IRUGO|S_IWUSR, platform->debugfs, g, 431 "mscg_residency", S_IRUGO|S_IWUSR, l->debugfs, g,
433 &mscg_stat_fops); 432 &mscg_stat_fops);
434 if (!d) 433 if (!d)
435 goto err_out; 434 goto err_out;
436 435
437 d = debugfs_create_file( 436 d = debugfs_create_file(
438 "mscg_transitions", S_IRUGO, platform->debugfs, g, 437 "mscg_transitions", S_IRUGO, l->debugfs, g,
439 &mscg_transitions_fops); 438 &mscg_transitions_fops);
440 if (!d) 439 if (!d)
441 goto err_out; 440 goto err_out;
442 441
443 d = debugfs_create_file( 442 d = debugfs_create_file(
444 "elpg_residency", S_IRUGO|S_IWUSR, platform->debugfs, g, 443 "elpg_residency", S_IRUGO|S_IWUSR, l->debugfs, g,
445 &elpg_stat_fops); 444 &elpg_stat_fops);
446 if (!d) 445 if (!d)
447 goto err_out; 446 goto err_out;
448 447
449 d = debugfs_create_file( 448 d = debugfs_create_file(
450 "elpg_transitions", S_IRUGO, platform->debugfs, g, 449 "elpg_transitions", S_IRUGO, l->debugfs, g,
451 &elpg_transitions_fops); 450 &elpg_transitions_fops);
452 if (!d) 451 if (!d)
453 goto err_out; 452 goto err_out;
454 453
455 d = debugfs_create_file( 454 d = debugfs_create_file(
456 "falc_trace", S_IRUGO, platform->debugfs, g, 455 "falc_trace", S_IRUGO, l->debugfs, g,
457 &falc_trace_fops); 456 &falc_trace_fops);
458 if (!d) 457 if (!d)
459 goto err_out; 458 goto err_out;
460 459
461 d = debugfs_create_file( 460 d = debugfs_create_file(
462 "perfmon_events_enable", S_IRUGO, platform->debugfs, g, 461 "perfmon_events_enable", S_IRUGO, l->debugfs, g,
463 &perfmon_events_enable_fops); 462 &perfmon_events_enable_fops);
464 if (!d) 463 if (!d)
465 goto err_out; 464 goto err_out;
466 465
467 d = debugfs_create_file( 466 d = debugfs_create_file(
468 "perfmon_events_count", S_IRUGO, platform->debugfs, g, 467 "perfmon_events_count", S_IRUGO, l->debugfs, g,
469 &perfmon_events_count_fops); 468 &perfmon_events_count_fops);
470 if (!d) 469 if (!d)
471 goto err_out; 470 goto err_out;
472 471
473 d = debugfs_create_file( 472 d = debugfs_create_file(
474 "pmu_security", S_IRUGO, platform->debugfs, g, 473 "pmu_security", S_IRUGO, l->debugfs, g,
475 &security_fops); 474 &security_fops);
476 if (!d) 475 if (!d)
477 goto err_out; 476 goto err_out;
478 return 0; 477 return 0;
479err_out: 478err_out:
480 pr_err("%s: Failed to make debugfs node\n", __func__); 479 pr_err("%s: Failed to make debugfs node\n", __func__);
481 debugfs_remove_recursive(platform->debugfs); 480 debugfs_remove_recursive(l->debugfs);
482 return -ENOMEM; 481 return -ENOMEM;
483} 482}
diff --git a/drivers/gpu/nvgpu/common/linux/debug_sched.c b/drivers/gpu/nvgpu/common/linux/debug_sched.c
index c0dcf8d9..a42deb18 100644
--- a/drivers/gpu/nvgpu/common/linux/debug_sched.c
+++ b/drivers/gpu/nvgpu/common/linux/debug_sched.c
@@ -13,7 +13,6 @@
13 */ 13 */
14 14
15#include "debug_sched.h" 15#include "debug_sched.h"
16#include "gk20a/platform_gk20a.h"
17#include "os_linux.h" 16#include "os_linux.h"
18 17
19#include <linux/debugfs.h> 18#include <linux/debugfs.h>
@@ -73,8 +72,8 @@ static const struct file_operations gk20a_sched_debugfs_fops = {
73 72
74void gk20a_sched_debugfs_init(struct gk20a *g) 73void gk20a_sched_debugfs_init(struct gk20a *g)
75{ 74{
76 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); 75 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
77 76
78 debugfs_create_file("sched_ctrl", S_IRUGO, platform->debugfs, 77 debugfs_create_file("sched_ctrl", S_IRUGO, l->debugfs,
79 g, &gk20a_sched_debugfs_fops); 78 g, &gk20a_sched_debugfs_fops);
80} 79}
diff --git a/drivers/gpu/nvgpu/common/linux/os_linux.h b/drivers/gpu/nvgpu/common/linux/os_linux.h
index 8f304fe3..d7fdfa78 100644
--- a/drivers/gpu/nvgpu/common/linux/os_linux.h
+++ b/drivers/gpu/nvgpu/common/linux/os_linux.h
@@ -83,6 +83,30 @@ struct nvgpu_os_linux {
83 83
84 struct work_struct nonstall_fn_work; 84 struct work_struct nonstall_fn_work;
85 struct workqueue_struct *nonstall_work_queue; 85 struct workqueue_struct *nonstall_work_queue;
86
87#ifdef CONFIG_DEBUG_FS
88 struct dentry *debugfs;
89 struct dentry *debugfs_alias;
90
91 struct dentry *debugfs_ltc_enabled;
92 struct dentry *debugfs_timeouts_enabled;
93 struct dentry *debugfs_gr_idle_timeout_default;
94 struct dentry *debugfs_bypass_smmu;
95 struct dentry *debugfs_disable_bigpage;
96 struct dentry *debugfs_gr_default_attrib_cb_size;
97
98 struct dentry *debugfs_timeslice_low_priority_us;
99 struct dentry *debugfs_timeslice_medium_priority_us;
100 struct dentry *debugfs_timeslice_high_priority_us;
101 struct dentry *debugfs_runlist_interleave;
102 struct dentry *debugfs_allocators;
103 struct dentry *debugfs_xve;
104 struct dentry *debugfs_kmem;
105
106 struct dentry *debugfs_force_preemption_cilp;
107 struct dentry *debugfs_force_preemption_gfxp;
108 struct dentry *debugfs_dump_ctxsw_stats;
109#endif
86}; 110};
87 111
88static inline struct nvgpu_os_linux *nvgpu_os_linux_from_gk20a(struct gk20a *g) 112static inline struct nvgpu_os_linux *nvgpu_os_linux_from_gk20a(struct gk20a *g)
diff --git a/drivers/gpu/nvgpu/common/linux/pci.c b/drivers/gpu/nvgpu/common/linux/pci.c
index 3a452d18..3ff2630f 100644
--- a/drivers/gpu/nvgpu/common/linux/pci.c
+++ b/drivers/gpu/nvgpu/common/linux/pci.c
@@ -443,6 +443,7 @@ static void nvgpu_pci_remove(struct pci_dev *pdev)
443{ 443{
444 struct gk20a_platform *platform = gk20a_get_platform(&pdev->dev); 444 struct gk20a_platform *platform = gk20a_get_platform(&pdev->dev);
445 struct gk20a *g = get_gk20a(&pdev->dev); 445 struct gk20a *g = get_gk20a(&pdev->dev);
446 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
446 447
447 gk20a_dbg(gpu_dbg_shutdown, "Removing nvgpu driver!\n"); 448 gk20a_dbg(gpu_dbg_shutdown, "Removing nvgpu driver!\n");
448 449
@@ -474,8 +475,8 @@ static void nvgpu_pci_remove(struct pci_dev *pdev)
474 gk20a_dbg(gpu_dbg_shutdown, "User de-init done.\b"); 475 gk20a_dbg(gpu_dbg_shutdown, "User de-init done.\b");
475 476
476#ifdef CONFIG_DEBUG_FS 477#ifdef CONFIG_DEBUG_FS
477 debugfs_remove_recursive(platform->debugfs); 478 debugfs_remove_recursive(l->debugfs);
478 debugfs_remove_recursive(platform->debugfs_alias); 479 debugfs_remove_recursive(l->debugfs_alias);
479#endif 480#endif
480 481
481 nvgpu_remove_sysfs(dev_from_gk20a(g)); 482 nvgpu_remove_sysfs(dev_from_gk20a(g));