From 70bf8275efab7e155e9b3f9853a4cf7f38228c43 Mon Sep 17 00:00:00 2001 From: Kirill Artamonov Date: Mon, 12 Feb 2018 15:02:52 +0200 Subject: 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 Change-Id: I7fa64ce6912ae861244856807543b17bd7a26bed Reviewed-on: https://git-master.nvidia.com/r/1651517 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gv11b/gr_gv11b.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'drivers/gpu/nvgpu/gv11b/gr_gv11b.c') 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 @@ #include #include -#define GFXP_WFI_TIMEOUT_COUNT_IN_USEC_DEFAULT 1000 +#define GFXP_WFI_TIMEOUT_COUNT_IN_USEC_DEFAULT 100 /* ecc scrubbing will done in 1 pri read cycle,but for safety used 10 retries */ #define ECC_SCRUBBING_TIMEOUT_MAX 1000 @@ -1663,6 +1663,11 @@ void gr_gv11b_update_ctxsw_preemption_mode(struct gk20a *g, cbes_reserve), true); + gr_gk20a_ctx_patch_write(g, gr_ctx, + gr_fe_gfxp_wfi_timeout_r(), + g->gr.gfxp_wfi_timeout_count, + true); + gr_gk20a_ctx_patch_write_end(g, gr_ctx, true); } @@ -4099,17 +4104,19 @@ int gr_gv11b_init_preemption_state(struct gk20a *g) { u32 debug_2; struct gr_gk20a *gr = &g->gr; + u32 unit; nvgpu_log_fn(g, " "); - gk20a_writel(g, gr_fe_gfxp_wfi_timeout_r(), - gr_fe_gfxp_wfi_timeout_count_f( - gr->gfxp_wfi_timeout_count)); + if (gr->gfxp_wfi_timeout_unit == GFXP_WFI_TIMEOUT_UNIT_USEC) + unit = gr_debug_2_gfxp_wfi_timeout_unit_usec_f(); + else + unit = gr_debug_2_gfxp_wfi_timeout_unit_sysclk_f(); debug_2 = gk20a_readl(g, gr_debug_2_r()); debug_2 = set_field(debug_2, - gr_debug_2_gfxp_wfi_timeout_unit_m(), - gr_debug_2_gfxp_wfi_timeout_unit_usec_f()); + gr_debug_2_gfxp_wfi_timeout_unit_m(), + unit); gk20a_writel(g, gr_debug_2_r(), debug_2); return 0; @@ -4117,14 +4124,18 @@ int gr_gv11b_init_preemption_state(struct gk20a *g) void gr_gv11b_init_gfxp_wfi_timeout_count(struct gk20a *g) { struct gr_gk20a *gr = &g->gr; - + gr->gfxp_wfi_timeout_unit = GFXP_WFI_TIMEOUT_UNIT_USEC; gr->gfxp_wfi_timeout_count = GFXP_WFI_TIMEOUT_COUNT_IN_USEC_DEFAULT; } unsigned long gr_gv11b_get_max_gfxp_wfi_timeout_count(struct gk20a *g) { - /* 100 msec in usec count */ - return (100 * 1000UL); + if (g->gr.gfxp_wfi_timeout_unit == GFXP_WFI_TIMEOUT_UNIT_USEC) + /* 100 msec in usec count */ + return (100UL * 1000UL); + else + /* 100 msec for 1GHz clock */ + return (100UL * 1000UL * 1000UL); } static int gr_gv11b_ecc_scrub_is_done(struct gk20a *g, -- cgit v1.2.2