summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
diff options
context:
space:
mode:
authorSunny He <suhe@nvidia.com>2017-06-30 17:40:33 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-07-24 02:35:03 -0400
commitd717c69d2b1992688589ae389380fedf0b06c720 (patch)
tree5d7596070d8ab7ca53bcd8506135d99789c9b7bb /drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
parent882a5be5a45702cd94c4eddf9d01e76fd8e039a1 (diff)
gpu: nvgpu: Reorg css HAL initialization
Reorganize HAL initialization to remove inheritance and construct the gpu_ops struct at compile time. This patch only covers the css sub-module 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: I3bf696e13d359982c964c7bc470500a30555c034 Signed-off-by: Sunny He <suhe@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1514205 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/nvgpu/gk20a/css_gr_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
index 452bcd11..8f655b26 100644
--- a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c
@@ -72,7 +72,7 @@ static inline u32 css_hw_get_pending_snapshots(struct gk20a *g)
72} 72}
73 73
74/* informs hw how many snapshots have been processed (frees up fifo space) */ 74/* informs hw how many snapshots have been processed (frees up fifo space) */
75static inline void css_hw_set_handled_snapshots(struct gk20a *g, u32 done) 75inline void css_hw_set_handled_snapshots(struct gk20a *g, u32 done)
76{ 76{
77 if (done > 0) { 77 if (done > 0) {
78 gk20a_writel(g, perf_pmasys_mem_bump_r(), 78 gk20a_writel(g, perf_pmasys_mem_bump_r(),
@@ -127,7 +127,7 @@ static int css_gr_create_shared_data(struct gr_gk20a *gr)
127 return 0; 127 return 0;
128} 128}
129 129
130static int css_hw_enable_snapshot(struct channel_gk20a *ch, 130int css_hw_enable_snapshot(struct channel_gk20a *ch,
131 struct gk20a_cs_snapshot_client *cs_client) 131 struct gk20a_cs_snapshot_client *cs_client)
132{ 132{
133 struct gk20a *g = ch->g; 133 struct gk20a *g = ch->g;
@@ -203,7 +203,7 @@ failed_allocation:
203 return ret; 203 return ret;
204} 204}
205 205
206static void css_hw_disable_snapshot(struct gr_gk20a *gr) 206void css_hw_disable_snapshot(struct gr_gk20a *gr)
207{ 207{
208 struct gk20a *g = gr->g; 208 struct gk20a *g = gr->g;
209 struct gk20a_cs_snapshot *data = gr->cs_data; 209 struct gk20a_cs_snapshot *data = gr->cs_data;
@@ -399,7 +399,7 @@ next_hw_fifo_entry:
399 return 0; 399 return 0;
400} 400}
401 401
402static u32 css_gr_allocate_perfmon_ids(struct gk20a_cs_snapshot *data, 402u32 css_gr_allocate_perfmon_ids(struct gk20a_cs_snapshot *data,
403 u32 count) 403 u32 count)
404{ 404{
405 unsigned long *pids = data->perfmon_ids; 405 unsigned long *pids = data->perfmon_ids;
@@ -415,7 +415,7 @@ static u32 css_gr_allocate_perfmon_ids(struct gk20a_cs_snapshot *data,
415 return f; 415 return f;
416} 416}
417 417
418static u32 css_gr_release_perfmon_ids(struct gk20a_cs_snapshot *data, 418u32 css_gr_release_perfmon_ids(struct gk20a_cs_snapshot *data,
419 u32 start, 419 u32 start,
420 u32 count) 420 u32 count)
421{ 421{
@@ -653,7 +653,7 @@ void gr_gk20a_free_cyclestats_snapshot_data(struct gk20a *g)
653 nvgpu_mutex_destroy(&gr->cs_lock); 653 nvgpu_mutex_destroy(&gr->cs_lock);
654} 654}
655 655
656static int css_hw_check_data_available(struct channel_gk20a *ch, u32 *pending, 656int css_hw_check_data_available(struct channel_gk20a *ch, u32 *pending,
657 bool *hw_overflow) 657 bool *hw_overflow)
658{ 658{
659 struct gk20a *g = ch->g; 659 struct gk20a *g = ch->g;
@@ -670,13 +670,3 @@ static int css_hw_check_data_available(struct channel_gk20a *ch, u32 *pending,
670 *hw_overflow = css_hw_get_overflow_status(g); 670 *hw_overflow = css_hw_get_overflow_status(g);
671 return 0; 671 return 0;
672} 672}
673
674void gk20a_init_css_ops(struct gpu_ops *gops)
675{
676 gops->css.enable_snapshot = css_hw_enable_snapshot;
677 gops->css.disable_snapshot = css_hw_disable_snapshot;
678 gops->css.check_data_available = css_hw_check_data_available;
679 gops->css.set_handled_snapshots = css_hw_set_handled_snapshots;
680 gops->css.allocate_perfmon_ids = css_gr_allocate_perfmon_ids;
681 gops->css.release_perfmon_ids = css_gr_release_perfmon_ids;
682}