summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2014-05-20 05:32:54 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:09:53 -0400
commit6eab11c6e80635629fd2fba5e8d04baaaa1e1f2d (patch)
tree2b58289650dd6632cdd30d6c5be339581beec1b1
parent77a0b8eb131550b96969550e2582a2e8424eabed (diff)
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 <dnibade@nvidia.com> Reviewed-on: http://git-master/r/412060 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c7
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h2
2 files changed, 9 insertions, 0 deletions
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)
1386 1386
1387 gk20a_init_support(dev); 1387 gk20a_init_support(dev);
1388 1388
1389 init_rwsem(&gk20a->busy_lock);
1390
1389 spin_lock_init(&gk20a->mc_enable_lock); 1391 spin_lock_init(&gk20a->mc_enable_lock);
1390 1392
1391 /* Initialize the platform interface. */ 1393 /* Initialize the platform interface. */
@@ -1544,6 +1546,9 @@ void gk20a_busy_noresume(struct platform_device *pdev)
1544int gk20a_busy(struct platform_device *pdev) 1546int gk20a_busy(struct platform_device *pdev)
1545{ 1547{
1546 int ret = 0; 1548 int ret = 0;
1549 struct gk20a *g = get_gk20a(pdev);
1550
1551 down_read(&g->busy_lock);
1547 1552
1548#ifdef CONFIG_PM_RUNTIME 1553#ifdef CONFIG_PM_RUNTIME
1549 ret = pm_runtime_get_sync(&pdev->dev); 1554 ret = pm_runtime_get_sync(&pdev->dev);
@@ -1552,6 +1557,8 @@ int gk20a_busy(struct platform_device *pdev)
1552#endif 1557#endif
1553 gk20a_scale_notify_busy(pdev); 1558 gk20a_scale_notify_busy(pdev);
1554 1559
1560 up_read(&g->busy_lock);
1561
1555 return ret < 0 ? ret : 0; 1562 return ret < 0 ? ret : 0;
1556} 1563}
1557 1564
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 {
220 220
221 bool power_on; 221 bool power_on;
222 222
223 struct rw_semaphore busy_lock;
224
223 struct clk_gk20a clk; 225 struct clk_gk20a clk;
224 struct fifo_gk20a fifo; 226 struct fifo_gk20a fifo;
225 struct gr_gk20a gr; 227 struct gr_gk20a gr;