From 972c42fddf13f658242a4f92124e5fcf194672b3 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Thu, 27 Jul 2017 13:31:32 -0700 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1528263 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/clk/clk_arb.c | 6 +- drivers/gpu/nvgpu/common/linux/debug.c | 84 ++++++++++++------------ drivers/gpu/nvgpu/common/linux/debug_allocator.c | 17 ++--- drivers/gpu/nvgpu/common/linux/debug_cde.c | 11 ++-- drivers/gpu/nvgpu/common/linux/debug_ce.c | 9 ++- drivers/gpu/nvgpu/common/linux/debug_clk.c | 22 +++---- drivers/gpu/nvgpu/common/linux/debug_fifo.c | 6 +- drivers/gpu/nvgpu/common/linux/debug_gr.c | 7 +- drivers/gpu/nvgpu/common/linux/debug_mm.c | 5 +- drivers/gpu/nvgpu/common/linux/debug_pmu.c | 23 ++++--- drivers/gpu/nvgpu/common/linux/debug_sched.c | 5 +- drivers/gpu/nvgpu/common/linux/os_linux.h | 24 +++++++ drivers/gpu/nvgpu/common/linux/pci.c | 5 +- drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | 13 ++-- drivers/gpu/nvgpu/gk20a/gk20a.h | 16 ----- drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 4 -- drivers/gpu/nvgpu/gm206/bios_gm206.c | 3 +- drivers/gpu/nvgpu/gp106/clk_gp106.c | 11 ++-- drivers/gpu/nvgpu/gp106/mclk_gp106.c | 6 +- drivers/gpu/nvgpu/gp106/therm_gp106.c | 5 +- drivers/gpu/nvgpu/gp106/xve_gp106.c | 18 ++--- drivers/gpu/nvgpu/gp10b/gr_gp10b.h | 3 - drivers/gpu/nvgpu/pmgr/pmgr.c | 12 ++-- 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 @@ #include "clk/clk_arb.h" #ifdef CONFIG_DEBUG_FS -#include "gk20a/platform_gk20a.h" #include "common/linux/os_linux.h" #endif @@ -2077,9 +2076,8 @@ static const struct file_operations nvgpu_clk_arb_stats_fops = { static int nvgpu_clk_arb_debugfs_init(struct gk20a *g) { - struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); - - struct dentry *gpu_root = platform->debugfs; + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); + struct dentry *gpu_root = l->debugfs; struct dentry *d; 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 = { static int gk20a_railgating_debugfs_init(struct gk20a *g) { - struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); struct dentry *d; if (!g->can_railgate) return 0; d = debugfs_create_file( - "railgate_residency", S_IRUGO|S_IWUSR, platform->debugfs, g, + "railgate_residency", S_IRUGO|S_IWUSR, l->debugfs, g, &railgate_residency_fops); if (!d) return -ENOMEM; @@ -240,101 +240,101 @@ static int gk20a_railgating_debugfs_init(struct gk20a *g) void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink) { + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); struct device *dev = dev_from_gk20a(g); - struct gk20a_platform *platform = dev_get_drvdata(dev); - platform->debugfs = debugfs_create_dir(dev_name(dev), NULL); - if (!platform->debugfs) + l->debugfs = debugfs_create_dir(dev_name(dev), NULL); + if (!l->debugfs) return; if (debugfs_symlink) - platform->debugfs_alias = + l->debugfs_alias = debugfs_create_symlink(debugfs_symlink, NULL, dev_name(dev)); - debugfs_create_file("status", S_IRUGO, platform->debugfs, + debugfs_create_file("status", S_IRUGO, l->debugfs, dev, &gk20a_debug_fops); - debugfs_create_file("gr_status", S_IRUGO, platform->debugfs, + debugfs_create_file("gr_status", S_IRUGO, l->debugfs, dev, &gk20a_gr_debug_fops); debugfs_create_u32("trace_cmdbuf", S_IRUGO|S_IWUSR, - platform->debugfs, &gk20a_debug_trace_cmdbuf); + l->debugfs, &gk20a_debug_trace_cmdbuf); debugfs_create_u32("ch_wdt_timeout_ms", S_IRUGO|S_IWUSR, - platform->debugfs, &g->ch_wdt_timeout_ms); + l->debugfs, &g->ch_wdt_timeout_ms); debugfs_create_u32("disable_syncpoints", S_IRUGO|S_IWUSR, - platform->debugfs, &g->disable_syncpoints); + l->debugfs, &g->disable_syncpoints); /* Legacy debugging API. */ debugfs_create_u32("dbg_mask", S_IRUGO|S_IWUSR, - platform->debugfs, &nvgpu_dbg_mask); + l->debugfs, &nvgpu_dbg_mask); /* New debug logging API. */ debugfs_create_u32("log_mask", S_IRUGO|S_IWUSR, - platform->debugfs, &g->log_mask); + l->debugfs, &g->log_mask); debugfs_create_u32("log_trace", S_IRUGO|S_IWUSR, - platform->debugfs, &g->log_trace); + l->debugfs, &g->log_trace); - g->debugfs_ltc_enabled = + l->debugfs_ltc_enabled = debugfs_create_bool("ltc_enabled", S_IRUGO|S_IWUSR, - platform->debugfs, + l->debugfs, &g->mm.ltc_enabled_target); - g->debugfs_gr_idle_timeout_default = + l->debugfs_gr_idle_timeout_default = debugfs_create_u32("gr_idle_timeout_default_us", - S_IRUGO|S_IWUSR, platform->debugfs, + S_IRUGO|S_IWUSR, l->debugfs, &g->gr_idle_timeout_default); - g->debugfs_timeouts_enabled = + l->debugfs_timeouts_enabled = debugfs_create_bool("timeouts_enabled", S_IRUGO|S_IWUSR, - platform->debugfs, + l->debugfs, &g->timeouts_enabled); - g->debugfs_bypass_smmu = + l->debugfs_bypass_smmu = debugfs_create_bool("bypass_smmu", S_IRUGO|S_IWUSR, - platform->debugfs, + l->debugfs, &g->mm.bypass_smmu); - g->debugfs_disable_bigpage = + l->debugfs_disable_bigpage = debugfs_create_bool("disable_bigpage", S_IRUGO|S_IWUSR, - platform->debugfs, + l->debugfs, &g->mm.disable_bigpage); - g->debugfs_timeslice_low_priority_us = + l->debugfs_timeslice_low_priority_us = debugfs_create_u32("timeslice_low_priority_us", S_IRUGO|S_IWUSR, - platform->debugfs, + l->debugfs, &g->timeslice_low_priority_us); - g->debugfs_timeslice_medium_priority_us = + l->debugfs_timeslice_medium_priority_us = debugfs_create_u32("timeslice_medium_priority_us", S_IRUGO|S_IWUSR, - platform->debugfs, + l->debugfs, &g->timeslice_medium_priority_us); - g->debugfs_timeslice_high_priority_us = + l->debugfs_timeslice_high_priority_us = debugfs_create_u32("timeslice_high_priority_us", S_IRUGO|S_IWUSR, - platform->debugfs, + l->debugfs, &g->timeslice_high_priority_us); - g->debugfs_runlist_interleave = + l->debugfs_runlist_interleave = debugfs_create_bool("runlist_interleave", S_IRUGO|S_IWUSR, - platform->debugfs, + l->debugfs, &g->runlist_interleave); #ifdef CONFIG_ARCH_TEGRA_18x_SOC - g->gr.t18x.ctx_vars.debugfs_force_preemption_gfxp = + l->debugfs_force_preemption_gfxp = debugfs_create_bool("force_preemption_gfxp", S_IRUGO|S_IWUSR, - platform->debugfs, + l->debugfs, &g->gr.t18x.ctx_vars.force_preemption_gfxp); - g->gr.t18x.ctx_vars.debugfs_force_preemption_cilp = + l->debugfs_force_preemption_cilp = debugfs_create_bool("force_preemption_cilp", S_IRUGO|S_IWUSR, - platform->debugfs, + l->debugfs, &g->gr.t18x.ctx_vars.force_preemption_cilp); - g->gr.t18x.ctx_vars.debugfs_dump_ctxsw_stats = + l->debugfs_dump_ctxsw_stats = debugfs_create_bool("dump_ctxsw_stats_on_channel_close", - S_IRUGO|S_IWUSR, platform->debugfs, + S_IRUGO|S_IWUSR, l->debugfs, &g->gr.t18x. ctx_vars.dump_ctxsw_stats_on_channel_close); #endif @@ -355,13 +355,13 @@ void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink) void gk20a_debug_deinit(struct gk20a *g) { - struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); - if (!platform->debugfs) + if (!l->debugfs) return; gk20a_fifo_debugfs_deinit(g); - debugfs_remove_recursive(platform->debugfs); - debugfs_remove_recursive(platform->debugfs_alias); + debugfs_remove_recursive(l->debugfs); + debugfs_remove_recursive(l->debugfs_alias); } 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 @@ */ #include "debug_allocator.h" -#include "gk20a/platform_gk20a.h" #include "os_linux.h" #include @@ -52,11 +51,13 @@ static const struct file_operations __alloc_fops = { void nvgpu_init_alloc_debug(struct gk20a *g, struct nvgpu_allocator *a) { - if (!g->debugfs_allocators) + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); + + if (!l->debugfs_allocators) return; a->debugfs_entry = debugfs_create_file(a->name, S_IRUGO, - g->debugfs_allocators, + l->debugfs_allocators, a, &__alloc_fops); } @@ -68,14 +69,14 @@ void nvgpu_fini_alloc_debug(struct nvgpu_allocator *a) void nvgpu_alloc_debugfs_init(struct gk20a *g) { - struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); - g->debugfs_allocators = debugfs_create_dir("allocators", platform->debugfs); - if (IS_ERR_OR_NULL(g->debugfs_allocators)) { - g->debugfs_allocators = NULL; + l->debugfs_allocators = debugfs_create_dir("allocators", l->debugfs); + if (IS_ERR_OR_NULL(l->debugfs_allocators)) { + l->debugfs_allocators = NULL; return; } - debugfs_create_u32("tracing", 0664, g->debugfs_allocators, + debugfs_create_u32("tracing", 0664, l->debugfs_allocators, &nvgpu_alloc_tracing_on); } 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 = { void gk20a_cde_debugfs_init(struct gk20a *g) { + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); if (!platform->has_cde) return; debugfs_create_u32("cde_parameter", S_IWUSR | S_IRUGO, - platform->debugfs, &g->cde_app.shader_parameter); + l->debugfs, &g->cde_app.shader_parameter); debugfs_create_u32("cde_ctx_count", S_IWUSR | S_IRUGO, - platform->debugfs, &g->cde_app.ctx_count); + l->debugfs, &g->cde_app.ctx_count); debugfs_create_u32("cde_ctx_usecount", S_IWUSR | S_IRUGO, - platform->debugfs, &g->cde_app.ctx_usecount); + l->debugfs, &g->cde_app.ctx_usecount); debugfs_create_u32("cde_ctx_count_top", S_IWUSR | S_IRUGO, - platform->debugfs, &g->cde_app.ctx_count_top); - debugfs_create_file("reload_cde_firmware", S_IWUSR, platform->debugfs, + l->debugfs, &g->cde_app.ctx_count_top); + debugfs_create_file("reload_cde_firmware", S_IWUSR, l->debugfs, g, &gk20a_cde_reload_fops); } 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 @@ */ #include "debug_ce.h" -#include "gk20a/platform_gk20a.h" #include "os_linux.h" #include void gk20a_ce_debugfs_init(struct gk20a *g) { - struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); debugfs_create_u32("ce_app_ctx_count", S_IWUSR | S_IRUGO, - platform->debugfs, &g->ce_app.ctx_count); + l->debugfs, &g->ce_app.ctx_count); debugfs_create_u32("ce_app_state", S_IWUSR | S_IRUGO, - platform->debugfs, &g->ce_app.app_state); + l->debugfs, &g->ce_app.app_state); debugfs_create_u32("ce_app_next_ctx_id", S_IWUSR | S_IRUGO, - platform->debugfs, &g->ce_app.next_ctx_id); + l->debugfs, &g->ce_app.next_ctx_id); } 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 = { int gm20b_clk_init_debugfs(struct gk20a *g) { + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); struct dentry *d; - struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); - if (!platform->debugfs) + if (!l->debugfs) return -EINVAL; d = debugfs_create_file( - "rate", S_IRUGO|S_IWUSR, platform->debugfs, g, &rate_fops); + "rate", S_IRUGO|S_IWUSR, l->debugfs, g, &rate_fops); if (!d) goto err_out; d = debugfs_create_file( - "pll_reg", S_IRUGO, platform->debugfs, g, &pll_reg_fops); + "pll_reg", S_IRUGO, l->debugfs, g, &pll_reg_fops); if (!d) goto err_out; d = debugfs_create_file("pll_reg_raw", - S_IRUGO, platform->debugfs, g, &pll_reg_raw_fops); + S_IRUGO, l->debugfs, g, &pll_reg_raw_fops); if (!d) goto err_out; d = debugfs_create_file( - "monitor", S_IRUGO, platform->debugfs, g, &monitor_fops); + "monitor", S_IRUGO, l->debugfs, g, &monitor_fops); if (!d) goto err_out; d = debugfs_create_file( - "voltage", S_IRUGO, platform->debugfs, g, &voltage_fops); + "voltage", S_IRUGO, l->debugfs, g, &voltage_fops); if (!d) goto err_out; d = debugfs_create_file( - "pll_param", S_IRUGO, platform->debugfs, g, &pll_param_fops); + "pll_param", S_IRUGO, l->debugfs, g, &pll_param_fops); if (!d) goto err_out; - d = debugfs_create_u32("pll_na_mode", S_IRUGO, platform->debugfs, + d = debugfs_create_u32("pll_na_mode", S_IRUGO, l->debugfs, (u32 *)&g->clk.gpc_pll.mode); if (!d) goto err_out; d = debugfs_create_u32("fmax2x_at_vmin_safe_t", S_IRUGO, - platform->debugfs, (u32 *)&g->clk.dvfs_safe_max_freq); + l->debugfs, (u32 *)&g->clk.dvfs_safe_max_freq); if (!d) goto err_out; @@ -267,6 +267,6 @@ int gm20b_clk_init_debugfs(struct gk20a *g) err_out: pr_err("%s: Failed to make debugfs node\n", __func__); - debugfs_remove_recursive(platform->debugfs); + debugfs_remove_recursive(l->debugfs); return -ENOMEM; } 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 @@ */ #include "debug_fifo.h" -#include "gk20a/platform_gk20a.h" #include "os_linux.h" #include @@ -292,9 +291,8 @@ static const struct file_operations gk20a_fifo_profile_stats_debugfs_fops = { void gk20a_fifo_debugfs_init(struct gk20a *g) { - struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); - - struct dentry *gpu_root = platform->debugfs; + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); + struct dentry *gpu_root = l->debugfs; struct dentry *fifo_root; struct dentry *profile_root; 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 @@ */ #include "debug_gr.h" -#include "gk20a/platform_gk20a.h" #include "os_linux.h" #include int gr_gk20a_debugfs_init(struct gk20a *g) { - struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); - g->debugfs_gr_default_attrib_cb_size = + l->debugfs_gr_default_attrib_cb_size = debugfs_create_u32("gr_default_attrib_cb_size", - S_IRUGO|S_IWUSR, platform->debugfs, + S_IRUGO|S_IWUSR, l->debugfs, &g->gr.attrib_cb_default_size); 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 @@ */ #include "debug_mm.h" -#include "gk20a/platform_gk20a.h" #include "os_linux.h" #include void gk20a_mm_debugfs_init(struct gk20a *g) { - struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); - debugfs_create_bool("force_pramin", 0664, platform->debugfs, + debugfs_create_bool("force_pramin", 0664, l->debugfs, &g->mm.force_pramin); } 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 @@ #include #include "debug_pmu.h" -#include "gk20a/platform_gk20a.h" #include "os_linux.h" #include @@ -420,64 +419,64 @@ static const struct file_operations security_fops = { int gk20a_pmu_debugfs_init(struct gk20a *g) { struct dentry *d; - struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); d = debugfs_create_file( - "lpwr_debug", S_IRUGO|S_IWUSR, platform->debugfs, g, + "lpwr_debug", S_IRUGO|S_IWUSR, l->debugfs, g, &lpwr_debug_fops); if (!d) goto err_out; d = debugfs_create_file( - "mscg_residency", S_IRUGO|S_IWUSR, platform->debugfs, g, + "mscg_residency", S_IRUGO|S_IWUSR, l->debugfs, g, &mscg_stat_fops); if (!d) goto err_out; d = debugfs_create_file( - "mscg_transitions", S_IRUGO, platform->debugfs, g, + "mscg_transitions", S_IRUGO, l->debugfs, g, &mscg_transitions_fops); if (!d) goto err_out; d = debugfs_create_file( - "elpg_residency", S_IRUGO|S_IWUSR, platform->debugfs, g, + "elpg_residency", S_IRUGO|S_IWUSR, l->debugfs, g, &elpg_stat_fops); if (!d) goto err_out; d = debugfs_create_file( - "elpg_transitions", S_IRUGO, platform->debugfs, g, + "elpg_transitions", S_IRUGO, l->debugfs, g, &elpg_transitions_fops); if (!d) goto err_out; d = debugfs_create_file( - "falc_trace", S_IRUGO, platform->debugfs, g, + "falc_trace", S_IRUGO, l->debugfs, g, &falc_trace_fops); if (!d) goto err_out; d = debugfs_create_file( - "perfmon_events_enable", S_IRUGO, platform->debugfs, g, + "perfmon_events_enable", S_IRUGO, l->debugfs, g, &perfmon_events_enable_fops); if (!d) goto err_out; d = debugfs_create_file( - "perfmon_events_count", S_IRUGO, platform->debugfs, g, + "perfmon_events_count", S_IRUGO, l->debugfs, g, &perfmon_events_count_fops); if (!d) goto err_out; d = debugfs_create_file( - "pmu_security", S_IRUGO, platform->debugfs, g, + "pmu_security", S_IRUGO, l->debugfs, g, &security_fops); if (!d) goto err_out; return 0; err_out: pr_err("%s: Failed to make debugfs node\n", __func__); - debugfs_remove_recursive(platform->debugfs); + debugfs_remove_recursive(l->debugfs); return -ENOMEM; } 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 @@ */ #include "debug_sched.h" -#include "gk20a/platform_gk20a.h" #include "os_linux.h" #include @@ -73,8 +72,8 @@ static const struct file_operations gk20a_sched_debugfs_fops = { void gk20a_sched_debugfs_init(struct gk20a *g) { - struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); - debugfs_create_file("sched_ctrl", S_IRUGO, platform->debugfs, + debugfs_create_file("sched_ctrl", S_IRUGO, l->debugfs, g, &gk20a_sched_debugfs_fops); } 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 { struct work_struct nonstall_fn_work; struct workqueue_struct *nonstall_work_queue; + +#ifdef CONFIG_DEBUG_FS + struct dentry *debugfs; + struct dentry *debugfs_alias; + + struct dentry *debugfs_ltc_enabled; + struct dentry *debugfs_timeouts_enabled; + struct dentry *debugfs_gr_idle_timeout_default; + struct dentry *debugfs_bypass_smmu; + struct dentry *debugfs_disable_bigpage; + struct dentry *debugfs_gr_default_attrib_cb_size; + + struct dentry *debugfs_timeslice_low_priority_us; + struct dentry *debugfs_timeslice_medium_priority_us; + struct dentry *debugfs_timeslice_high_priority_us; + struct dentry *debugfs_runlist_interleave; + struct dentry *debugfs_allocators; + struct dentry *debugfs_xve; + struct dentry *debugfs_kmem; + + struct dentry *debugfs_force_preemption_cilp; + struct dentry *debugfs_force_preemption_gfxp; + struct dentry *debugfs_dump_ctxsw_stats; +#endif }; static 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) { struct gk20a_platform *platform = gk20a_get_platform(&pdev->dev); struct gk20a *g = get_gk20a(&pdev->dev); + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); gk20a_dbg(gpu_dbg_shutdown, "Removing nvgpu driver!\n"); @@ -474,8 +475,8 @@ static void nvgpu_pci_remove(struct pci_dev *pdev) gk20a_dbg(gpu_dbg_shutdown, "User de-init done.\b"); #ifdef CONFIG_DEBUG_FS - debugfs_remove_recursive(platform->debugfs); - debugfs_remove_recursive(platform->debugfs_alias); + debugfs_remove_recursive(l->debugfs); + debugfs_remove_recursive(l->debugfs_alias); #endif 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 @@ #include "fecs_trace_gk20a.h" #include "gk20a.h" #include "gr_gk20a.h" -#include "platform_gk20a.h" #include "common/linux/os_linux.h" #include @@ -537,21 +536,21 @@ DEFINE_SIMPLE_ATTRIBUTE(gk20a_fecs_trace_debugfs_write_fops, static void gk20a_fecs_trace_debugfs_init(struct gk20a *g) { - struct gk20a_platform *plat = dev_get_drvdata(dev_from_gk20a(g)); + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); - debugfs_create_file("ctxsw_trace_read", 0600, plat->debugfs, g, + debugfs_create_file("ctxsw_trace_read", 0600, l->debugfs, g, &gk20a_fecs_trace_debugfs_read_fops); - debugfs_create_file("ctxsw_trace_write", 0600, plat->debugfs, g, + debugfs_create_file("ctxsw_trace_write", 0600, l->debugfs, g, &gk20a_fecs_trace_debugfs_write_fops); - debugfs_create_file("ctxsw_trace_ring", 0600, plat->debugfs, g, + debugfs_create_file("ctxsw_trace_ring", 0600, l->debugfs, g, &gk20a_fecs_trace_debugfs_ring_fops); } static void gk20a_fecs_trace_debugfs_cleanup(struct gk20a *g) { - struct gk20a_platform *plat = dev_get_drvdata(dev_from_gk20a(g)); + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); - debugfs_remove_recursive(plat->debugfs); + debugfs_remove_recursive(l->debugfs); } #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 { struct nvgpu_spinlock ltc_enabled_lock; -#ifdef CONFIG_DEBUG_FS - struct dentry *debugfs_ltc_enabled; - struct dentry *debugfs_timeouts_enabled; - struct dentry *debugfs_gr_idle_timeout_default; - struct dentry *debugfs_bypass_smmu; - struct dentry *debugfs_disable_bigpage; - struct dentry *debugfs_gr_default_attrib_cb_size; - - struct dentry *debugfs_timeslice_low_priority_us; - struct dentry *debugfs_timeslice_medium_priority_us; - struct dentry *debugfs_timeslice_high_priority_us; - struct dentry *debugfs_runlist_interleave; - struct dentry *debugfs_allocators; - struct dentry *debugfs_xve; - struct dentry *debugfs_kmem; -#endif struct gk20a_ctxsw_ucode_info ctxsw_ucode_info; /* 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 { /* Set if the platform can unify the small/large address spaces. */ bool unify_address_spaces; - /* Should be populated by probe. */ - struct dentry *debugfs; - struct dentry *debugfs_alias; - /* Clock configuration is stored here. Platform probe is responsible * for filling this data. */ 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) unsigned int i; struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); #ifdef CONFIG_DEBUG_FS + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); struct dentry *d; #endif struct nvgpu_firmware *bios_fw; @@ -239,7 +240,7 @@ int gm206_bios_init(struct gk20a *g) g->bios_blob.data = g->bios.data; g->bios_blob.size = g->bios.size; - d = debugfs_create_blob("bios", S_IRUGO, platform->debugfs, + d = debugfs_create_blob("bios", S_IRUGO, l->debugfs, &g->bios_blob); if (!d) 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 @@ #include #include "gk20a/gk20a.h" -#ifdef CONFIG_DEBUG_FS -#include "gk20a/platform_gk20a.h" -#endif #include "common/linux/os_linux.h" #include "clk_gp106.h" @@ -240,10 +237,10 @@ static int gp106_get_rate_show(void *data , u64 *val) { DEFINE_SIMPLE_ATTRIBUTE(get_rate_fops, gp106_get_rate_show, NULL, "%llu\n"); -static int clk_gp106_debugfs_init(struct gk20a *g) { - struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); - - struct dentry *gpu_root = platform->debugfs; +static int clk_gp106_debugfs_init(struct gk20a *g) +{ + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); + struct dentry *gpu_root = l->debugfs; struct dentry *clocks_root; struct dentry *d; 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 @@ #include "gk20a/gk20a.h" #ifdef CONFIG_DEBUG_FS -#include "gk20a/platform_gk20a.h" #include "common/linux/os_linux.h" #endif #include "gp106/mclk_gp106.h" @@ -3495,9 +3494,8 @@ static const struct file_operations mclk_switch_stats_fops = { static int mclk_debugfs_init(struct gk20a *g) { - struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); - - struct dentry *gpu_root = platform->debugfs; + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); + struct dentry *gpu_root = l->debugfs; struct dentry *d; 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 @@ #ifdef CONFIG_DEBUG_FS #include -#include "gk20a/platform_gk20a.h" #include "common/linux/os_linux.h" #endif @@ -72,11 +71,11 @@ DEFINE_SIMPLE_ATTRIBUTE(therm_ctrl_fops, therm_get_internal_sensor_curr_temp, NU void gp106_therm_debugfs_init(struct gk20a *g) { - struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); struct dentry *dbgentry; dbgentry = debugfs_create_file( - "temp", S_IRUGO, platform->debugfs, g, &therm_ctrl_fops); + "temp", S_IRUGO, l->debugfs, g, &therm_ctrl_fops); if (!dbgentry) nvgpu_err(g, "debugfs entry create failed for therm_curr_temp"); } 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 @@ #include "gk20a/gk20a.h" #include "gm206/bios_gm206.h" #include "gp106/xve_gp106.h" - #ifdef CONFIG_DEBUG_FS #include "gk20a/platform_gk20a.h" #endif +#include "common/linux/os_linux.h" #include @@ -607,12 +607,12 @@ int xve_sw_init_gp106(struct device *dev) { int err = -ENODEV; #ifdef CONFIG_DEBUG_FS - struct gk20a *g = get_gk20a(dev); - struct gk20a_platform *plat = gk20a_get_platform(dev); - struct dentry *gpu_root = plat->debugfs; + struct gk20a *g = gk20a_from_dev(dev); + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); + struct dentry *gpu_root = l->debugfs; - g->debugfs_xve = debugfs_create_dir("xve", gpu_root); - if (IS_ERR_OR_NULL(g->debugfs_xve)) + l->debugfs_xve = debugfs_create_dir("xve", gpu_root); + if (IS_ERR_OR_NULL(l->debugfs_xve)) goto fail; /* @@ -620,13 +620,13 @@ int xve_sw_init_gp106(struct device *dev) * worrying the higher level SW. */ debugfs_create_file("link_speed", S_IRUGO, - g->debugfs_xve, g, + l->debugfs_xve, g, &xve_link_speed_fops); debugfs_create_file("available_speeds", S_IRUGO, - g->debugfs_xve, g, + l->debugfs_xve, g, &xve_available_speeds_fops); debugfs_create_file("link_control_status", S_IRUGO, - g->debugfs_xve, g, + l->debugfs_xve, g, &xve_link_control_status_fops); 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 { bool force_preemption_cilp; bool dump_ctxsw_stats_on_channel_close; #endif - struct dentry *debugfs_force_preemption_cilp; - struct dentry *debugfs_force_preemption_gfxp; - struct dentry *debugfs_dump_ctxsw_stats; } ctx_vars; 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 @@ #ifdef CONFIG_DEBUG_FS #include -#include "gk20a/platform_gk20a.h" #include "common/linux/os_linux.h" #endif @@ -112,22 +111,23 @@ DEFINE_SIMPLE_ATTRIBUTE( DEFINE_SIMPLE_ATTRIBUTE( pmgr_voltage_ctrl_fops, pmgr_pwr_devices_get_voltage_u64, NULL, "%llu\n"); -static void pmgr_debugfs_init(struct gk20a *g) { - struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); +static void pmgr_debugfs_init(struct gk20a *g) +{ + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); struct dentry *dbgentry; dbgentry = debugfs_create_file( - "power", S_IRUGO, platform->debugfs, g, &pmgr_power_ctrl_fops); + "power", S_IRUGO, l->debugfs, g, &pmgr_power_ctrl_fops); if (!dbgentry) nvgpu_err(g, "debugfs entry create failed for power"); dbgentry = debugfs_create_file( - "current", S_IRUGO, platform->debugfs, g, &pmgr_current_ctrl_fops); + "current", S_IRUGO, l->debugfs, g, &pmgr_current_ctrl_fops); if (!dbgentry) nvgpu_err(g, "debugfs entry create failed for current"); dbgentry = debugfs_create_file( - "voltage", S_IRUGO, platform->debugfs, g, &pmgr_voltage_ctrl_fops); + "voltage", S_IRUGO, l->debugfs, g, &pmgr_voltage_ctrl_fops); if (!dbgentry) nvgpu_err(g, "debugfs entry create failed for voltage"); } -- cgit v1.2.2