summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gr_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gr_gk20a.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
index 1a93d546..fc1978ed 100644
--- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
@@ -330,6 +330,8 @@ int gr_gk20a_wait_idle(struct gk20a *g, unsigned long end_jiffies,
330 bool ctxsw_active; 330 bool ctxsw_active;
331 bool gr_busy; 331 bool gr_busy;
332 u32 gr_engine_id; 332 u32 gr_engine_id;
333 u32 engine_status;
334 bool ctx_status_invalid;
333 335
334 gk20a_dbg_fn(""); 336 gk20a_dbg_fn("");
335 337
@@ -343,14 +345,21 @@ int gr_gk20a_wait_idle(struct gk20a *g, unsigned long end_jiffies,
343 gr_enabled = gk20a_readl(g, mc_enable_r()) & 345 gr_enabled = gk20a_readl(g, mc_enable_r()) &
344 mc_enable_pgraph_enabled_f(); 346 mc_enable_pgraph_enabled_f();
345 347
346 ctxsw_active = gk20a_readl(g, 348 engine_status = gk20a_readl(g,
347 fifo_engine_status_r(gr_engine_id)) & 349 fifo_engine_status_r(gr_engine_id));
350
351 ctxsw_active = engine_status &
348 fifo_engine_status_ctxsw_in_progress_f(); 352 fifo_engine_status_ctxsw_in_progress_f();
349 353
354 ctx_status_invalid =
355 (fifo_engine_status_ctx_status_v(engine_status) ==
356 fifo_engine_status_ctx_status_invalid_v());
357
350 gr_busy = gk20a_readl(g, gr_engine_status_r()) & 358 gr_busy = gk20a_readl(g, gr_engine_status_r()) &
351 gr_engine_status_value_busy_f(); 359 gr_engine_status_value_busy_f();
352 360
353 if (!gr_enabled || (!gr_busy && !ctxsw_active)) { 361 if (!gr_enabled || ctx_status_invalid
362 || (!gr_busy && !ctxsw_active)) {
354 gk20a_dbg_fn("done"); 363 gk20a_dbg_fn("done");
355 return 0; 364 return 0;
356 } 365 }