summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c
diff options
context:
space:
mode:
authorSunny He <suhe@nvidia.com>2017-06-22 16:48:30 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-06-27 13:44:05 -0400
commit773df3f5e9fdda028ade319990d1b672ce68592f (patch)
treec7730c4b3117786e1572e77228208aa0cc53f943 /drivers/gpu/nvgpu/gp10b/ltc_gp10b.c
parent3a2eb257eefbd6c2c5943f4aaa10f3cee7adfad1 (diff)
gpu: nvgpu: remove ltc_common.c
Remove ltc_common.c and integrate the included functions into device specific ltc_gXXXX.c files. Merge non-device reg definition dependent ltc functions into ltc_gk20a.c/h. Prior to this patch, ltc_common.c was being directly included into the device specific ltc source files as a workaround to allow different devices to share the same code but still include in different hw reg definitions. Given that this approach was not adopted for other systems, this code has been separated out for readability and consistency. Jira NVGPU-74 Change-Id: I4eea301927418532cc150b029535f165928cab89 Signed-off-by: Sunny He <suhe@nvidia.com> Reviewed-on: https://git-master/r/1507502 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b/ltc_gp10b.c')
-rw-r--r--drivers/gpu/nvgpu/gp10b/ltc_gp10b.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c b/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c
index b3026059..d94e56ce 100644
--- a/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * GP10B L2 2 * GP10B L2
3 * 3 *
4 * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -24,7 +24,7 @@
24#include <nvgpu/hw/gp10b/hw_mc_gp10b.h> 24#include <nvgpu/hw/gp10b/hw_mc_gp10b.h>
25#include <nvgpu/hw/gp10b/hw_ltc_gp10b.h> 25#include <nvgpu/hw/gp10b/hw_ltc_gp10b.h>
26 26
27#include "gk20a/ltc_common.c" 27#include "gk20a/ltc_gk20a.h"
28#include "ltc_gp10b.h" 28#include "ltc_gp10b.h"
29 29
30static int gp10b_determine_L2_size_bytes(struct gk20a *g) 30static int gp10b_determine_L2_size_bytes(struct gk20a *g)
@@ -205,12 +205,35 @@ static void gp10b_ltc_init_fs_state(struct gk20a *g)
205 ltc_intr); 205 ltc_intr);
206} 206}
207 207
208#ifdef CONFIG_DEBUG_FS
209static void gp10b_ltc_sync_debugfs(struct gk20a *g)
210{
211 u32 reg_f = ltc_ltcs_ltss_tstg_set_mgmt_2_l2_bypass_mode_enabled_f();
212
213 nvgpu_spinlock_acquire(&g->debugfs_lock);
214 if (g->mm.ltc_enabled != g->mm.ltc_enabled_debug) {
215 u32 reg = gk20a_readl(g, ltc_ltcs_ltss_tstg_set_mgmt_2_r());
216
217 if (g->mm.ltc_enabled_debug)
218 /* bypass disabled (normal caching ops)*/
219 reg &= ~reg_f;
220 else
221 /* bypass enabled (no caching) */
222 reg |= reg_f;
223
224 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}
229#endif
230
208void gp10b_init_ltc(struct gpu_ops *gops) 231void gp10b_init_ltc(struct gpu_ops *gops)
209{ 232{
210 gops->ltc.determine_L2_size_bytes = gp10b_determine_L2_size_bytes; 233 gops->ltc.determine_L2_size_bytes = gp10b_determine_L2_size_bytes;
211 gops->ltc.set_zbc_color_entry = gk20a_ltc_set_zbc_color_entry; 234 gops->ltc.set_zbc_color_entry = gm20b_ltc_set_zbc_color_entry;
212 gops->ltc.set_zbc_depth_entry = gk20a_ltc_set_zbc_depth_entry; 235 gops->ltc.set_zbc_depth_entry = gm20b_ltc_set_zbc_depth_entry;
213 gops->ltc.init_cbc = gk20a_ltc_init_cbc; 236 gops->ltc.init_cbc = gm20b_ltc_init_cbc;
214 237
215 /* GM20b specific ops. */ 238 /* GM20b specific ops. */
216 gops->ltc.init_fs_state = gp10b_ltc_init_fs_state; 239 gops->ltc.init_fs_state = gp10b_ltc_init_fs_state;
@@ -220,6 +243,6 @@ void gp10b_init_ltc(struct gpu_ops *gops)
220 gops->ltc.cbc_fix_config = gm20b_ltc_cbc_fix_config; 243 gops->ltc.cbc_fix_config = gm20b_ltc_cbc_fix_config;
221 gops->ltc.flush = gm20b_flush_ltc; 244 gops->ltc.flush = gm20b_flush_ltc;
222#ifdef CONFIG_DEBUG_FS 245#ifdef CONFIG_DEBUG_FS
223 gops->ltc.sync_debugfs = gk20a_ltc_sync_debugfs; 246 gops->ltc.sync_debugfs = gp10b_ltc_sync_debugfs;
224#endif 247#endif
225} 248}