summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorSunny He <suhe@nvidia.com>2017-06-29 14:16:36 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-07-13 03:09:09 -0400
commit542ad000f2fb0301fbfb7e6defc6a01eb488906d (patch)
tree13ee76cd70b5ed771b04e699b3842bb5451bca1a /drivers/gpu
parent47cb48f1e2d9c34f22f9fcf443ef67a32cd54a73 (diff)
gpu: nvgpu: Reorg debug HAL initialization
Reorganize HAL initialization to remove inheritance and construct the gpu_ops struct at compile time. This patch covers the debug and dbg_session_ops sub-modules of the gpu_ops struct. Perform HAL function assignments in hal_gxxxx.c through the population of a chip-specific copy of gpu_ops. Jira NVGPU-74 Change-Id: Id51feeccbea91f884a6057efc680566a7d5d0b6d Signed-off-by: Sunny He <suhe@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1514822 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug.c5
-rw-r--r--drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c26
-rw-r--r--drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h13
-rw-r--r--drivers/gpu/nvgpu/gm20b/hal_gm20b.c20
-rw-r--r--drivers/gpu/nvgpu/gp106/hal_gp106.c20
-rw-r--r--drivers/gpu/nvgpu/gp10b/hal_gp10b.c20
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/debug.h2
7 files changed, 72 insertions, 34 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/debug.c b/drivers/gpu/nvgpu/common/linux/debug.c
index f24c6ae7..e085aed4 100644
--- a/drivers/gpu/nvgpu/common/linux/debug.c
+++ b/drivers/gpu/nvgpu/common/linux/debug.c
@@ -173,11 +173,6 @@ void gk20a_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o)
173 gk20a_debug_dump_all_channel_status_ramfc(g, o); 173 gk20a_debug_dump_all_channel_status_ramfc(g, o);
174} 174}
175 175
176void gk20a_init_debug_ops(struct gpu_ops *gops)
177{
178 gops->debug.show_dump = gk20a_debug_show_dump;
179}
180
181static int railgate_residency_show(struct seq_file *s, void *data) 176static int railgate_residency_show(struct seq_file *s, void *data)
182{ 177{
183 struct gk20a *g = s->private; 178 struct gk20a *g = s->private;
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
index 54986e6c..1572ff48 100644
--- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
@@ -1277,7 +1277,7 @@ static int nvgpu_ioctl_channel_reg_ops(struct dbg_session_gk20a *dbg_s,
1277 return err; 1277 return err;
1278} 1278}
1279 1279
1280static int dbg_set_powergate(struct dbg_session_gk20a *dbg_s, u32 powermode) 1280int dbg_set_powergate(struct dbg_session_gk20a *dbg_s, u32 powermode)
1281{ 1281{
1282 int err = 0; 1282 int err = 0;
1283 struct gk20a *g = dbg_s->g; 1283 struct gk20a *g = dbg_s->g;
@@ -1646,7 +1646,7 @@ static struct dbg_profiler_object_data *find_matching_prof_obj(
1646 return NULL; 1646 return NULL;
1647} 1647}
1648 1648
1649static bool nvgpu_check_and_set_global_reservation( 1649bool nvgpu_check_and_set_global_reservation(
1650 struct dbg_session_gk20a *dbg_s, 1650 struct dbg_session_gk20a *dbg_s,
1651 struct dbg_profiler_object_data *prof_obj) 1651 struct dbg_profiler_object_data *prof_obj)
1652{ 1652{
@@ -1662,7 +1662,7 @@ static bool nvgpu_check_and_set_global_reservation(
1662 return false; 1662 return false;
1663} 1663}
1664 1664
1665static bool nvgpu_check_and_set_context_reservation( 1665bool nvgpu_check_and_set_context_reservation(
1666 struct dbg_session_gk20a *dbg_s, 1666 struct dbg_session_gk20a *dbg_s,
1667 struct dbg_profiler_object_data *prof_obj) 1667 struct dbg_profiler_object_data *prof_obj)
1668{ 1668{
@@ -1677,7 +1677,7 @@ static bool nvgpu_check_and_set_context_reservation(
1677 return true; 1677 return true;
1678} 1678}
1679 1679
1680static void nvgpu_release_profiler_reservation(struct dbg_session_gk20a *dbg_s, 1680void nvgpu_release_profiler_reservation(struct dbg_session_gk20a *dbg_s,
1681 struct dbg_profiler_object_data *prof_obj) 1681 struct dbg_profiler_object_data *prof_obj)
1682{ 1682{
1683 struct gk20a *g = dbg_s->g; 1683 struct gk20a *g = dbg_s->g;
@@ -1834,7 +1834,7 @@ static int nvgpu_ioctl_profiler_reserve(struct dbg_session_gk20a *dbg_s,
1834 return nvgpu_profiler_reserve_release(dbg_s, args->profiler_handle); 1834 return nvgpu_profiler_reserve_release(dbg_s, args->profiler_handle);
1835} 1835}
1836 1836
1837static int gk20a_perfbuf_enable_locked(struct gk20a *g, u64 offset, u32 size) 1837int gk20a_perfbuf_enable_locked(struct gk20a *g, u64 offset, u32 size)
1838{ 1838{
1839 struct mm_gk20a *mm = &g->mm; 1839 struct mm_gk20a *mm = &g->mm;
1840 u32 virt_addr_lo; 1840 u32 virt_addr_lo;
@@ -1943,7 +1943,7 @@ err_remove_vm:
1943} 1943}
1944 1944
1945/* must be called with dbg_sessions_lock held */ 1945/* must be called with dbg_sessions_lock held */
1946static int gk20a_perfbuf_disable_locked(struct gk20a *g) 1946int gk20a_perfbuf_disable_locked(struct gk20a *g)
1947{ 1947{
1948 int err = gk20a_busy(g); 1948 int err = gk20a_busy(g);
1949 if (err) { 1949 if (err) {
@@ -2002,17 +2002,3 @@ static int gk20a_perfbuf_unmap(struct dbg_session_gk20a *dbg_s,
2002 2002
2003 return err; 2003 return err;
2004} 2004}
2005
2006void gk20a_init_dbg_session_ops(struct gpu_ops *gops)
2007{
2008 gops->dbg_session_ops.exec_reg_ops = exec_regops_gk20a;
2009 gops->dbg_session_ops.dbg_set_powergate = dbg_set_powergate;
2010 gops->dbg_session_ops.check_and_set_global_reservation =
2011 nvgpu_check_and_set_global_reservation;
2012 gops->dbg_session_ops.check_and_set_context_reservation =
2013 nvgpu_check_and_set_context_reservation;
2014 gops->dbg_session_ops.release_profiler_reservation =
2015 nvgpu_release_profiler_reservation;
2016 gops->dbg_session_ops.perfbuffer_enable = gk20a_perfbuf_enable_locked;
2017 gops->dbg_session_ops.perfbuffer_disable = gk20a_perfbuf_disable_locked;
2018};
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h
index e48d8050..827fb42f 100644
--- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h
@@ -127,6 +127,17 @@ int dbg_unbind_single_channel_gk20a(struct dbg_session_gk20a *dbg_s,
127 127
128bool gk20a_dbg_gpu_broadcast_stop_trigger(struct channel_gk20a *ch); 128bool gk20a_dbg_gpu_broadcast_stop_trigger(struct channel_gk20a *ch);
129int gk20a_dbg_gpu_clear_broadcast_stop_trigger(struct channel_gk20a *ch); 129int gk20a_dbg_gpu_clear_broadcast_stop_trigger(struct channel_gk20a *ch);
130void gk20a_init_dbg_session_ops(struct gpu_ops *gops); 130
131int dbg_set_powergate(struct dbg_session_gk20a *dbg_s, u32 powermode);
132bool nvgpu_check_and_set_global_reservation(
133 struct dbg_session_gk20a *dbg_s,
134 struct dbg_profiler_object_data *prof_obj);
135bool nvgpu_check_and_set_context_reservation(
136 struct dbg_session_gk20a *dbg_s,
137 struct dbg_profiler_object_data *prof_obj);
138void nvgpu_release_profiler_reservation(struct dbg_session_gk20a *dbg_s,
139 struct dbg_profiler_object_data *prof_obj);
140int gk20a_perfbuf_enable_locked(struct gk20a *g, u64 offset, u32 size);
141int gk20a_perfbuf_disable_locked(struct gk20a *g);
131 142
132#endif /* DBG_GPU_GK20A_H */ 143#endif /* DBG_GPU_GK20A_H */
diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
index 4baed828..e2f80307 100644
--- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
@@ -20,6 +20,7 @@
20#include "gk20a/bus_gk20a.h" 20#include "gk20a/bus_gk20a.h"
21#include "gk20a/flcn_gk20a.h" 21#include "gk20a/flcn_gk20a.h"
22#include "gk20a/priv_ring_gk20a.h" 22#include "gk20a/priv_ring_gk20a.h"
23#include "gk20a/regops_gk20a.h"
23 24
24#include "ltc_gm20b.h" 25#include "ltc_gm20b.h"
25#include "ce2_gm20b.h" 26#include "ce2_gm20b.h"
@@ -215,6 +216,21 @@ static const struct gpu_ops gm20b_ops = {
215 .boot_0 = gk20a_mc_boot_0, 216 .boot_0 = gk20a_mc_boot_0,
216 .is_intr1_pending = mc_gk20a_is_intr1_pending, 217 .is_intr1_pending = mc_gk20a_is_intr1_pending,
217 }, 218 },
219 .debug = {
220 .show_dump = gk20a_debug_show_dump,
221 },
222 .dbg_session_ops = {
223 .exec_reg_ops = exec_regops_gk20a,
224 .dbg_set_powergate = dbg_set_powergate,
225 .check_and_set_global_reservation =
226 nvgpu_check_and_set_global_reservation,
227 .check_and_set_context_reservation =
228 nvgpu_check_and_set_context_reservation,
229 .release_profiler_reservation =
230 nvgpu_release_profiler_reservation,
231 .perfbuffer_enable = gk20a_perfbuf_enable_locked,
232 .perfbuffer_disable = gk20a_perfbuf_disable_locked,
233 },
218 .cde = { 234 .cde = {
219 .get_program_numbers = gm20b_cde_get_program_numbers, 235 .get_program_numbers = gm20b_cde_get_program_numbers,
220 }, 236 },
@@ -234,6 +250,8 @@ int gm20b_init_hal(struct gk20a *g)
234 gops->ltc = gm20b_ops.ltc; 250 gops->ltc = gm20b_ops.ltc;
235 gops->clock_gating = gm20b_ops.clock_gating; 251 gops->clock_gating = gm20b_ops.clock_gating;
236 gops->mc = gm20b_ops.mc; 252 gops->mc = gm20b_ops.mc;
253 gops->dbg_session_ops = gm20b_ops.dbg_session_ops;
254 gops->debug = gm20b_ops.debug;
237 gops->cde = gm20b_ops.cde; 255 gops->cde = gm20b_ops.cde;
238 gops->falcon = gm20b_ops.falcon; 256 gops->falcon = gm20b_ops.falcon;
239 257
@@ -282,8 +300,6 @@ int gm20b_init_hal(struct gk20a *g)
282 gm20b_init_pmu_ops(gops); 300 gm20b_init_pmu_ops(gops);
283 gm20b_init_clk_ops(gops); 301 gm20b_init_clk_ops(gops);
284 gm20b_init_regops(gops); 302 gm20b_init_regops(gops);
285 gk20a_init_debug_ops(gops);
286 gk20a_init_dbg_session_ops(gops);
287 gm20b_init_therm_ops(gops); 303 gm20b_init_therm_ops(gops);
288 gk20a_init_tsg_ops(gops); 304 gk20a_init_tsg_ops(gops);
289#if defined(CONFIG_GK20A_CYCLE_STATS) 305#if defined(CONFIG_GK20A_CYCLE_STATS)
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c
index 8521bf6d..14f7dc2e 100644
--- a/drivers/gpu/nvgpu/gp106/hal_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c
@@ -19,6 +19,7 @@
19#include "gk20a/bus_gk20a.h" 19#include "gk20a/bus_gk20a.h"
20#include "gk20a/pramin_gk20a.h" 20#include "gk20a/pramin_gk20a.h"
21#include "gk20a/flcn_gk20a.h" 21#include "gk20a/flcn_gk20a.h"
22#include "gk20a/regops_gk20a.h"
22#include "gk20a/mc_gk20a.h" 23#include "gk20a/mc_gk20a.h"
23 24
24#include "gp10b/ltc_gp10b.h" 25#include "gp10b/ltc_gp10b.h"
@@ -257,6 +258,21 @@ static const struct gpu_ops gp106_ops = {
257 .boot_0 = gk20a_mc_boot_0, 258 .boot_0 = gk20a_mc_boot_0,
258 .is_intr1_pending = mc_gp10b_is_intr1_pending, 259 .is_intr1_pending = mc_gp10b_is_intr1_pending,
259 }, 260 },
261 .debug = {
262 .show_dump = gk20a_debug_show_dump,
263 },
264 .dbg_session_ops = {
265 .exec_reg_ops = exec_regops_gk20a,
266 .dbg_set_powergate = dbg_set_powergate,
267 .check_and_set_global_reservation =
268 nvgpu_check_and_set_global_reservation,
269 .check_and_set_context_reservation =
270 nvgpu_check_and_set_context_reservation,
271 .release_profiler_reservation =
272 nvgpu_release_profiler_reservation,
273 .perfbuffer_enable = gk20a_perfbuf_enable_locked,
274 .perfbuffer_disable = gk20a_perfbuf_disable_locked,
275 },
260 .cde = { 276 .cde = {
261 .get_program_numbers = gp10b_cde_get_program_numbers, 277 .get_program_numbers = gp10b_cde_get_program_numbers,
262 .need_scatter_buffer = gp10b_need_scatter_buffer, 278 .need_scatter_buffer = gp10b_need_scatter_buffer,
@@ -295,6 +311,8 @@ int gp106_init_hal(struct gk20a *g)
295 gops->ltc = gp106_ops.ltc; 311 gops->ltc = gp106_ops.ltc;
296 gops->clock_gating = gp106_ops.clock_gating; 312 gops->clock_gating = gp106_ops.clock_gating;
297 gops->mc = gp106_ops.mc; 313 gops->mc = gp106_ops.mc;
314 gops->debug = gp106_ops.debug;
315 gops->dbg_session_ops = gp106_ops.dbg_session_ops;
298 gops->cde = gp106_ops.cde; 316 gops->cde = gp106_ops.cde;
299 gops->xve = gp106_ops.xve; 317 gops->xve = gp106_ops.xve;
300 gops->falcon = gp106_ops.falcon; 318 gops->falcon = gp106_ops.falcon;
@@ -318,8 +336,6 @@ int gp106_init_hal(struct gk20a *g)
318 gp106_init_gr_ctx(gops); 336 gp106_init_gr_ctx(gops);
319 gp106_init_mm(gops); 337 gp106_init_mm(gops);
320 gp106_init_pmu_ops(gops); 338 gp106_init_pmu_ops(gops);
321 gk20a_init_debug_ops(gops);
322 gk20a_init_dbg_session_ops(gops);
323 gp106_init_clk_ops(gops); 339 gp106_init_clk_ops(gops);
324 gp106_init_clk_arb_ops(gops); 340 gp106_init_clk_arb_ops(gops);
325 gp106_init_regops(gops); 341 gp106_init_regops(gops);
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
index af1195ea..627280ae 100644
--- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
@@ -19,6 +19,7 @@
19#include "gk20a/bus_gk20a.h" 19#include "gk20a/bus_gk20a.h"
20#include "gk20a/pramin_gk20a.h" 20#include "gk20a/pramin_gk20a.h"
21#include "gk20a/flcn_gk20a.h" 21#include "gk20a/flcn_gk20a.h"
22#include "gk20a/regops_gk20a.h"
22#include "gk20a/mc_gk20a.h" 23#include "gk20a/mc_gk20a.h"
23 24
24#include "gp10b/gr_gp10b.h" 25#include "gp10b/gr_gp10b.h"
@@ -224,6 +225,21 @@ static const struct gpu_ops gp10b_ops = {
224 .boot_0 = gk20a_mc_boot_0, 225 .boot_0 = gk20a_mc_boot_0,
225 .is_intr1_pending = mc_gp10b_is_intr1_pending, 226 .is_intr1_pending = mc_gp10b_is_intr1_pending,
226 }, 227 },
228 .debug = {
229 .show_dump = gk20a_debug_show_dump,
230 },
231 .dbg_session_ops = {
232 .exec_reg_ops = exec_regops_gk20a,
233 .dbg_set_powergate = dbg_set_powergate,
234 .check_and_set_global_reservation =
235 nvgpu_check_and_set_global_reservation,
236 .check_and_set_context_reservation =
237 nvgpu_check_and_set_context_reservation,
238 .release_profiler_reservation =
239 nvgpu_release_profiler_reservation,
240 .perfbuffer_enable = gk20a_perfbuf_enable_locked,
241 .perfbuffer_disable = gk20a_perfbuf_disable_locked,
242 },
227 .cde = { 243 .cde = {
228 .get_program_numbers = gp10b_cde_get_program_numbers, 244 .get_program_numbers = gp10b_cde_get_program_numbers,
229 .need_scatter_buffer = gp10b_need_scatter_buffer, 245 .need_scatter_buffer = gp10b_need_scatter_buffer,
@@ -245,6 +261,8 @@ int gp10b_init_hal(struct gk20a *g)
245 gops->ltc = gp10b_ops.ltc; 261 gops->ltc = gp10b_ops.ltc;
246 gops->clock_gating = gp10b_ops.clock_gating; 262 gops->clock_gating = gp10b_ops.clock_gating;
247 gops->mc = gp10b_ops.mc; 263 gops->mc = gp10b_ops.mc;
264 gops->debug = gp10b_ops.debug;
265 gops->dbg_session_ops = gp10b_ops.dbg_session_ops;
248 gops->cde = gp10b_ops.cde; 266 gops->cde = gp10b_ops.cde;
249 gops->falcon = gp10b_ops.falcon; 267 gops->falcon = gp10b_ops.falcon;
250 268
@@ -301,8 +319,6 @@ int gp10b_init_hal(struct gk20a *g)
301 gp10b_init_gr_ctx(gops); 319 gp10b_init_gr_ctx(gops);
302 gp10b_init_mm(gops); 320 gp10b_init_mm(gops);
303 gp10b_init_pmu_ops(gops); 321 gp10b_init_pmu_ops(gops);
304 gk20a_init_debug_ops(gops);
305 gk20a_init_dbg_session_ops(gops);
306 gp10b_init_regops(gops); 322 gp10b_init_regops(gops);
307 gp10b_init_therm_ops(gops); 323 gp10b_init_therm_ops(gops);
308 gk20a_init_tsg_ops(gops); 324 gk20a_init_tsg_ops(gops);
diff --git a/drivers/gpu/nvgpu/include/nvgpu/debug.h b/drivers/gpu/nvgpu/include/nvgpu/debug.h
index 70a03978..b1b65af3 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/debug.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/debug.h
@@ -46,8 +46,6 @@ static inline void gk20a_debug_output(struct gk20a_debug_output *o,
46static inline void gk20a_debug_dump(struct gk20a *g) {} 46static inline void gk20a_debug_dump(struct gk20a *g) {}
47static inline void gk20a_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o) {} 47static inline void gk20a_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o) {}
48static inline int gk20a_gr_debug_dump(struct gk20a *g) { return 0;} 48static inline int gk20a_gr_debug_dump(struct gk20a *g) { return 0;}
49static inline void gk20a_init_debug_ops(struct gpu_ops *gops) {}
50
51static inline void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink) {} 49static inline void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink) {}
52static inline void gk20a_debug_deinit(struct gk20a *g) {} 50static inline void gk20a_debug_deinit(struct gk20a *g) {}
53#endif 51#endif