summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
diff options
context:
space:
mode:
authorKirill Artamonov <kartamonov@nvidia.com>2018-02-12 08:02:52 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-03-06 17:51:50 -0500
commit70bf8275efab7e155e9b3f9853a4cf7f38228c43 (patch)
treedd33a724d2e7a72d63197874372bd8a43bcd6a4c /drivers/gpu/nvgpu/gv11b/gr_gv11b.c
parentc363e1ebe6573dc1b0308fe40aedf158b0a28296 (diff)
gpu: nvgpu: gv11b: implement gfxp wfi controls
/sys/devices/gpu.0/gfxp_wfi_timeout_unit usec - microseconds sysclk - gpu clock count Treat gr_fe_gfxp_wfi_timeout_r as context-switched register on gv11b. Set default gfxp_wfi_timeout to 100 usec to match gp10b at 1GHz. bug 1888344 Signed-off-by: Kirill Artamonov <kartamonov@nvidia.com> Change-Id: I7fa64ce6912ae861244856807543b17bd7a26bed Reviewed-on: https://git-master.nvidia.com/r/1651517 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gv11b/gr_gv11b.c')
-rw-r--r--drivers/gpu/nvgpu/gv11b/gr_gv11b.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
index dee3b760..808cf19f 100644
--- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
@@ -56,7 +56,7 @@
56#include <nvgpu/hw/gv11b/hw_therm_gv11b.h> 56#include <nvgpu/hw/gv11b/hw_therm_gv11b.h>
57#include <nvgpu/hw/gv11b/hw_fb_gv11b.h> 57#include <nvgpu/hw/gv11b/hw_fb_gv11b.h>
58 58
59#define GFXP_WFI_TIMEOUT_COUNT_IN_USEC_DEFAULT 1000 59#define GFXP_WFI_TIMEOUT_COUNT_IN_USEC_DEFAULT 100
60 60
61/* ecc scrubbing will done in 1 pri read cycle,but for safety used 10 retries */ 61/* ecc scrubbing will done in 1 pri read cycle,but for safety used 10 retries */
62#define ECC_SCRUBBING_TIMEOUT_MAX 1000 62#define ECC_SCRUBBING_TIMEOUT_MAX 1000
@@ -1663,6 +1663,11 @@ void gr_gv11b_update_ctxsw_preemption_mode(struct gk20a *g,
1663 cbes_reserve), 1663 cbes_reserve),
1664 true); 1664 true);
1665 1665
1666 gr_gk20a_ctx_patch_write(g, gr_ctx,
1667 gr_fe_gfxp_wfi_timeout_r(),
1668 g->gr.gfxp_wfi_timeout_count,
1669 true);
1670
1666 gr_gk20a_ctx_patch_write_end(g, gr_ctx, true); 1671 gr_gk20a_ctx_patch_write_end(g, gr_ctx, true);
1667 } 1672 }
1668 1673
@@ -4099,17 +4104,19 @@ int gr_gv11b_init_preemption_state(struct gk20a *g)
4099{ 4104{
4100 u32 debug_2; 4105 u32 debug_2;
4101 struct gr_gk20a *gr = &g->gr; 4106 struct gr_gk20a *gr = &g->gr;
4107 u32 unit;
4102 4108
4103 nvgpu_log_fn(g, " "); 4109 nvgpu_log_fn(g, " ");
4104 4110
4105 gk20a_writel(g, gr_fe_gfxp_wfi_timeout_r(), 4111 if (gr->gfxp_wfi_timeout_unit == GFXP_WFI_TIMEOUT_UNIT_USEC)
4106 gr_fe_gfxp_wfi_timeout_count_f( 4112 unit = gr_debug_2_gfxp_wfi_timeout_unit_usec_f();
4107 gr->gfxp_wfi_timeout_count)); 4113 else
4114 unit = gr_debug_2_gfxp_wfi_timeout_unit_sysclk_f();
4108 4115
4109 debug_2 = gk20a_readl(g, gr_debug_2_r()); 4116 debug_2 = gk20a_readl(g, gr_debug_2_r());
4110 debug_2 = set_field(debug_2, 4117 debug_2 = set_field(debug_2,
4111 gr_debug_2_gfxp_wfi_timeout_unit_m(), 4118 gr_debug_2_gfxp_wfi_timeout_unit_m(),
4112 gr_debug_2_gfxp_wfi_timeout_unit_usec_f()); 4119 unit);
4113 gk20a_writel(g, gr_debug_2_r(), debug_2); 4120 gk20a_writel(g, gr_debug_2_r(), debug_2);
4114 4121
4115 return 0; 4122 return 0;
@@ -4117,14 +4124,18 @@ int gr_gv11b_init_preemption_state(struct gk20a *g)
4117void gr_gv11b_init_gfxp_wfi_timeout_count(struct gk20a *g) 4124void gr_gv11b_init_gfxp_wfi_timeout_count(struct gk20a *g)
4118{ 4125{
4119 struct gr_gk20a *gr = &g->gr; 4126 struct gr_gk20a *gr = &g->gr;
4120 4127 gr->gfxp_wfi_timeout_unit = GFXP_WFI_TIMEOUT_UNIT_USEC;
4121 gr->gfxp_wfi_timeout_count = GFXP_WFI_TIMEOUT_COUNT_IN_USEC_DEFAULT; 4128 gr->gfxp_wfi_timeout_count = GFXP_WFI_TIMEOUT_COUNT_IN_USEC_DEFAULT;
4122} 4129}
4123 4130
4124unsigned long gr_gv11b_get_max_gfxp_wfi_timeout_count(struct gk20a *g) 4131unsigned long gr_gv11b_get_max_gfxp_wfi_timeout_count(struct gk20a *g)
4125{ 4132{
4126 /* 100 msec in usec count */ 4133 if (g->gr.gfxp_wfi_timeout_unit == GFXP_WFI_TIMEOUT_UNIT_USEC)
4127 return (100 * 1000UL); 4134 /* 100 msec in usec count */
4135 return (100UL * 1000UL);
4136 else
4137 /* 100 msec for 1GHz clock */
4138 return (100UL * 1000UL * 1000UL);
4128} 4139}
4129 4140
4130static int gr_gv11b_ecc_scrub_is_done(struct gk20a *g, 4141static int gr_gv11b_ecc_scrub_is_done(struct gk20a *g,