From d60a45b9fdd935c5e0c29c2cc3c056e0ce8c9873 Mon Sep 17 00:00:00 2001 From: Vijayakumar Date: Thu, 29 Jan 2015 16:43:13 +0530 Subject: gpu: nvgpu: scale ptimer based timeouts bug 1603226 host based timeouts use ptimer for detecting timeouts. on gk20a and gm20b ptimer runs 2.6x slower. scale the fifo_eng_timeout to account for this Change-Id: Ie44718382953e36436ea47d6e89b9a225d5c2070 Signed-off-by: Vijayakumar Reviewed-on: http://git-master/r/799983 (cherry picked from commit d1d837fd09ff0f035feff1757c67488404c23cc6) Reviewed-on: http://git-master/r/808250 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 6 ++++-- drivers/gpu/nvgpu/gk20a/gk20a.h | 7 +++++++ drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 3 +++ drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c | 2 ++ drivers/gpu/nvgpu/gm20b/hal_gm20b.c | 1 - 5 files changed, 16 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index f736fe8c..ae36478e 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c @@ -344,6 +344,7 @@ int gk20a_init_fifo_reset_enable_hw(struct gk20a *g) u32 mask; u32 timeout; int i; + struct gk20a_platform *platform = platform_get_drvdata(g->dev); gk20a_dbg_fn(""); /* enable pmc pfifo */ @@ -408,8 +409,9 @@ int gk20a_init_fifo_reset_enable_hw(struct gk20a *g) if (g->ops.fifo.apply_pb_timeout) g->ops.fifo.apply_pb_timeout(g); - timeout = GRFIFO_TIMEOUT_CHECK_PERIOD_US | - fifo_eng_timeout_detection_enabled_f(); + timeout = GRFIFO_TIMEOUT_CHECK_PERIOD_US; + timeout = scale_ptimer(timeout, platform->ptimerscaling10x); + timeout |= fifo_eng_timeout_detection_enabled_f(); gk20a_writel(g, fifo_eng_timeout_r(), timeout); gk20a_dbg_fn("done"); diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index f107d83d..8290e7e7 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -886,4 +886,11 @@ void gk20a_user_deinit(struct platform_device *dev); extern void gk20a_debug_dump_device(struct platform_device *pdev); +static inline u32 scale_ptimer(u32 timeout , u32 scale10x) +{ + if (((timeout*10) % scale10x) >= (scale10x/2)) + return ((timeout * 10) / scale10x) + 1; + else + return (timeout * 10) / scale10x; +} #endif /* GK20A_H */ diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h index 46f83d6d..adacdb6b 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h @@ -94,6 +94,9 @@ struct gk20a_platform { /* Default big page size 64K or 128K */ u32 default_big_page_size; + /* scaling factor for ptimer */ + u32 ptimerscaling10x; + /* Initialize the platform interface of the gk20a driver. * * The platform implementation of this function must diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c index f8e1e3b7..73e7303e 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c @@ -812,6 +812,7 @@ struct gk20a_platform gk20a_tegra_platform = { .enable_elcg = true, .enable_elpg = true, .enable_aelpg = true, + .ptimerscaling10x = 26, .force_reset_in_do_idle = false, @@ -858,6 +859,7 @@ struct gk20a_platform gm20b_tegra_platform = { .enable_elcg = true, .enable_elpg = true, .enable_aelpg = true, + .ptimerscaling10x = 26, .force_reset_in_do_idle = false, diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c index e32f8943..edd70f13 100644 --- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c @@ -120,7 +120,6 @@ int gm20b_init_hal(struct gk20a *g) } } #endif - gm20b_init_mc(gops); gm20b_init_ltc(gops); gm20b_init_gr(gops); -- cgit v1.2.2