diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2017-07-27 15:58:03 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-08-04 12:23:56 -0400 |
commit | b8efd9d04537d6129e2ce8b067417e46b0e7436f (patch) | |
tree | 1a40179a893e10c0fdcdd56797599bcdf6b55206 /drivers/gpu/nvgpu/gp10b | |
parent | c16797e35c2926bf34a61d5d8f37d5675ec23b1b (diff) |
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 <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1528262
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b')
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/hal_gp10b.c | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/ltc_gp10b.c | 26 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/ltc_gp10b.h | 4 |
3 files changed, 11 insertions, 23 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c index e2479530..197c4fad 100644 --- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c | |||
@@ -164,9 +164,7 @@ static const struct gpu_ops gp10b_ops = { | |||
164 | .isr = gp10b_ltc_isr, | 164 | .isr = gp10b_ltc_isr, |
165 | .cbc_fix_config = gm20b_ltc_cbc_fix_config, | 165 | .cbc_fix_config = gm20b_ltc_cbc_fix_config, |
166 | .flush = gm20b_flush_ltc, | 166 | .flush = gm20b_flush_ltc, |
167 | #ifdef CONFIG_DEBUG_FS | 167 | .set_enabled = gp10b_ltc_set_enabled, |
168 | .sync_debugfs = gp10b_ltc_sync_debugfs, | ||
169 | #endif | ||
170 | }, | 168 | }, |
171 | .ce2 = { | 169 | .ce2 = { |
172 | .isr_stall = gp10b_ce_isr, | 170 | .isr_stall = gp10b_ce_isr, |
diff --git a/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c b/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c index baa275c7..43619f80 100644 --- a/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c | |||
@@ -205,25 +205,17 @@ void gp10b_ltc_init_fs_state(struct gk20a *g) | |||
205 | ltc_intr); | 205 | ltc_intr); |
206 | } | 206 | } |
207 | 207 | ||
208 | #ifdef CONFIG_DEBUG_FS | 208 | void gp10b_ltc_set_enabled(struct gk20a *g, bool enabled) |
209 | void gp10b_ltc_sync_debugfs(struct gk20a *g) | ||
210 | { | 209 | { |
211 | u32 reg_f = ltc_ltcs_ltss_tstg_set_mgmt_2_l2_bypass_mode_enabled_f(); | 210 | u32 reg_f = ltc_ltcs_ltss_tstg_set_mgmt_2_l2_bypass_mode_enabled_f(); |
211 | u32 reg = gk20a_readl(g, ltc_ltcs_ltss_tstg_set_mgmt_2_r()); | ||
212 | 212 | ||
213 | nvgpu_spinlock_acquire(&g->debugfs_lock); | 213 | if (enabled) |
214 | if (g->mm.ltc_enabled != g->mm.ltc_enabled_debug) { | 214 | /* bypass disabled (normal caching ops)*/ |
215 | u32 reg = gk20a_readl(g, ltc_ltcs_ltss_tstg_set_mgmt_2_r()); | 215 | reg &= ~reg_f; |
216 | 216 | else | |
217 | if (g->mm.ltc_enabled_debug) | 217 | /* bypass enabled (no caching) */ |
218 | /* bypass disabled (normal caching ops)*/ | 218 | reg |= reg_f; |
219 | reg &= ~reg_f; | ||
220 | else | ||
221 | /* bypass enabled (no caching) */ | ||
222 | reg |= reg_f; | ||
223 | 219 | ||
224 | gk20a_writel(g, ltc_ltcs_ltss_tstg_set_mgmt_2_r(), reg); | 220 | gk20a_writel(g, ltc_ltcs_ltss_tstg_set_mgmt_2_r(), reg); |
225 | g->mm.ltc_enabled = g->mm.ltc_enabled_debug; | ||
226 | } | ||
227 | nvgpu_spinlock_release(&g->debugfs_lock); | ||
228 | } | 221 | } |
229 | #endif | ||
diff --git a/drivers/gpu/nvgpu/gp10b/ltc_gp10b.h b/drivers/gpu/nvgpu/gp10b/ltc_gp10b.h index b5f2cda6..385754ba 100644 --- a/drivers/gpu/nvgpu/gp10b/ltc_gp10b.h +++ b/drivers/gpu/nvgpu/gp10b/ltc_gp10b.h | |||
@@ -20,7 +20,5 @@ void gp10b_ltc_isr(struct gk20a *g); | |||
20 | int gp10b_determine_L2_size_bytes(struct gk20a *g); | 20 | int gp10b_determine_L2_size_bytes(struct gk20a *g); |
21 | int gp10b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr); | 21 | int gp10b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr); |
22 | void gp10b_ltc_init_fs_state(struct gk20a *g); | 22 | void gp10b_ltc_init_fs_state(struct gk20a *g); |
23 | #ifdef CONFIG_DEBUG_FS | 23 | void gp10b_ltc_set_enabled(struct gk20a *g, bool enabled); |
24 | void gp10b_ltc_sync_debugfs(struct gk20a *g); | ||
25 | #endif | ||
26 | #endif | 24 | #endif |