From b8efd9d04537d6129e2ce8b067417e46b0e7436f Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Thu, 27 Jul 2017 12:58:03 -0700 Subject: gpu: nvgpu: Make LTC disabling common code Refactor the sync_debugfs LTC HAL op so that the logic to enable or disable LTC goes to common code nvgpu_ltc_sync_enabled() and the LTC HAL set_enabled only performs the hardware register access. Create a new common function nvgpu_init_ltc_support() to initialize the LTC software variable, and move hardware initialization of LTC to be called from it. JIRA NVGPU-62 Change-Id: Ib1cf4f5b83ca3dac08407464ed56a732e0a33923 Signed-off-by: Terje Bergstrom Reviewed-on: https://git-master.nvidia.com/r/1528262 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 6 ++---- drivers/gpu/nvgpu/gk20a/gk20a.c | 8 ++++++-- drivers/gpu/nvgpu/gk20a/gk20a.h | 7 +++---- drivers/gpu/nvgpu/gk20a/ltc_gk20a.c | 2 -- drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 10 ++-------- 5 files changed, 13 insertions(+), 20 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 87923537..62b312b2 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -34,6 +34,7 @@ #include #include #include +#include #include "gk20a.h" #include "ctxsw_trace_gk20a.h" @@ -2490,11 +2491,8 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, if (profile) profile->timestamp[PROFILE_ENTRY] = sched_clock(); -#ifdef CONFIG_DEBUG_FS /* update debug settings */ - if (g->ops.ltc.sync_debugfs) - g->ops.ltc.sync_debugfs(g); -#endif + nvgpu_ltc_sync_enabled(g); gk20a_dbg_info("channel %d", c->chid); diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 6350bcf5..7d577cda 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -216,8 +217,11 @@ int gk20a_finalize_poweron(struct gk20a *g) goto done; } - if (g->ops.ltc.init_fs_state) - g->ops.ltc.init_fs_state(g); + err = nvgpu_init_ltc_support(g); + if (err) { + nvgpu_err(g, "failed to init ltc"); + goto done; + } err = gk20a_init_mm_support(g); if (err) { diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 8d9318b2..f7b714f2 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -144,9 +144,7 @@ struct gpu_ops { struct zbc_entry *s_val, u32 index); void (*init_cbc)(struct gk20a *g, struct gr_gk20a *gr); -#ifdef CONFIG_DEBUG_FS - void (*sync_debugfs)(struct gk20a *g); -#endif + void (*set_enabled)(struct gk20a *g, bool enabled); void (*init_fs_state)(struct gk20a *g); void (*isr)(struct gk20a *g); u32 (*cbc_fix_config)(struct gk20a *g, int base); @@ -1147,8 +1145,9 @@ struct gk20a { u32 emc3d_ratio; + struct nvgpu_spinlock ltc_enabled_lock; + #ifdef CONFIG_DEBUG_FS - struct nvgpu_spinlock debugfs_lock; struct dentry *debugfs_ltc_enabled; struct dentry *debugfs_timeouts_enabled; struct dentry *debugfs_gr_idle_timeout_default; diff --git a/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c b/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c index a543a0d3..1b834a47 100644 --- a/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c @@ -21,8 +21,6 @@ #include "gk20a.h" #include "gr_gk20a.h" -/* Non HW reg dependent stuff: */ - int gk20a_ltc_alloc_phys_cbc(struct gk20a *g, size_t compbit_backing_size) { struct gr_gk20a *gr = &g->gr; diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index 2f35df71..c56b28bb 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h @@ -245,14 +245,8 @@ struct mm_gk20a { bool sw_ready; int physical_bits; bool use_full_comp_tag_line; -#ifdef CONFIG_DEBUG_FS - u32 ltc_enabled; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) - u32 ltc_enabled_debug; -#else - bool ltc_enabled_debug; -#endif -#endif + bool ltc_enabled_current; + bool ltc_enabled_target; #if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) u32 bypass_smmu; u32 disable_bigpage; -- cgit v1.2.2