From 6eab11c6e80635629fd2fba5e8d04baaaa1e1f2d Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Tue, 20 May 2014 15:02:54 +0530 Subject: gpu: nvgpu: gk20a: add busy lock - add rw_semaphore busy_lock for gpu busy() path - take read lock on busy_lock inside gk20a_busy() so that all usual requests can execute simultaneously - write lock can be taken when we need to block all of the gk20a_busy() calls Bug 1487804 Change-Id: I1b162b38bce9621723d3e45280c6076816cf771a Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/412060 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gk20a.c | 7 +++++++ drivers/gpu/nvgpu/gk20a/gk20a.h | 2 ++ 2 files changed, 9 insertions(+) (limited to 'drivers/gpu/nvgpu') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 0c6b1e5f..a5b4fddc 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -1386,6 +1386,8 @@ static int gk20a_probe(struct platform_device *dev) gk20a_init_support(dev); + init_rwsem(&gk20a->busy_lock); + spin_lock_init(&gk20a->mc_enable_lock); /* Initialize the platform interface. */ @@ -1544,6 +1546,9 @@ void gk20a_busy_noresume(struct platform_device *pdev) int gk20a_busy(struct platform_device *pdev) { int ret = 0; + struct gk20a *g = get_gk20a(pdev); + + down_read(&g->busy_lock); #ifdef CONFIG_PM_RUNTIME ret = pm_runtime_get_sync(&pdev->dev); @@ -1552,6 +1557,8 @@ int gk20a_busy(struct platform_device *pdev) #endif gk20a_scale_notify_busy(pdev); + up_read(&g->busy_lock); + return ret < 0 ? ret : 0; } diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index ef7945f4..e6630ebf 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -220,6 +220,8 @@ struct gk20a { bool power_on; + struct rw_semaphore busy_lock; + struct clk_gk20a clk; struct fifo_gk20a fifo; struct gr_gk20a gr; -- cgit v1.2.2