From f1402db43f292b22930499bf7e80b4ec356efae4 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Mon, 18 Mar 2019 18:40:48 +0530 Subject: [PATCH] gpu: nvgpu: delete gr_gv11b_update_ctxsw_preemption_mode() There is nothing h/w specific in gr_gv11b_update_ctxsw_preemption_mode anymore. Delete it and re-use gp10b specific hal for volta/tu104 Update gr_gp10b_update_ctxsw_preemption_mode to call platform specific hals if defined Jira NVGPU-1887 Change-Id: Idae9ebf780b1e76abf847d8b39aa40c0e0560084 Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/2084751 Reviewed-by: mobile promotions Tested-by: mobile promotions --- .../nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c | 2 +- drivers/gpu/nvgpu/gp10b/gr_gp10b.c | 9 +++ drivers/gpu/nvgpu/gv11b/gr_gv11b.c | 59 ------------------- drivers/gpu/nvgpu/gv11b/gr_gv11b.h | 2 - drivers/gpu/nvgpu/gv11b/hal_gv11b.c | 2 +- drivers/gpu/nvgpu/tu104/hal_tu104.c | 2 +- 6 files changed, 12 insertions(+), 64 deletions(-) diff --git a/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c b/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c index b316dd1cb..b2a21a7ce 100644 --- a/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c +++ b/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c @@ -159,7 +159,7 @@ static const struct gpu_ops vgpu_gv11b_ops = { .init_ctxsw_preemption_mode = vgpu_gr_init_ctxsw_preemption_mode, .update_ctxsw_preemption_mode = - gr_gv11b_update_ctxsw_preemption_mode, + gr_gp10b_update_ctxsw_preemption_mode, .dump_gr_regs = NULL, .update_pc_sampling = vgpu_gr_update_pc_sampling, .get_rop_l2_en_mask = vgpu_gr_rop_l2_en_mask, diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c index 53c94a8ec..11b171c25 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c @@ -726,6 +726,15 @@ void gr_gp10b_update_ctxsw_preemption_mode(struct gk20a *g, g->ops.gr.init.commit_cbes_reserve(g, gr_ctx, true); + if (g->ops.gr.init.gfxp_wfi_timeout != NULL) { + g->ops.gr.init.gfxp_wfi_timeout(g, gr_ctx, + g->gr.gfxp_wfi_timeout_count, true); + } + + if (g->ops.gr.init.commit_gfxp_rtv_cb != NULL) { + g->ops.gr.init.commit_gfxp_rtv_cb(g, gr_ctx, true); + } + nvgpu_gr_ctx_patch_write_end(g, gr_ctx, true); } diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c index 67243a740..b85f2de36 100644 --- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c @@ -1347,65 +1347,6 @@ void gr_gv11b_set_circular_buffer_size(struct gk20a *g, u32 data) } } -void gr_gv11b_update_ctxsw_preemption_mode(struct gk20a *g, - struct nvgpu_gr_ctx *gr_ctx, struct nvgpu_gr_subctx *subctx) -{ - int err; - - nvgpu_log_fn(g, " "); - - nvgpu_gr_ctx_set_preemption_modes(g, gr_ctx); - - if (gr_ctx->preempt_ctxsw_buffer.gpu_va != 0ULL) { - u64 addr; - u32 size; - - if (subctx != NULL) { - nvgpu_gr_subctx_set_preemption_buffer_va(g, subctx, - gr_ctx); - } else { - nvgpu_gr_ctx_set_preemption_buffer_va(g, gr_ctx); - } - - err = nvgpu_gr_ctx_patch_write_begin(g, gr_ctx, true); - if (err != 0) { - nvgpu_err(g, "can't map patch context"); - goto out; - } - - addr = gr_ctx->betacb_ctxsw_buffer.gpu_va; - g->ops.gr.init.commit_global_attrib_cb(g, gr_ctx, - nvgpu_gr_config_get_tpc_count(g->gr.config), - nvgpu_gr_config_get_max_tpc_count(g->gr.config), addr, - true); - - addr = gr_ctx->pagepool_ctxsw_buffer.gpu_va; - nvgpu_assert(gr_ctx->pagepool_ctxsw_buffer.size <= U32_MAX); - size = (u32)gr_ctx->pagepool_ctxsw_buffer.size; - - g->ops.gr.init.commit_global_pagepool(g, gr_ctx, addr, size, - true, false); - - addr = gr_ctx->spill_ctxsw_buffer.gpu_va; - nvgpu_assert(gr_ctx->spill_ctxsw_buffer.size <= U32_MAX); - size = (u32)gr_ctx->spill_ctxsw_buffer.size; - - g->ops.gr.init.commit_ctxsw_spill(g, gr_ctx, addr, size, true); - - g->ops.gr.init.commit_cbes_reserve(g, gr_ctx, true); - g->ops.gr.init.gfxp_wfi_timeout(g, gr_ctx, - g->gr.gfxp_wfi_timeout_count, true); - - if (g->ops.gr.init.commit_gfxp_rtv_cb != NULL) { - g->ops.gr.init.commit_gfxp_rtv_cb(g, gr_ctx, true); - } - - nvgpu_gr_ctx_patch_write_end(g, gr_ctx, true); - } - -out: - nvgpu_log_fn(g, "done"); -} static void gr_gv11b_dump_gr_per_sm_regs(struct gk20a *g, struct gk20a_debug_output *o, u32 gpc, u32 tpc, u32 sm, u32 offset) diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.h b/drivers/gpu/nvgpu/gv11b/gr_gv11b.h index 4b3235411..4a970f1d3 100644 --- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.h +++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.h @@ -172,8 +172,6 @@ int gr_gv11b_init_preemption_state(struct gk20a *g); void gr_gv11b_init_gfxp_wfi_timeout_count(struct gk20a *g); unsigned long gr_gv11b_get_max_gfxp_wfi_timeout_count(struct gk20a *g); -void gr_gv11b_update_ctxsw_preemption_mode(struct gk20a *g, - struct nvgpu_gr_ctx *gr_ctx, struct nvgpu_gr_subctx *subctx); int gr_gv11b_handle_ssync_hww(struct gk20a *g, u32 *ssync_esr); u32 gv11b_gr_sm_offset(struct gk20a *g, u32 sm); diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c index ad3475f99..b4644d084 100644 --- a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c @@ -353,7 +353,7 @@ static const struct gpu_ops gv11b_ops = { .init_ctxsw_preemption_mode = gr_gp10b_init_ctxsw_preemption_mode, .update_ctxsw_preemption_mode = - gr_gv11b_update_ctxsw_preemption_mode, + gr_gp10b_update_ctxsw_preemption_mode, .dump_gr_regs = gr_gv11b_dump_gr_status_regs, .update_pc_sampling = gr_gm20b_update_pc_sampling, .get_rop_l2_en_mask = gr_gm20b_rop_l2_en_mask, diff --git a/drivers/gpu/nvgpu/tu104/hal_tu104.c b/drivers/gpu/nvgpu/tu104/hal_tu104.c index 07d7937e4..9ed6a4686 100644 --- a/drivers/gpu/nvgpu/tu104/hal_tu104.c +++ b/drivers/gpu/nvgpu/tu104/hal_tu104.c @@ -422,7 +422,7 @@ static const struct gpu_ops tu104_ops = { .init_ctxsw_preemption_mode = gr_gp10b_init_ctxsw_preemption_mode, .update_ctxsw_preemption_mode = - gr_gv11b_update_ctxsw_preemption_mode, + gr_gp10b_update_ctxsw_preemption_mode, .dump_gr_regs = gr_gv11b_dump_gr_status_regs, .update_pc_sampling = gr_gm20b_update_pc_sampling, .get_rop_l2_en_mask = gr_gm20b_rop_l2_en_mask,