From b076c349b26a471776b8c487a702f791e13fb3a4 Mon Sep 17 00:00:00 2001 From: Seema Khowala Date: Thu, 23 Mar 2017 15:25:37 -0700 Subject: gpu: nvgpu: gv11b: fix engine context preempt completion CTX_STATUS_SWITCH: Engine save hasn't started yet, continue to poll CTX_STATUS_INVALID: The engine context has switched off. The preemption step for this engine is complete. CTX_STATUS_VALID or CTX_STATUS_CTXSW_SAVE: check the ID field: * If ID matches the TSG for the context being torn down, the engine reset procedure can be performed, or SW can continue waiting for preempt to finish if id is not being torn down. * If ID does NOT match, the context isn't running on the engine. CTX_STATUS_LOAD: check the NEXT_ID field: * If NEXT_ID matches the TSG of the context being torn down, the engine is loading the context and reset can be performed immediately or after a delay to allow the context a chance to load and be saved off, or sw can continue waiting for preempt to finish if id is not being torn down. * If NEXT_ID does not match the TSG ID or CHID then the context is no longer on the engine. SW may alternatively wait for the CTX_STATUS to reach INVALID, but this may take longer if an unrelated context is currently on the engine or being switched to. JIRA GPUT19X-7 Change-Id: I61499f932019de32e0200084c4c41b21a7cbbd2b Signed-off-by: Seema Khowala Reviewed-on: http://git-master/r/1327164 Reviewed-by: svccoveritychecker Reviewed-by: Seshendra Gadagottu GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gv11b/fifo_gv11b.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'drivers/gpu/nvgpu/gv11b/fifo_gv11b.c') diff --git a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c index 7e310984..1bbf09ec 100644 --- a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c @@ -428,27 +428,40 @@ static int gv11b_fifo_poll_eng_ctx_status(struct gk20a *g, u32 id, ctx_stat == fifo_engine_status_ctx_status_ctxsw_save_v()) { - if (timeout_rc_type == PREEMPT_TIMEOUT_NORC) { - /* called from recovery, eng seems to be hung */ - if (id == fifo_engine_status_id_v(eng_stat)) { + if (id == fifo_engine_status_id_v(eng_stat)) { + if (timeout_rc_type == PREEMPT_TIMEOUT_NORC) { + /* called from recovery, eng seems to be hung */ *reset_eng_bitmask |= BIT(engine_idx); ret = 0; break; + } else { + gk20a_dbg_info("wait preempt engine. " + "ctx_status (valid/save)=%u", ctx_stat); } + } else { + /* context is not running on the engine */ + ret = 0; + break; } } else if (ctx_stat == fifo_engine_status_ctx_status_ctxsw_load_v()) { - if (timeout_rc_type == PREEMPT_TIMEOUT_NORC) { - /* called from recovery, eng seems to be hung */ - if (id == - fifo_engine_status_next_id_v(eng_stat)) { + if (id == fifo_engine_status_next_id_v(eng_stat)) { + if (timeout_rc_type == PREEMPT_TIMEOUT_NORC) { + /* called from recovery, eng seems to be hung */ *reset_eng_bitmask |= BIT(engine_idx); ret = 0; break; + } else { + gk20a_dbg_info("wait preempt engine. " + "ctx_status (load)=%u", ctx_stat); } + } else { + /* context is not running on the engine */ + ret = 0; + break; } } else { -- cgit v1.2.2