From 797e4dd319bd2b9e13ce0e44a3bbbb75e4820330 Mon Sep 17 00:00:00 2001 From: Seshendra Gadagottu Date: Tue, 4 Nov 2014 18:47:12 -0800 Subject: gpu: nvgpu: cde: cancel delayed_work during suspend During gpu suspend, cancel all pending delayed cde work to avoid issues of scheduling this delayed work during suspend/resume when gpu is not ready. Bug 1574000 Change-Id: I2b6bfa489435a781dc576a077f9af01b1e1628ce Signed-off-by: Seshendra Gadagottu Reviewed-on: http://git-master/r/593557 Reviewed-by: Shridhar Rasal Reviewed-by: Deepak Nibade Reviewed-by: Prashant Gaikwad Tested-by: Prashant Gaikwad Reviewed-by: Bharat Nihalani --- drivers/gpu/nvgpu/gk20a/cde_gk20a.c | 20 ++++++++++++++++++++ drivers/gpu/nvgpu/gk20a/cde_gk20a.h | 1 + drivers/gpu/nvgpu/gk20a/gk20a.c | 3 +++ 3 files changed, 24 insertions(+) diff --git a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c index 9067aae5..47ea8052 100644 --- a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c @@ -144,6 +144,26 @@ void gk20a_cde_destroy(struct gk20a *g) mutex_unlock(&cde_app->mutex); } +void gk20a_cde_suspend(struct gk20a *g) +{ + + struct gk20a_cde_app *cde_app = &g->cde_app; + struct gk20a_cde_ctx *cde_ctx, *cde_ctx_save; + + if (!cde_app->initialised) + return; + + list_for_each_entry_safe(cde_ctx, cde_ctx_save, + &cde_app->cde_ctx_lru, list) { + if (cde_ctx->is_temporary) { + mutex_lock(&cde_app->mutex); + cancel_delayed_work(&cde_ctx->ctx_deleter_work); + mutex_unlock(&cde_app->mutex); + } + } + +} + static int gk20a_cde_allocate_contexts(struct gk20a *g) { struct gk20a_cde_app *cde_app = &g->cde_app; diff --git a/drivers/gpu/nvgpu/gk20a/cde_gk20a.h b/drivers/gpu/nvgpu/gk20a/cde_gk20a.h index 4120dc94..9d7dbba6 100644 --- a/drivers/gpu/nvgpu/gk20a/cde_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/cde_gk20a.h @@ -262,6 +262,7 @@ struct gk20a_cde_app { }; void gk20a_cde_destroy(struct gk20a *g); +void gk20a_cde_suspend(struct gk20a *g); int gk20a_init_cde_support(struct gk20a *g); int gk20a_cde_reload(struct gk20a *g); int gk20a_cde_convert(struct gk20a *g, struct dma_buf *dst, diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index c7d40fcd..ad1a940d 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -679,6 +679,9 @@ static int gk20a_pm_prepare_poweroff(struct device *dev) if (ret) return ret; + /* cancel any pending cde work */ + gk20a_cde_suspend(g); + /* * After this point, gk20a interrupts should not get * serviced. -- cgit v1.2.2