summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
diff options
context:
space:
mode:
authorseshendra Gadagottu <sgadagottu@nvidia.com>2016-08-31 21:37:01 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2016-09-21 18:13:58 -0400
commitf937b42672c8752c322a946e8e1fb631acc5229a (patch)
treef19d5d827b55519cbc7233cf56c84f4756d76c1f /drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
parent7303dd33ef69f0a533ebce31caf658e9c35a7091 (diff)
gpu: nvgpu: create chip specific runlist entry
To handle chip specific runlist entry size and structure, add and implement relevant functional pointers. Bug 1735760 Change-Id: I01f3ea78fb21d9fe30c82ba51ef24d7d95ebf90a Signed-off-by: seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-on: http://git-master/r/1214473 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fifo_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.c50
1 files changed, 36 insertions, 14 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
index 34b0560c..835ef062 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
@@ -615,7 +615,10 @@ static int init_runlist(struct gk20a *g, struct fifo_gk20a *f)
615 if (!runlist->active_tsgs) 615 if (!runlist->active_tsgs)
616 goto clean_up_runlist; 616 goto clean_up_runlist;
617 617
618 runlist_size = ram_rl_entry_size_v() * f->num_runlist_entries; 618 runlist_size = f->runlist_entry_size * f->num_runlist_entries;
619 gk20a_dbg_info("runlist_entries %d runlist size %llu\n",
620 f->num_runlist_entries, runlist_size);
621
619 for (i = 0; i < MAX_RUNLIST_BUFFERS; i++) { 622 for (i = 0; i < MAX_RUNLIST_BUFFERS; i++) {
620 int err = gk20a_gmmu_alloc_sys(g, runlist_size, 623 int err = gk20a_gmmu_alloc_sys(g, runlist_size,
621 &runlist->mem[i]); 624 &runlist->mem[i]);
@@ -787,6 +790,7 @@ static int gk20a_init_fifo_setup_sw(struct gk20a *g)
787 gk20a_init_fifo_pbdma_intr_descs(f); /* just filling in data/tables */ 790 gk20a_init_fifo_pbdma_intr_descs(f); /* just filling in data/tables */
788 791
789 f->num_channels = g->ops.fifo.get_num_fifos(g); 792 f->num_channels = g->ops.fifo.get_num_fifos(g);
793 f->runlist_entry_size = g->ops.fifo.runlist_entry_size();
790 f->num_runlist_entries = fifo_eng_runlist_length_max_v(); 794 f->num_runlist_entries = fifo_eng_runlist_length_max_v();
791 f->num_pbdma = nvgpu_get_litter_value(g, GPU_LIT_HOST_NUM_PBDMA); 795 f->num_pbdma = nvgpu_get_litter_value(g, GPU_LIT_HOST_NUM_PBDMA);
792 f->max_engines = nvgpu_get_litter_value(g, GPU_LIT_HOST_NUM_ENGINES); 796 f->max_engines = nvgpu_get_litter_value(g, GPU_LIT_HOST_NUM_ENGINES);
@@ -2646,8 +2650,9 @@ static int gk20a_fifo_runlist_wait_pending(struct gk20a *g, u32 runlist_id)
2646 return ret; 2650 return ret;
2647} 2651}
2648 2652
2649static inline u32 gk20a_get_tsg_runlist_entry_0(struct tsg_gk20a *tsg) 2653void gk20a_get_tsg_runlist_entry(struct tsg_gk20a *tsg, u32 *runlist)
2650{ 2654{
2655
2651 u32 runlist_entry_0 = ram_rl_entry_id_f(tsg->tsgid) | 2656 u32 runlist_entry_0 = ram_rl_entry_id_f(tsg->tsgid) |
2652 ram_rl_entry_type_tsg_f() | 2657 ram_rl_entry_type_tsg_f() |
2653 ram_rl_entry_tsg_length_f(tsg->num_active_channels); 2658 ram_rl_entry_tsg_length_f(tsg->num_active_channels);
@@ -2661,7 +2666,15 @@ static inline u32 gk20a_get_tsg_runlist_entry_0(struct tsg_gk20a *tsg)
2661 ram_rl_entry_timeslice_scale_3_f() | 2666 ram_rl_entry_timeslice_scale_3_f() |
2662 ram_rl_entry_timeslice_timeout_128_f(); 2667 ram_rl_entry_timeslice_timeout_128_f();
2663 2668
2664 return runlist_entry_0; 2669 runlist[0] = runlist_entry_0;
2670 runlist[1] = 0;
2671
2672}
2673
2674void gk20a_get_ch_runlist_entry(struct channel_gk20a *ch, u32 *runlist)
2675{
2676 runlist[0] = ram_rl_entry_chid_f(ch->hw_chid);
2677 runlist[1] = 0;
2665} 2678}
2666 2679
2667/* recursively construct a runlist with interleaved bare channels and TSGs */ 2680/* recursively construct a runlist with interleaved bare channels and TSGs */
@@ -2677,6 +2690,7 @@ static u32 *gk20a_runlist_construct_locked(struct fifo_gk20a *f,
2677 struct channel_gk20a *ch; 2690 struct channel_gk20a *ch;
2678 bool skip_next = false; 2691 bool skip_next = false;
2679 u32 chid, tsgid, count = 0; 2692 u32 chid, tsgid, count = 0;
2693 u32 runlist_entry_words = f->runlist_entry_size / sizeof(u32);
2680 2694
2681 gk20a_dbg_fn(""); 2695 gk20a_dbg_fn("");
2682 2696
@@ -2709,9 +2723,10 @@ static u32 *gk20a_runlist_construct_locked(struct fifo_gk20a *f,
2709 return NULL; 2723 return NULL;
2710 2724
2711 gk20a_dbg_info("add channel %d to runlist", chid); 2725 gk20a_dbg_info("add channel %d to runlist", chid);
2712 runlist_entry[0] = ram_rl_entry_chid_f(chid); 2726 f->g->ops.fifo.get_ch_runlist_entry(ch, runlist_entry);
2713 runlist_entry[1] = 0; 2727 gk20a_dbg_info("run list count %d runlist [0] %x [1] %x\n",
2714 runlist_entry += 2; 2728 count, runlist_entry[0], runlist_entry[1]);
2729 runlist_entry += runlist_entry_words;
2715 count++; 2730 count++;
2716 (*entries_left)--; 2731 (*entries_left)--;
2717 } 2732 }
@@ -2741,9 +2756,10 @@ static u32 *gk20a_runlist_construct_locked(struct fifo_gk20a *f,
2741 2756
2742 /* add TSG entry */ 2757 /* add TSG entry */
2743 gk20a_dbg_info("add TSG %d to runlist", tsg->tsgid); 2758 gk20a_dbg_info("add TSG %d to runlist", tsg->tsgid);
2744 runlist_entry[0] = gk20a_get_tsg_runlist_entry_0(tsg); 2759 f->g->ops.fifo.get_tsg_runlist_entry(tsg, runlist_entry);
2745 runlist_entry[1] = 0; 2760 gk20a_dbg_info("tsg runlist count %d runlist [0] %x [1] %x\n",
2746 runlist_entry += 2; 2761 count, runlist_entry[0], runlist_entry[1]);
2762 runlist_entry += runlist_entry_words;
2747 count++; 2763 count++;
2748 (*entries_left)--; 2764 (*entries_left)--;
2749 2765
@@ -2761,10 +2777,12 @@ static u32 *gk20a_runlist_construct_locked(struct fifo_gk20a *f,
2761 2777
2762 gk20a_dbg_info("add channel %d to runlist", 2778 gk20a_dbg_info("add channel %d to runlist",
2763 ch->hw_chid); 2779 ch->hw_chid);
2764 runlist_entry[0] = ram_rl_entry_chid_f(ch->hw_chid); 2780 f->g->ops.fifo.get_ch_runlist_entry(ch, runlist_entry);
2765 runlist_entry[1] = 0; 2781 gk20a_dbg_info(
2766 runlist_entry += 2; 2782 "run list count %d runlist [0] %x [1] %x\n",
2783 count, runlist_entry[0], runlist_entry[1]);
2767 count++; 2784 count++;
2785 runlist_entry += runlist_entry_words;
2768 (*entries_left)--; 2786 (*entries_left)--;
2769 } 2787 }
2770 mutex_unlock(&tsg->ch_list_lock); 2788 mutex_unlock(&tsg->ch_list_lock);
@@ -2826,6 +2844,8 @@ static int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id,
2826 struct channel_gk20a *ch = NULL; 2844 struct channel_gk20a *ch = NULL;
2827 struct tsg_gk20a *tsg = NULL; 2845 struct tsg_gk20a *tsg = NULL;
2828 u32 count = 0; 2846 u32 count = 0;
2847 u32 runlist_entry_words = f->runlist_entry_size / sizeof(u32);
2848
2829 runlist = &f->runlist_info[runlist_id]; 2849 runlist = &f->runlist_info[runlist_id];
2830 2850
2831 /* valid channel, add/remove it from active list. 2851 /* valid channel, add/remove it from active list.
@@ -2888,8 +2908,7 @@ static int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id,
2888 ret = -E2BIG; 2908 ret = -E2BIG;
2889 goto clean_up; 2909 goto clean_up;
2890 } 2910 }
2891 2911 count = (runlist_end - runlist_entry_base) / runlist_entry_words;
2892 count = (runlist_end - runlist_entry_base) / 2;
2893 WARN_ON(count > f->num_runlist_entries); 2912 WARN_ON(count > f->num_runlist_entries);
2894 } else /* suspend to remove all channels */ 2913 } else /* suspend to remove all channels */
2895 count = 0; 2914 count = 0;
@@ -3242,4 +3261,7 @@ void gk20a_init_fifo(struct gpu_ops *gops)
3242 gops->fifo.device_info_data_parse = NULL; 3261 gops->fifo.device_info_data_parse = NULL;
3243 gops->fifo.eng_runlist_base_size = fifo_eng_runlist_base__size_1_v; 3262 gops->fifo.eng_runlist_base_size = fifo_eng_runlist_base__size_1_v;
3244 gops->fifo.init_engine_info = gk20a_fifo_init_engine_info; 3263 gops->fifo.init_engine_info = gk20a_fifo_init_engine_info;
3264 gops->fifo.runlist_entry_size = ram_rl_entry_size_v;
3265 gops->fifo.get_tsg_runlist_entry = gk20a_get_tsg_runlist_entry;
3266 gops->fifo.get_ch_runlist_entry = gk20a_get_ch_runlist_entry;
3245} 3267}