summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2018-04-20 10:10:16 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-04-24 14:10:48 -0400
commitfc1ebe57f506c658eb771c101f256b02e3f351ce (patch)
tree25de8cf88b99d3612d5008d6cd7d27c3349e8904
parent65a543f5cac32686b6b2a57b93e285de6aae4ece (diff)
gpu: nvgpu: add HALs to submit and wait for runlist
Add below two new HALs gops.fifo.runlist_hw_submit() to submit a new runlist to hardware gops.fifo.runlist_wait_pending() to wait until runlist write is successful Set existing API gk20a_fifo_runlist_wait_pending() to gops.fifo.runlist_wait_pending HAL Add new API gk20a_fifo_runlist_hw_submit() which submits the runlist to h/w and set it to gops.fifo.runlist_hw_submit HAL Jira NVGPUT-20 Change-Id: Ic23f7d947e30883aca0b536de818e79e14733195 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1700548 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Konsta Holtta <kholtta@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.c40
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.h2
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h3
-rw-r--r--drivers/gpu/nvgpu/gm20b/hal_gm20b.c2
-rw-r--r--drivers/gpu/nvgpu/gp106/hal_gp106.c2
-rw-r--r--drivers/gpu/nvgpu/gp10b/hal_gp10b.c2
-rw-r--r--drivers/gpu/nvgpu/gv100/hal_gv100.c2
-rw-r--r--drivers/gpu/nvgpu/gv11b/hal_gv11b.c2
-rw-r--r--drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c2
-rw-r--r--drivers/gpu/nvgpu/vgpu/gv11b/vgpu_hal_gv11b.c2
10 files changed, 45 insertions, 14 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
index c446e3ea..709631d4 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
@@ -3217,6 +3217,29 @@ int gk20a_fifo_tsg_set_timeslice(struct tsg_gk20a *tsg, u32 timeslice)
3217 return g->ops.fifo.update_runlist(g, tsg->runlist_id, ~0, true, true); 3217 return g->ops.fifo.update_runlist(g, tsg->runlist_id, ~0, true, true);
3218} 3218}
3219 3219
3220void gk20a_fifo_runlist_hw_submit(struct gk20a *g, u32 runlist_id,
3221 u32 count, u32 buffer_index)
3222{
3223 struct fifo_runlist_info_gk20a *runlist = NULL;
3224 u64 runlist_iova;
3225
3226 runlist = &g->fifo.runlist_info[runlist_id];
3227 runlist_iova = nvgpu_mem_get_addr(g, &runlist->mem[buffer_index]);
3228
3229 if (count != 0) {
3230 gk20a_writel(g, fifo_runlist_base_r(),
3231 fifo_runlist_base_ptr_f(u64_lo32(runlist_iova >> 12)) |
3232 nvgpu_aperture_mask(g, &runlist->mem[buffer_index],
3233 fifo_runlist_base_target_sys_mem_ncoh_f(),
3234 fifo_runlist_base_target_sys_mem_coh_f(),
3235 fifo_runlist_base_target_vid_mem_f()));
3236 }
3237
3238 gk20a_writel(g, fifo_runlist_r(),
3239 fifo_runlist_engine_f(runlist_id) |
3240 fifo_eng_runlist_length_f(count));
3241}
3242
3220static int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id, 3243static int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id,
3221 u32 chid, bool add, 3244 u32 chid, bool add,
3222 bool wait_for_finish) 3245 bool wait_for_finish)
@@ -3297,21 +3320,10 @@ static int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id,
3297 } else /* suspend to remove all channels */ 3320 } else /* suspend to remove all channels */
3298 count = 0; 3321 count = 0;
3299 3322
3300 if (count != 0) { 3323 g->ops.fifo.runlist_hw_submit(g, runlist_id, count, new_buf);
3301 gk20a_writel(g, fifo_runlist_base_r(),
3302 fifo_runlist_base_ptr_f(u64_lo32(runlist_iova >> 12)) |
3303 nvgpu_aperture_mask(g, &runlist->mem[new_buf],
3304 fifo_runlist_base_target_sys_mem_ncoh_f(),
3305 fifo_runlist_base_target_sys_mem_coh_f(),
3306 fifo_runlist_base_target_vid_mem_f()));
3307 }
3308
3309 gk20a_writel(g, fifo_runlist_r(),
3310 fifo_runlist_engine_f(runlist_id) |
3311 fifo_eng_runlist_length_f(count));
3312 3324
3313 if (wait_for_finish) { 3325 if (wait_for_finish) {
3314 ret = gk20a_fifo_runlist_wait_pending(g, runlist_id); 3326 ret = g->ops.fifo.runlist_wait_pending(g, runlist_id);
3315 3327
3316 if (ret == -ETIMEDOUT) { 3328 if (ret == -ETIMEDOUT) {
3317 nvgpu_err(g, 3329 nvgpu_err(g,
@@ -3321,7 +3333,7 @@ static int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id,
3321 3333
3322 /* engine reset needs the lock. drop it */ 3334 /* engine reset needs the lock. drop it */
3323 /* wait until the runlist is active again */ 3335 /* wait until the runlist is active again */
3324 ret = gk20a_fifo_runlist_wait_pending(g, runlist_id); 3336 ret = g->ops.fifo.runlist_wait_pending(g, runlist_id);
3325 /* get the lock back. at this point everything should 3337 /* get the lock back. at this point everything should
3326 * should be fine */ 3338 * should be fine */
3327 3339
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h
index 12ef5f69..ea9f4528 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h
@@ -385,6 +385,8 @@ u32 *gk20a_runlist_construct_locked(struct fifo_gk20a *f,
385 bool interleave_enabled, 385 bool interleave_enabled,
386 bool prev_empty, 386 bool prev_empty,
387 u32 *entries_left); 387 u32 *entries_left);
388void gk20a_fifo_runlist_hw_submit(struct gk20a *g, u32 runlist_id,
389 u32 count, u32 buffer_index);
388int gk20a_fifo_runlist_wait_pending(struct gk20a *g, u32 runlist_id); 390int gk20a_fifo_runlist_wait_pending(struct gk20a *g, u32 runlist_id);
389int gk20a_init_fifo_setup_sw_common(struct gk20a *g); 391int gk20a_init_fifo_setup_sw_common(struct gk20a *g);
390int gk20a_init_fifo_setup_sw(struct gk20a *g); 392int gk20a_init_fifo_setup_sw(struct gk20a *g);
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 57854e11..ba27f5d9 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -669,6 +669,9 @@ struct gpu_ops {
669 u64 *base_gpuva, u32 *sync_size); 669 u64 *base_gpuva, u32 *sync_size);
670 u32 (*get_syncpt_incr_per_release)(void); 670 u32 (*get_syncpt_incr_per_release)(void);
671#endif 671#endif
672 void (*runlist_hw_submit)(struct gk20a *g, u32 runlist_id,
673 u32 count, u32 buffer_index);
674 int (*runlist_wait_pending)(struct gk20a *g, u32 runlist_id);
672 } fifo; 675 } fifo;
673 struct pmu_v { 676 struct pmu_v {
674 u32 (*get_pmu_cmdline_args_size)(struct nvgpu_pmu *pmu); 677 u32 (*get_pmu_cmdline_args_size)(struct nvgpu_pmu *pmu);
diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
index 0a58445f..9fc3a494 100644
--- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
@@ -461,6 +461,8 @@ static const struct gpu_ops gm20b_ops = {
461 .get_syncpt_incr_cmd_size = gk20a_fifo_get_syncpt_incr_cmd_size, 461 .get_syncpt_incr_cmd_size = gk20a_fifo_get_syncpt_incr_cmd_size,
462 .get_sync_ro_map = NULL, 462 .get_sync_ro_map = NULL,
463#endif 463#endif
464 .runlist_hw_submit = gk20a_fifo_runlist_hw_submit,
465 .runlist_wait_pending = gk20a_fifo_runlist_wait_pending,
464 }, 466 },
465 .gr_ctx = { 467 .gr_ctx = {
466 .get_netlist_name = gr_gm20b_get_netlist_name, 468 .get_netlist_name = gr_gm20b_get_netlist_name,
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c
index b7b20dce..d1b60af5 100644
--- a/drivers/gpu/nvgpu/gp106/hal_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c
@@ -524,6 +524,8 @@ static const struct gpu_ops gp106_ops = {
524#endif 524#endif
525 .resetup_ramfc = gp10b_fifo_resetup_ramfc, 525 .resetup_ramfc = gp10b_fifo_resetup_ramfc,
526 .device_info_fault_id = top_device_info_data_fault_id_enum_v, 526 .device_info_fault_id = top_device_info_data_fault_id_enum_v,
527 .runlist_hw_submit = gk20a_fifo_runlist_hw_submit,
528 .runlist_wait_pending = gk20a_fifo_runlist_wait_pending,
527 }, 529 },
528 .gr_ctx = { 530 .gr_ctx = {
529 .get_netlist_name = gr_gp106_get_netlist_name, 531 .get_netlist_name = gr_gp106_get_netlist_name,
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
index 9a441727..a8ee7412 100644
--- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
@@ -497,6 +497,8 @@ static const struct gpu_ops gp10b_ops = {
497#endif 497#endif
498 .resetup_ramfc = gp10b_fifo_resetup_ramfc, 498 .resetup_ramfc = gp10b_fifo_resetup_ramfc,
499 .device_info_fault_id = top_device_info_data_fault_id_enum_v, 499 .device_info_fault_id = top_device_info_data_fault_id_enum_v,
500 .runlist_hw_submit = gk20a_fifo_runlist_hw_submit,
501 .runlist_wait_pending = gk20a_fifo_runlist_wait_pending,
500 }, 502 },
501 .gr_ctx = { 503 .gr_ctx = {
502 .get_netlist_name = gr_gp10b_get_netlist_name, 504 .get_netlist_name = gr_gp10b_get_netlist_name,
diff --git a/drivers/gpu/nvgpu/gv100/hal_gv100.c b/drivers/gpu/nvgpu/gv100/hal_gv100.c
index 7609f6b0..d1befa0e 100644
--- a/drivers/gpu/nvgpu/gv100/hal_gv100.c
+++ b/drivers/gpu/nvgpu/gv100/hal_gv100.c
@@ -585,6 +585,8 @@ static const struct gpu_ops gv100_ops = {
585 .device_info_fault_id = top_device_info_data_fault_id_enum_v, 585 .device_info_fault_id = top_device_info_data_fault_id_enum_v,
586 .free_channel_ctx_header = gv11b_free_subctx_header, 586 .free_channel_ctx_header = gv11b_free_subctx_header,
587 .preempt_ch_tsg = gv11b_fifo_preempt_ch_tsg, 587 .preempt_ch_tsg = gv11b_fifo_preempt_ch_tsg,
588 .runlist_hw_submit = gk20a_fifo_runlist_hw_submit,
589 .runlist_wait_pending = gk20a_fifo_runlist_wait_pending,
588 }, 590 },
589 .gr_ctx = { 591 .gr_ctx = {
590 .get_netlist_name = gr_gv100_get_netlist_name, 592 .get_netlist_name = gr_gv100_get_netlist_name,
diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
index 8a0d1822..ca530aba 100644
--- a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
@@ -558,6 +558,8 @@ static const struct gpu_ops gv11b_ops = {
558 .free_channel_ctx_header = gv11b_free_subctx_header, 558 .free_channel_ctx_header = gv11b_free_subctx_header,
559 .preempt_ch_tsg = gv11b_fifo_preempt_ch_tsg, 559 .preempt_ch_tsg = gv11b_fifo_preempt_ch_tsg,
560 .handle_ctxsw_timeout = gv11b_fifo_handle_ctxsw_timeout, 560 .handle_ctxsw_timeout = gv11b_fifo_handle_ctxsw_timeout,
561 .runlist_hw_submit = gk20a_fifo_runlist_hw_submit,
562 .runlist_wait_pending = gk20a_fifo_runlist_wait_pending,
561 }, 563 },
562 .gr_ctx = { 564 .gr_ctx = {
563 .get_netlist_name = gr_gv11b_get_netlist_name, 565 .get_netlist_name = gr_gv11b_get_netlist_name,
diff --git a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c
index 9d575061..73543baf 100644
--- a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c
+++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c
@@ -372,6 +372,8 @@ static const struct gpu_ops vgpu_gp10b_ops = {
372#endif 372#endif
373 .resetup_ramfc = NULL, 373 .resetup_ramfc = NULL,
374 .device_info_fault_id = top_device_info_data_fault_id_enum_v, 374 .device_info_fault_id = top_device_info_data_fault_id_enum_v,
375 .runlist_hw_submit = gk20a_fifo_runlist_hw_submit,
376 .runlist_wait_pending = gk20a_fifo_runlist_wait_pending,
375 }, 377 },
376 .gr_ctx = { 378 .gr_ctx = {
377 .get_netlist_name = gr_gp10b_get_netlist_name, 379 .get_netlist_name = gr_gp10b_get_netlist_name,
diff --git a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_hal_gv11b.c b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_hal_gv11b.c
index d07d0229..4dc3a150 100644
--- a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_hal_gv11b.c
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_hal_gv11b.c
@@ -419,6 +419,8 @@ static const struct gpu_ops vgpu_gv11b_ops = {
419 .free_channel_ctx_header = vgpu_gv11b_free_subctx_header, 419 .free_channel_ctx_header = vgpu_gv11b_free_subctx_header,
420 .preempt_ch_tsg = gv11b_fifo_preempt_ch_tsg, 420 .preempt_ch_tsg = gv11b_fifo_preempt_ch_tsg,
421 .handle_ctxsw_timeout = gv11b_fifo_handle_ctxsw_timeout, 421 .handle_ctxsw_timeout = gv11b_fifo_handle_ctxsw_timeout,
422 .runlist_hw_submit = gk20a_fifo_runlist_hw_submit,
423 .runlist_wait_pending = gk20a_fifo_runlist_wait_pending,
422 }, 424 },
423 .gr_ctx = { 425 .gr_ctx = {
424 .get_netlist_name = gr_gv11b_get_netlist_name, 426 .get_netlist_name = gr_gv11b_get_netlist_name,