diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-01-04 20:18:11 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-01-18 19:46:44 -0500 |
commit | 3f0e08da43a448d8a1a85529b03d4c073f8c11c5 (patch) | |
tree | b9b3c02593b8e6a1202a93b9d9b3064633d0c14b | |
parent | a674eeee419a68e27bec63e46200036f5f33c8ff (diff) |
gpu: nvgpu: Use timer API in gv11b's wait_idle()
The interface for wait_idle() was changed for gk20a, etc, so this
change is necessary to update the wait_idle function for gv11b.
Similarly for wait_fe() - this needs to no longer use an end_jiffie
argument.
Bug 1799159
Change-Id: I192159feffda5476269194e7d6ef15b5fe3055bd
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1280459
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/gr_gv11b.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c index 4c23455d..4984af46 100644 --- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c | |||
@@ -19,6 +19,8 @@ | |||
19 | #include <linux/tegra-fuse.h> | 19 | #include <linux/tegra-fuse.h> |
20 | #include <linux/version.h> | 20 | #include <linux/version.h> |
21 | 21 | ||
22 | #include <nvgpu/timers.h> | ||
23 | |||
22 | #include "gk20a/gr_gk20a.h" | 24 | #include "gk20a/gr_gk20a.h" |
23 | #include "gk20a/semaphore_gk20a.h" | 25 | #include "gk20a/semaphore_gk20a.h" |
24 | #include "gk20a/dbg_gpu_gk20a.h" | 26 | #include "gk20a/dbg_gpu_gk20a.h" |
@@ -1049,7 +1051,7 @@ static bool gr_activity_empty_or_preempted(u32 val) | |||
1049 | return true; | 1051 | return true; |
1050 | } | 1052 | } |
1051 | 1053 | ||
1052 | static int gr_gv11b_wait_empty(struct gk20a *g, unsigned long end_jiffies, | 1054 | static int gr_gv11b_wait_empty(struct gk20a *g, unsigned long duration_ms, |
1053 | u32 expect_delay) | 1055 | u32 expect_delay) |
1054 | { | 1056 | { |
1055 | u32 delay = expect_delay; | 1057 | u32 delay = expect_delay; |
@@ -1058,9 +1060,12 @@ static int gr_gv11b_wait_empty(struct gk20a *g, unsigned long end_jiffies, | |||
1058 | bool gr_busy; | 1060 | bool gr_busy; |
1059 | u32 gr_status; | 1061 | u32 gr_status; |
1060 | u32 activity0, activity1, activity2, activity4; | 1062 | u32 activity0, activity1, activity2, activity4; |
1063 | struct nvgpu_timeout timeout; | ||
1061 | 1064 | ||
1062 | gk20a_dbg_fn(""); | 1065 | gk20a_dbg_fn(""); |
1063 | 1066 | ||
1067 | nvgpu_timeout_init(g, &timeout, duration_ms, NVGPU_TIMER_CPU_TIMER); | ||
1068 | |||
1064 | do { | 1069 | do { |
1065 | /* fmodel: host gets fifo_engine_status(gr) from gr | 1070 | /* fmodel: host gets fifo_engine_status(gr) from gr |
1066 | only when gr_status is read */ | 1071 | only when gr_status is read */ |
@@ -1089,8 +1094,7 @@ static int gr_gv11b_wait_empty(struct gk20a *g, unsigned long end_jiffies, | |||
1089 | usleep_range(delay, delay * 2); | 1094 | usleep_range(delay, delay * 2); |
1090 | delay = min_t(u32, delay << 1, GR_IDLE_CHECK_MAX); | 1095 | delay = min_t(u32, delay << 1, GR_IDLE_CHECK_MAX); |
1091 | 1096 | ||
1092 | } while (time_before(jiffies, end_jiffies) | 1097 | } while (!nvgpu_timeout_expired(&timeout)); |
1093 | || !tegra_platform_is_silicon()); | ||
1094 | 1098 | ||
1095 | gk20a_err(dev_from_gk20a(g), | 1099 | gk20a_err(dev_from_gk20a(g), |
1096 | "timeout, ctxsw busy : %d, gr busy : %d, %08x, %08x, %08x, %08x", | 1100 | "timeout, ctxsw busy : %d, gr busy : %d, %08x, %08x, %08x, %08x", |
@@ -1634,8 +1638,6 @@ static void gv11b_write_bundle_veid_state(struct gk20a *g, u32 index) | |||
1634 | u32 j; | 1638 | u32 j; |
1635 | u32 num_subctx = nvgpu_get_litter_value(g, GPU_LIT_NUM_SUBCTX); | 1639 | u32 num_subctx = nvgpu_get_litter_value(g, GPU_LIT_NUM_SUBCTX); |
1636 | u32 err = 0; | 1640 | u32 err = 0; |
1637 | unsigned long end_jiffies = jiffies + | ||
1638 | msecs_to_jiffies(gk20a_get_gr_idle_timeout(g)); | ||
1639 | 1641 | ||
1640 | for (j = 0; j < num_subctx; j++) { | 1642 | for (j = 0; j < num_subctx; j++) { |
1641 | 1643 | ||
@@ -1643,8 +1645,8 @@ static void gv11b_write_bundle_veid_state(struct gk20a *g, u32 index) | |||
1643 | sw_veid_bundle_init->l[index].addr | | 1645 | sw_veid_bundle_init->l[index].addr | |
1644 | gr_pipe_bundle_address_veid_f(j)); | 1646 | gr_pipe_bundle_address_veid_f(j)); |
1645 | 1647 | ||
1646 | err = gr_gk20a_wait_fe_idle(g, end_jiffies, | 1648 | err = gr_gk20a_wait_fe_idle(g, gk20a_get_gr_idle_timeout(g), |
1647 | GR_IDLE_CHECK_DEFAULT); | 1649 | GR_IDLE_CHECK_DEFAULT); |
1648 | } | 1650 | } |
1649 | } | 1651 | } |
1650 | 1652 | ||
@@ -1655,8 +1657,6 @@ static int gr_gv11b_init_sw_veid_bundle(struct gk20a *g) | |||
1655 | u32 i; | 1657 | u32 i; |
1656 | u32 last_bundle_data = 0; | 1658 | u32 last_bundle_data = 0; |
1657 | u32 err = 0; | 1659 | u32 err = 0; |
1658 | unsigned long end_jiffies = jiffies + | ||
1659 | msecs_to_jiffies(gk20a_get_gr_idle_timeout(g)); | ||
1660 | 1660 | ||
1661 | gk20a_dbg_fn(""); | 1661 | gk20a_dbg_fn(""); |
1662 | for (i = 0; i < sw_veid_bundle_init->count; i++) { | 1662 | for (i = 0; i < sw_veid_bundle_init->count; i++) { |
@@ -1672,8 +1672,9 @@ static int gr_gv11b_init_sw_veid_bundle(struct gk20a *g) | |||
1672 | sw_veid_bundle_init->l[i].addr) == GR_GO_IDLE_BUNDLE) { | 1672 | sw_veid_bundle_init->l[i].addr) == GR_GO_IDLE_BUNDLE) { |
1673 | gk20a_writel(g, gr_pipe_bundle_address_r(), | 1673 | gk20a_writel(g, gr_pipe_bundle_address_r(), |
1674 | sw_veid_bundle_init->l[i].addr); | 1674 | sw_veid_bundle_init->l[i].addr); |
1675 | err |= gr_gk20a_wait_idle(g, end_jiffies, | 1675 | err |= gr_gk20a_wait_idle(g, |
1676 | GR_IDLE_CHECK_DEFAULT); | 1676 | gk20a_get_gr_idle_timeout(g), |
1677 | GR_IDLE_CHECK_DEFAULT); | ||
1677 | } else | 1678 | } else |
1678 | gv11b_write_bundle_veid_state(g, i); | 1679 | gv11b_write_bundle_veid_state(g, i); |
1679 | 1680 | ||