diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2017-06-19 17:13:14 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-06-20 14:35:29 -0400 |
commit | 9f65627d0edaa45d914d2d180caf1b687e3c0d09 (patch) | |
tree | ed7afd33e5b87f0952c534b239b39fbd816705e4 | |
parent | 2525dc37967077554520f20c95c0a25080e3b872 (diff) |
gpu: nvgpu: Pass struct gk20a to busy and resume
Pass struct gk20a pointer to gk20a_busy_noresume() and
gk20a_idle_nosuspend(). This reduces the number of dependencies to
Linux specific struct device.
JIRA NVGPU-38
Change-Id: I5e05be32e2376bc8be5402bb973c20e28c35a1c3
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1505177
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/module.c | 14 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.h | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 18 |
3 files changed, 18 insertions, 18 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index 7c7cc714..b1638b9e 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c | |||
@@ -51,9 +51,9 @@ | |||
51 | #define CREATE_TRACE_POINTS | 51 | #define CREATE_TRACE_POINTS |
52 | #include <trace/events/gk20a.h> | 52 | #include <trace/events/gk20a.h> |
53 | 53 | ||
54 | void gk20a_busy_noresume(struct device *dev) | 54 | void gk20a_busy_noresume(struct gk20a *g) |
55 | { | 55 | { |
56 | pm_runtime_get_noresume(dev); | 56 | pm_runtime_get_noresume(dev_from_gk20a(g)); |
57 | } | 57 | } |
58 | 58 | ||
59 | int gk20a_busy(struct gk20a *g) | 59 | int gk20a_busy(struct gk20a *g) |
@@ -103,9 +103,9 @@ fail: | |||
103 | return ret < 0 ? ret : 0; | 103 | return ret < 0 ? ret : 0; |
104 | } | 104 | } |
105 | 105 | ||
106 | void gk20a_idle_nosuspend(struct device *dev) | 106 | void gk20a_idle_nosuspend(struct gk20a *g) |
107 | { | 107 | { |
108 | pm_runtime_put_noidle(dev); | 108 | pm_runtime_put_noidle(dev_from_gk20a(g)); |
109 | } | 109 | } |
110 | 110 | ||
111 | void gk20a_idle(struct gk20a *g) | 111 | void gk20a_idle(struct gk20a *g) |
@@ -760,7 +760,7 @@ static int gk20a_pm_suspend(struct device *dev) | |||
760 | int ret = 0; | 760 | int ret = 0; |
761 | 761 | ||
762 | if (g->user_railgate_disabled) | 762 | if (g->user_railgate_disabled) |
763 | gk20a_idle_nosuspend(dev); | 763 | gk20a_idle_nosuspend(g); |
764 | 764 | ||
765 | if (atomic_read(&dev->power.usage_count) > 1) { | 765 | if (atomic_read(&dev->power.usage_count) > 1) { |
766 | ret = -EBUSY; | 766 | ret = -EBUSY; |
@@ -783,7 +783,7 @@ static int gk20a_pm_suspend(struct device *dev) | |||
783 | 783 | ||
784 | fail: | 784 | fail: |
785 | if (g->user_railgate_disabled) | 785 | if (g->user_railgate_disabled) |
786 | gk20a_busy_noresume(dev); | 786 | gk20a_busy_noresume(g); |
787 | 787 | ||
788 | return ret; | 788 | return ret; |
789 | } | 789 | } |
@@ -794,7 +794,7 @@ static int gk20a_pm_resume(struct device *dev) | |||
794 | int ret = 0; | 794 | int ret = 0; |
795 | 795 | ||
796 | if (g->user_railgate_disabled) | 796 | if (g->user_railgate_disabled) |
797 | gk20a_busy_noresume(dev); | 797 | gk20a_busy_noresume(g); |
798 | 798 | ||
799 | if (!g->suspended) | 799 | if (!g->suspended) |
800 | return 0; | 800 | return 0; |
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 843a9e91..f91e86df 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h | |||
@@ -1475,8 +1475,8 @@ void gk20a_remove_sysfs(struct device *dev); | |||
1475 | #define GK20A_BAR1_IORESOURCE_MEM 1 | 1475 | #define GK20A_BAR1_IORESOURCE_MEM 1 |
1476 | #define GK20A_SIM_IORESOURCE_MEM 2 | 1476 | #define GK20A_SIM_IORESOURCE_MEM 2 |
1477 | 1477 | ||
1478 | void gk20a_busy_noresume(struct device *dev); | 1478 | void gk20a_busy_noresume(struct gk20a *g); |
1479 | void gk20a_idle_nosuspend(struct device *dev); | 1479 | void gk20a_idle_nosuspend(struct gk20a *g); |
1480 | int __must_check gk20a_busy(struct gk20a *g); | 1480 | int __must_check gk20a_busy(struct gk20a *g); |
1481 | void gk20a_idle(struct gk20a *g); | 1481 | void gk20a_idle(struct gk20a *g); |
1482 | int __gk20a_do_idle(struct gk20a *g, bool force_reset); | 1482 | int __gk20a_do_idle(struct gk20a *g, bool force_reset); |
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index e7bcf6f0..5ffa3e2f 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |||
@@ -2283,9 +2283,9 @@ int gk20a_mm_fb_flush(struct gk20a *g) | |||
2283 | 2283 | ||
2284 | gk20a_dbg_fn(""); | 2284 | gk20a_dbg_fn(""); |
2285 | 2285 | ||
2286 | gk20a_busy_noresume(g->dev); | 2286 | gk20a_busy_noresume(g); |
2287 | if (!g->power_on) { | 2287 | if (!g->power_on) { |
2288 | gk20a_idle_nosuspend(g->dev); | 2288 | gk20a_idle_nosuspend(g); |
2289 | return 0; | 2289 | return 0; |
2290 | } | 2290 | } |
2291 | 2291 | ||
@@ -2325,7 +2325,7 @@ int gk20a_mm_fb_flush(struct gk20a *g) | |||
2325 | 2325 | ||
2326 | nvgpu_mutex_release(&mm->l2_op_lock); | 2326 | nvgpu_mutex_release(&mm->l2_op_lock); |
2327 | 2327 | ||
2328 | gk20a_idle_nosuspend(g->dev); | 2328 | gk20a_idle_nosuspend(g); |
2329 | 2329 | ||
2330 | return ret; | 2330 | return ret; |
2331 | } | 2331 | } |
@@ -2367,13 +2367,13 @@ static void gk20a_mm_l2_invalidate_locked(struct gk20a *g) | |||
2367 | void gk20a_mm_l2_invalidate(struct gk20a *g) | 2367 | void gk20a_mm_l2_invalidate(struct gk20a *g) |
2368 | { | 2368 | { |
2369 | struct mm_gk20a *mm = &g->mm; | 2369 | struct mm_gk20a *mm = &g->mm; |
2370 | gk20a_busy_noresume(g->dev); | 2370 | gk20a_busy_noresume(g); |
2371 | if (g->power_on) { | 2371 | if (g->power_on) { |
2372 | nvgpu_mutex_acquire(&mm->l2_op_lock); | 2372 | nvgpu_mutex_acquire(&mm->l2_op_lock); |
2373 | gk20a_mm_l2_invalidate_locked(g); | 2373 | gk20a_mm_l2_invalidate_locked(g); |
2374 | nvgpu_mutex_release(&mm->l2_op_lock); | 2374 | nvgpu_mutex_release(&mm->l2_op_lock); |
2375 | } | 2375 | } |
2376 | gk20a_idle_nosuspend(g->dev); | 2376 | gk20a_idle_nosuspend(g); |
2377 | } | 2377 | } |
2378 | 2378 | ||
2379 | void gk20a_mm_l2_flush(struct gk20a *g, bool invalidate) | 2379 | void gk20a_mm_l2_flush(struct gk20a *g, bool invalidate) |
@@ -2384,7 +2384,7 @@ void gk20a_mm_l2_flush(struct gk20a *g, bool invalidate) | |||
2384 | 2384 | ||
2385 | gk20a_dbg_fn(""); | 2385 | gk20a_dbg_fn(""); |
2386 | 2386 | ||
2387 | gk20a_busy_noresume(g->dev); | 2387 | gk20a_busy_noresume(g); |
2388 | if (!g->power_on) | 2388 | if (!g->power_on) |
2389 | goto hw_was_off; | 2389 | goto hw_was_off; |
2390 | 2390 | ||
@@ -2421,7 +2421,7 @@ void gk20a_mm_l2_flush(struct gk20a *g, bool invalidate) | |||
2421 | nvgpu_mutex_release(&mm->l2_op_lock); | 2421 | nvgpu_mutex_release(&mm->l2_op_lock); |
2422 | 2422 | ||
2423 | hw_was_off: | 2423 | hw_was_off: |
2424 | gk20a_idle_nosuspend(g->dev); | 2424 | gk20a_idle_nosuspend(g); |
2425 | } | 2425 | } |
2426 | 2426 | ||
2427 | void gk20a_mm_cbc_clean(struct gk20a *g) | 2427 | void gk20a_mm_cbc_clean(struct gk20a *g) |
@@ -2432,7 +2432,7 @@ void gk20a_mm_cbc_clean(struct gk20a *g) | |||
2432 | 2432 | ||
2433 | gk20a_dbg_fn(""); | 2433 | gk20a_dbg_fn(""); |
2434 | 2434 | ||
2435 | gk20a_busy_noresume(g->dev); | 2435 | gk20a_busy_noresume(g); |
2436 | if (!g->power_on) | 2436 | if (!g->power_on) |
2437 | goto hw_was_off; | 2437 | goto hw_was_off; |
2438 | 2438 | ||
@@ -2461,7 +2461,7 @@ void gk20a_mm_cbc_clean(struct gk20a *g) | |||
2461 | nvgpu_mutex_release(&mm->l2_op_lock); | 2461 | nvgpu_mutex_release(&mm->l2_op_lock); |
2462 | 2462 | ||
2463 | hw_was_off: | 2463 | hw_was_off: |
2464 | gk20a_idle_nosuspend(g->dev); | 2464 | gk20a_idle_nosuspend(g); |
2465 | } | 2465 | } |
2466 | 2466 | ||
2467 | int nvgpu_vm_find_buf(struct vm_gk20a *vm, u64 gpu_va, | 2467 | int nvgpu_vm_find_buf(struct vm_gk20a *vm, u64 gpu_va, |