summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--drivers/gpu/nvgpu/clk/clk_arb.c6
-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
-rw-r--r--drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c13
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h16
-rw-r--r--drivers/gpu/nvgpu/gk20a/platform_gk20a.h4
-rw-r--r--drivers/gpu/nvgpu/gm206/bios_gm206.c3
-rw-r--r--drivers/gpu/nvgpu/gp106/clk_gp106.c11
-rw-r--r--drivers/gpu/nvgpu/gp106/mclk_gp106.c6
-rw-r--r--drivers/gpu/nvgpu/gp106/therm_gp106.c5
-rw-r--r--drivers/gpu/nvgpu/gp106/xve_gp106.c18
-rw-r--r--drivers/gpu/nvgpu/gp10b/gr_gp10b.h3
-rw-r--r--drivers/gpu/nvgpu/pmgr/pmgr.c12
23 files changed, 152 insertions, 163 deletions
diff --git a/drivers/gpu/nvgpu/clk/clk_arb.c b/drivers/gpu/nvgpu/clk/clk_arb.c
index 2cb7a42a..3caa5409 100644
--- a/drivers/gpu/nvgpu/clk/clk_arb.c
+++ b/drivers/gpu/nvgpu/clk/clk_arb.c
@@ -32,7 +32,6 @@
32#include "clk/clk_arb.h" 32#include "clk/clk_arb.h"
33 33
34#ifdef CONFIG_DEBUG_FS 34#ifdef CONFIG_DEBUG_FS
35#include "gk20a/platform_gk20a.h"
36#include "common/linux/os_linux.h" 35#include "common/linux/os_linux.h"
37#endif 36#endif
38 37
@@ -2077,9 +2076,8 @@ static const struct file_operations nvgpu_clk_arb_stats_fops = {
2077 2076
2078static int nvgpu_clk_arb_debugfs_init(struct gk20a *g) 2077static int nvgpu_clk_arb_debugfs_init(struct gk20a *g)
2079{ 2078{
2080 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); 2079 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
2081 2080 struct dentry *gpu_root = l->debugfs;
2082 struct dentry *gpu_root = platform->debugfs;
2083 struct dentry *d; 2081 struct dentry *d;
2084 2082
2085 gk20a_dbg(gpu_dbg_info, "g=%p", g); 2083 gk20a_dbg(gpu_dbg_info, "g=%p", g);
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));
diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
index 84bf20b8..5ee90440 100644
--- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
@@ -27,7 +27,6 @@
27#include "fecs_trace_gk20a.h" 27#include "fecs_trace_gk20a.h"
28#include "gk20a.h" 28#include "gk20a.h"
29#include "gr_gk20a.h" 29#include "gr_gk20a.h"
30#include "platform_gk20a.h"
31#include "common/linux/os_linux.h" 30#include "common/linux/os_linux.h"
32 31
33#include <nvgpu/log.h> 32#include <nvgpu/log.h>
@@ -537,21 +536,21 @@ DEFINE_SIMPLE_ATTRIBUTE(gk20a_fecs_trace_debugfs_write_fops,
537 536
538static void gk20a_fecs_trace_debugfs_init(struct gk20a *g) 537static void gk20a_fecs_trace_debugfs_init(struct gk20a *g)
539{ 538{
540 struct gk20a_platform *plat = dev_get_drvdata(dev_from_gk20a(g)); 539 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
541 540
542 debugfs_create_file("ctxsw_trace_read", 0600, plat->debugfs, g, 541 debugfs_create_file("ctxsw_trace_read", 0600, l->debugfs, g,
543 &gk20a_fecs_trace_debugfs_read_fops); 542 &gk20a_fecs_trace_debugfs_read_fops);
544 debugfs_create_file("ctxsw_trace_write", 0600, plat->debugfs, g, 543 debugfs_create_file("ctxsw_trace_write", 0600, l->debugfs, g,
545 &gk20a_fecs_trace_debugfs_write_fops); 544 &gk20a_fecs_trace_debugfs_write_fops);
546 debugfs_create_file("ctxsw_trace_ring", 0600, plat->debugfs, g, 545 debugfs_create_file("ctxsw_trace_ring", 0600, l->debugfs, g,
547 &gk20a_fecs_trace_debugfs_ring_fops); 546 &gk20a_fecs_trace_debugfs_ring_fops);
548} 547}
549 548
550static void gk20a_fecs_trace_debugfs_cleanup(struct gk20a *g) 549static void gk20a_fecs_trace_debugfs_cleanup(struct gk20a *g)
551{ 550{
552 struct gk20a_platform *plat = dev_get_drvdata(dev_from_gk20a(g)); 551 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
553 552
554 debugfs_remove_recursive(plat->debugfs); 553 debugfs_remove_recursive(l->debugfs);
555} 554}
556 555
557#else 556#else
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index f7b714f2..83cdeb3f 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -1147,22 +1147,6 @@ struct gk20a {
1147 1147
1148 struct nvgpu_spinlock ltc_enabled_lock; 1148 struct nvgpu_spinlock ltc_enabled_lock;
1149 1149
1150#ifdef CONFIG_DEBUG_FS
1151 struct dentry *debugfs_ltc_enabled;
1152 struct dentry *debugfs_timeouts_enabled;
1153 struct dentry *debugfs_gr_idle_timeout_default;
1154 struct dentry *debugfs_bypass_smmu;
1155 struct dentry *debugfs_disable_bigpage;
1156 struct dentry *debugfs_gr_default_attrib_cb_size;
1157
1158 struct dentry *debugfs_timeslice_low_priority_us;
1159 struct dentry *debugfs_timeslice_medium_priority_us;
1160 struct dentry *debugfs_timeslice_high_priority_us;
1161 struct dentry *debugfs_runlist_interleave;
1162 struct dentry *debugfs_allocators;
1163 struct dentry *debugfs_xve;
1164 struct dentry *debugfs_kmem;
1165#endif
1166 struct gk20a_ctxsw_ucode_info ctxsw_ucode_info; 1150 struct gk20a_ctxsw_ucode_info ctxsw_ucode_info;
1167 1151
1168 /* 1152 /*
diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
index 17c3f9a4..791286f0 100644
--- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
@@ -61,10 +61,6 @@ struct gk20a_platform {
61 /* Set if the platform can unify the small/large address spaces. */ 61 /* Set if the platform can unify the small/large address spaces. */
62 bool unify_address_spaces; 62 bool unify_address_spaces;
63 63
64 /* Should be populated by probe. */
65 struct dentry *debugfs;
66 struct dentry *debugfs_alias;
67
68 /* Clock configuration is stored here. Platform probe is responsible 64 /* Clock configuration is stored here. Platform probe is responsible
69 * for filling this data. */ 65 * for filling this data. */
70 struct clk *clk[GK20A_CLKS_MAX]; 66 struct clk *clk[GK20A_CLKS_MAX];
diff --git a/drivers/gpu/nvgpu/gm206/bios_gm206.c b/drivers/gpu/nvgpu/gm206/bios_gm206.c
index 476affa0..e9473414 100644
--- a/drivers/gpu/nvgpu/gm206/bios_gm206.c
+++ b/drivers/gpu/nvgpu/gm206/bios_gm206.c
@@ -172,6 +172,7 @@ int gm206_bios_init(struct gk20a *g)
172 unsigned int i; 172 unsigned int i;
173 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); 173 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g));
174#ifdef CONFIG_DEBUG_FS 174#ifdef CONFIG_DEBUG_FS
175 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
175 struct dentry *d; 176 struct dentry *d;
176#endif 177#endif
177 struct nvgpu_firmware *bios_fw; 178 struct nvgpu_firmware *bios_fw;
@@ -239,7 +240,7 @@ int gm206_bios_init(struct gk20a *g)
239 g->bios_blob.data = g->bios.data; 240 g->bios_blob.data = g->bios.data;
240 g->bios_blob.size = g->bios.size; 241 g->bios_blob.size = g->bios.size;
241 242
242 d = debugfs_create_blob("bios", S_IRUGO, platform->debugfs, 243 d = debugfs_create_blob("bios", S_IRUGO, l->debugfs,
243 &g->bios_blob); 244 &g->bios_blob);
244 if (!d) 245 if (!d)
245 nvgpu_err(g, "No debugfs?"); 246 nvgpu_err(g, "No debugfs?");
diff --git a/drivers/gpu/nvgpu/gp106/clk_gp106.c b/drivers/gpu/nvgpu/gp106/clk_gp106.c
index 105f8bd5..bcf95b01 100644
--- a/drivers/gpu/nvgpu/gp106/clk_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/clk_gp106.c
@@ -23,9 +23,6 @@
23#include <nvgpu/kmem.h> 23#include <nvgpu/kmem.h>
24 24
25#include "gk20a/gk20a.h" 25#include "gk20a/gk20a.h"
26#ifdef CONFIG_DEBUG_FS
27#include "gk20a/platform_gk20a.h"
28#endif
29#include "common/linux/os_linux.h" 26#include "common/linux/os_linux.h"
30 27
31#include "clk_gp106.h" 28#include "clk_gp106.h"
@@ -240,10 +237,10 @@ static int gp106_get_rate_show(void *data , u64 *val) {
240DEFINE_SIMPLE_ATTRIBUTE(get_rate_fops, gp106_get_rate_show, NULL, "%llu\n"); 237DEFINE_SIMPLE_ATTRIBUTE(get_rate_fops, gp106_get_rate_show, NULL, "%llu\n");
241 238
242 239
243static int clk_gp106_debugfs_init(struct gk20a *g) { 240static int clk_gp106_debugfs_init(struct gk20a *g)
244 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); 241{
245 242 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
246 struct dentry *gpu_root = platform->debugfs; 243 struct dentry *gpu_root = l->debugfs;
247 struct dentry *clocks_root; 244 struct dentry *clocks_root;
248 struct dentry *d; 245 struct dentry *d;
249 unsigned int i; 246 unsigned int i;
diff --git a/drivers/gpu/nvgpu/gp106/mclk_gp106.c b/drivers/gpu/nvgpu/gp106/mclk_gp106.c
index 47ba4ea9..74c8aef3 100644
--- a/drivers/gpu/nvgpu/gp106/mclk_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/mclk_gp106.c
@@ -18,7 +18,6 @@
18 18
19#include "gk20a/gk20a.h" 19#include "gk20a/gk20a.h"
20#ifdef CONFIG_DEBUG_FS 20#ifdef CONFIG_DEBUG_FS
21#include "gk20a/platform_gk20a.h"
22#include "common/linux/os_linux.h" 21#include "common/linux/os_linux.h"
23#endif 22#endif
24#include "gp106/mclk_gp106.h" 23#include "gp106/mclk_gp106.h"
@@ -3495,9 +3494,8 @@ static const struct file_operations mclk_switch_stats_fops = {
3495 3494
3496static int mclk_debugfs_init(struct gk20a *g) 3495static int mclk_debugfs_init(struct gk20a *g)
3497{ 3496{
3498 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); 3497 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
3499 3498 struct dentry *gpu_root = l->debugfs;
3500 struct dentry *gpu_root = platform->debugfs;
3501 struct dentry *d; 3499 struct dentry *d;
3502 3500
3503 gk20a_dbg(gpu_dbg_info, "g=%p", g); 3501 gk20a_dbg(gpu_dbg_info, "g=%p", g);
diff --git a/drivers/gpu/nvgpu/gp106/therm_gp106.c b/drivers/gpu/nvgpu/gp106/therm_gp106.c
index 4be8e6cd..4ec43293 100644
--- a/drivers/gpu/nvgpu/gp106/therm_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/therm_gp106.c
@@ -18,7 +18,6 @@
18 18
19#ifdef CONFIG_DEBUG_FS 19#ifdef CONFIG_DEBUG_FS
20#include <linux/debugfs.h> 20#include <linux/debugfs.h>
21#include "gk20a/platform_gk20a.h"
22#include "common/linux/os_linux.h" 21#include "common/linux/os_linux.h"
23#endif 22#endif
24 23
@@ -72,11 +71,11 @@ DEFINE_SIMPLE_ATTRIBUTE(therm_ctrl_fops, therm_get_internal_sensor_curr_temp, NU
72 71
73void gp106_therm_debugfs_init(struct gk20a *g) 72void gp106_therm_debugfs_init(struct gk20a *g)
74{ 73{
75 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); 74 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
76 struct dentry *dbgentry; 75 struct dentry *dbgentry;
77 76
78 dbgentry = debugfs_create_file( 77 dbgentry = debugfs_create_file(
79 "temp", S_IRUGO, platform->debugfs, g, &therm_ctrl_fops); 78 "temp", S_IRUGO, l->debugfs, g, &therm_ctrl_fops);
80 if (!dbgentry) 79 if (!dbgentry)
81 nvgpu_err(g, "debugfs entry create failed for therm_curr_temp"); 80 nvgpu_err(g, "debugfs entry create failed for therm_curr_temp");
82} 81}
diff --git a/drivers/gpu/nvgpu/gp106/xve_gp106.c b/drivers/gpu/nvgpu/gp106/xve_gp106.c
index 77641240..67b77048 100644
--- a/drivers/gpu/nvgpu/gp106/xve_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/xve_gp106.c
@@ -22,10 +22,10 @@
22#include "gk20a/gk20a.h" 22#include "gk20a/gk20a.h"
23#include "gm206/bios_gm206.h" 23#include "gm206/bios_gm206.h"
24#include "gp106/xve_gp106.h" 24#include "gp106/xve_gp106.h"
25
26#ifdef CONFIG_DEBUG_FS 25#ifdef CONFIG_DEBUG_FS
27#include "gk20a/platform_gk20a.h" 26#include "gk20a/platform_gk20a.h"
28#endif 27#endif
28#include "common/linux/os_linux.h"
29 29
30#include <nvgpu/bug.h> 30#include <nvgpu/bug.h>
31 31
@@ -607,12 +607,12 @@ int xve_sw_init_gp106(struct device *dev)
607{ 607{
608 int err = -ENODEV; 608 int err = -ENODEV;
609#ifdef CONFIG_DEBUG_FS 609#ifdef CONFIG_DEBUG_FS
610 struct gk20a *g = get_gk20a(dev); 610 struct gk20a *g = gk20a_from_dev(dev);
611 struct gk20a_platform *plat = gk20a_get_platform(dev); 611 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
612 struct dentry *gpu_root = plat->debugfs; 612 struct dentry *gpu_root = l->debugfs;
613 613
614 g->debugfs_xve = debugfs_create_dir("xve", gpu_root); 614 l->debugfs_xve = debugfs_create_dir("xve", gpu_root);
615 if (IS_ERR_OR_NULL(g->debugfs_xve)) 615 if (IS_ERR_OR_NULL(l->debugfs_xve))
616 goto fail; 616 goto fail;
617 617
618 /* 618 /*
@@ -620,13 +620,13 @@ int xve_sw_init_gp106(struct device *dev)
620 * worrying the higher level SW. 620 * worrying the higher level SW.
621 */ 621 */
622 debugfs_create_file("link_speed", S_IRUGO, 622 debugfs_create_file("link_speed", S_IRUGO,
623 g->debugfs_xve, g, 623 l->debugfs_xve, g,
624 &xve_link_speed_fops); 624 &xve_link_speed_fops);
625 debugfs_create_file("available_speeds", S_IRUGO, 625 debugfs_create_file("available_speeds", S_IRUGO,
626 g->debugfs_xve, g, 626 l->debugfs_xve, g,
627 &xve_available_speeds_fops); 627 &xve_available_speeds_fops);
628 debugfs_create_file("link_control_status", S_IRUGO, 628 debugfs_create_file("link_control_status", S_IRUGO,
629 g->debugfs_xve, g, 629 l->debugfs_xve, g,
630 &xve_link_control_status_fops); 630 &xve_link_control_status_fops);
631 631
632 err = 0; 632 err = 0;
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h
index 161fec87..42a647b4 100644
--- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h
+++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h
@@ -64,9 +64,6 @@ struct gr_t18x {
64 bool force_preemption_cilp; 64 bool force_preemption_cilp;
65 bool dump_ctxsw_stats_on_channel_close; 65 bool dump_ctxsw_stats_on_channel_close;
66#endif 66#endif
67 struct dentry *debugfs_force_preemption_cilp;
68 struct dentry *debugfs_force_preemption_gfxp;
69 struct dentry *debugfs_dump_ctxsw_stats;
70 } ctx_vars; 67 } ctx_vars;
71 68
72 u32 fecs_feature_override_ecc_val; 69 u32 fecs_feature_override_ecc_val;
diff --git a/drivers/gpu/nvgpu/pmgr/pmgr.c b/drivers/gpu/nvgpu/pmgr/pmgr.c
index b1c9ef79..3e26dc4d 100644
--- a/drivers/gpu/nvgpu/pmgr/pmgr.c
+++ b/drivers/gpu/nvgpu/pmgr/pmgr.c
@@ -17,7 +17,6 @@
17 17
18#ifdef CONFIG_DEBUG_FS 18#ifdef CONFIG_DEBUG_FS
19#include <linux/debugfs.h> 19#include <linux/debugfs.h>
20#include "gk20a/platform_gk20a.h"
21#include "common/linux/os_linux.h" 20#include "common/linux/os_linux.h"
22#endif 21#endif
23 22
@@ -112,22 +111,23 @@ DEFINE_SIMPLE_ATTRIBUTE(
112DEFINE_SIMPLE_ATTRIBUTE( 111DEFINE_SIMPLE_ATTRIBUTE(
113 pmgr_voltage_ctrl_fops, pmgr_pwr_devices_get_voltage_u64, NULL, "%llu\n"); 112 pmgr_voltage_ctrl_fops, pmgr_pwr_devices_get_voltage_u64, NULL, "%llu\n");
114 113
115static void pmgr_debugfs_init(struct gk20a *g) { 114static void pmgr_debugfs_init(struct gk20a *g)
116 struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); 115{
116 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
117 struct dentry *dbgentry; 117 struct dentry *dbgentry;
118 118
119 dbgentry = debugfs_create_file( 119 dbgentry = debugfs_create_file(
120 "power", S_IRUGO, platform->debugfs, g, &pmgr_power_ctrl_fops); 120 "power", S_IRUGO, l->debugfs, g, &pmgr_power_ctrl_fops);
121 if (!dbgentry) 121 if (!dbgentry)
122 nvgpu_err(g, "debugfs entry create failed for power"); 122 nvgpu_err(g, "debugfs entry create failed for power");
123 123
124 dbgentry = debugfs_create_file( 124 dbgentry = debugfs_create_file(
125 "current", S_IRUGO, platform->debugfs, g, &pmgr_current_ctrl_fops); 125 "current", S_IRUGO, l->debugfs, g, &pmgr_current_ctrl_fops);
126 if (!dbgentry) 126 if (!dbgentry)
127 nvgpu_err(g, "debugfs entry create failed for current"); 127 nvgpu_err(g, "debugfs entry create failed for current");
128 128
129 dbgentry = debugfs_create_file( 129 dbgentry = debugfs_create_file(
130 "voltage", S_IRUGO, platform->debugfs, g, &pmgr_voltage_ctrl_fops); 130 "voltage", S_IRUGO, l->debugfs, g, &pmgr_voltage_ctrl_fops);
131 if (!dbgentry) 131 if (!dbgentry)
132 nvgpu_err(g, "debugfs entry create failed for voltage"); 132 nvgpu_err(g, "debugfs entry create failed for voltage");
133} 133}