diff options
author | Alex Waterman <alexw@nvidia.com> | 2016-12-16 15:29:34 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-01-18 19:46:33 -0500 |
commit | 6e2237ef622113b8fa1149aa48988a99fa30594f (patch) | |
tree | 1356c45dda5751f7094f37aa93019f1199b635fb /drivers/gpu/nvgpu/gp10b/gr_gp10b.c | |
parent | 8f5a42c4bf9c323b86452065d39ed7632b126561 (diff) |
gpu: nvgpu: Use timer API in gk20a code
Use the timers API in the gk20a code instead of Linux specific
API calls.
This also changes the behavior of several functions to wait for
the full timeout for each operation that can timeout. Previously
the timeout was shared across each operation.
Bug 1799159
Change-Id: I2bbed54630667b2b879b56a63a853266afc1e5d8
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1273826
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b/gr_gp10b.c')
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/gr_gp10b.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c index 93d7dcbd..7eceb2a4 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c | |||
@@ -31,6 +31,8 @@ | |||
31 | #include "gp10b/gr_gp10b.h" | 31 | #include "gp10b/gr_gp10b.h" |
32 | #include "gp10b_sysfs.h" | 32 | #include "gp10b_sysfs.h" |
33 | 33 | ||
34 | #include <nvgpu/timers.h> | ||
35 | |||
34 | #include <nvgpu/hw/gp10b/hw_gr_gp10b.h> | 36 | #include <nvgpu/hw/gp10b/hw_gr_gp10b.h> |
35 | #include <nvgpu/hw/gp10b/hw_fifo_gp10b.h> | 37 | #include <nvgpu/hw/gp10b/hw_fifo_gp10b.h> |
36 | #include <nvgpu/hw/gp10b/hw_ctxsw_prog_gp10b.h> | 38 | #include <nvgpu/hw/gp10b/hw_ctxsw_prog_gp10b.h> |
@@ -1353,8 +1355,8 @@ static bool gr_activity_empty_or_preempted(u32 val) | |||
1353 | return true; | 1355 | return true; |
1354 | } | 1356 | } |
1355 | 1357 | ||
1356 | static int gr_gp10b_wait_empty(struct gk20a *g, unsigned long end_jiffies, | 1358 | static int gr_gp10b_wait_empty(struct gk20a *g, unsigned long duration_ms, |
1357 | u32 expect_delay) | 1359 | u32 expect_delay) |
1358 | { | 1360 | { |
1359 | u32 delay = expect_delay; | 1361 | u32 delay = expect_delay; |
1360 | bool gr_enabled; | 1362 | bool gr_enabled; |
@@ -1362,9 +1364,12 @@ static int gr_gp10b_wait_empty(struct gk20a *g, unsigned long end_jiffies, | |||
1362 | bool gr_busy; | 1364 | bool gr_busy; |
1363 | u32 gr_status; | 1365 | u32 gr_status; |
1364 | u32 activity0, activity1, activity2, activity4; | 1366 | u32 activity0, activity1, activity2, activity4; |
1367 | struct nvgpu_timeout timeout; | ||
1365 | 1368 | ||
1366 | gk20a_dbg_fn(""); | 1369 | gk20a_dbg_fn(""); |
1367 | 1370 | ||
1371 | nvgpu_timeout_init(g, &timeout, duration_ms, NVGPU_TIMER_CPU_TIMER); | ||
1372 | |||
1368 | do { | 1373 | do { |
1369 | /* fmodel: host gets fifo_engine_status(gr) from gr | 1374 | /* fmodel: host gets fifo_engine_status(gr) from gr |
1370 | only when gr_status is read */ | 1375 | only when gr_status is read */ |
@@ -1392,9 +1397,7 @@ static int gr_gp10b_wait_empty(struct gk20a *g, unsigned long end_jiffies, | |||
1392 | 1397 | ||
1393 | usleep_range(delay, delay * 2); | 1398 | usleep_range(delay, delay * 2); |
1394 | delay = min_t(u32, delay << 1, GR_IDLE_CHECK_MAX); | 1399 | delay = min_t(u32, delay << 1, GR_IDLE_CHECK_MAX); |
1395 | 1400 | } while (!nvgpu_timeout_expired(&timeout)); | |
1396 | } while (time_before(jiffies, end_jiffies) | ||
1397 | || !tegra_platform_is_silicon()); | ||
1398 | 1401 | ||
1399 | gk20a_err(dev_from_gk20a(g), | 1402 | gk20a_err(dev_from_gk20a(g), |
1400 | "timeout, ctxsw busy : %d, gr busy : %d, %08x, %08x, %08x, %08x", | 1403 | "timeout, ctxsw busy : %d, gr busy : %d, %08x, %08x, %08x, %08x", |