summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorseshendra Gadagottu <sgadagottu@nvidia.com>2017-11-15 17:35:43 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-11-29 16:17:18 -0500
commit7a4cb4a6ab6c861a94e9105360967894df749f03 (patch)
treeacfcfa1f607a66b18a579f7d06a48b7746abdabf
parentdda9d80a852e099a6304abb07936b4250cf1a141 (diff)
gpu: nvgpu: gv11b: gfxp wfi timeout
For gv11b, configured gfx preemption wfi timeout in usec. Set timeout unit as usec in gr_gv11b_init_preemption_state. Used default timeout as 1msec and this timeout value can be modified through sysfs node: /sys/devices/gpu.0/gfxp_wfi_timeout_count For gp10b: gfxp_wfi_timeout_count is in syclk cycles For gv11b: gfxp_wfi_timeout_count is in usec Bug 2003668 Change-Id: I68d52ce996a83df90b8b3a8164debb07e5cb370f Signed-off-by: seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1599658 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/common/linux/sysfs.c6
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c4
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c4
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h4
-rw-r--r--drivers/gpu/nvgpu/gk20a/gr_gk20a.c4
-rw-r--r--drivers/gpu/nvgpu/gp10b/gr_gp10b.c15
-rw-r--r--drivers/gpu/nvgpu/gp10b/gr_gp10b.h2
-rw-r--r--drivers/gpu/nvgpu/gp10b/hal_gp10b.c4
-rw-r--r--drivers/gpu/nvgpu/gv11b/gr_gv11b.c34
-rw-r--r--drivers/gpu/nvgpu/gv11b/gr_gv11b.h3
-rw-r--r--drivers/gpu/nvgpu/gv11b/hal_gv11b.c6
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/hw/gv11b/hw_gr_gv11b.h20
12 files changed, 100 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/sysfs.c b/drivers/gpu/nvgpu/common/linux/sysfs.c
index b1e7d1ed..053c1a12 100644
--- a/drivers/gpu/nvgpu/common/linux/sysfs.c
+++ b/drivers/gpu/nvgpu/common/linux/sysfs.c
@@ -965,8 +965,10 @@ static ssize_t gfxp_wfi_timeout_count_store(struct device *dev,
965 if (kstrtoul(buf, 10, &val) < 0) 965 if (kstrtoul(buf, 10, &val) < 0)
966 return -EINVAL; 966 return -EINVAL;
967 967
968 if (val >= 100*1000*1000) /* 100ms @ 1Ghz */ 968 if (g->ops.gr.get_max_gfxp_wfi_timeout_count) {
969 return -EINVAL; 969 if (val >= g->ops.gr.get_max_gfxp_wfi_timeout_count(g))
970 return -EINVAL;
971 }
970 972
971 gr->gfxp_wfi_timeout_count = val; 973 gr->gfxp_wfi_timeout_count = val;
972 974
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c
index b35cac90..acd0ad5d 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c
@@ -209,6 +209,10 @@ static const struct gpu_ops vgpu_gp10b_ops = {
209 .set_ctxsw_preemption_mode = 209 .set_ctxsw_preemption_mode =
210 vgpu_gr_gp10b_set_ctxsw_preemption_mode, 210 vgpu_gr_gp10b_set_ctxsw_preemption_mode,
211 .init_ctxsw_hdr_data = gr_gp10b_init_ctxsw_hdr_data, 211 .init_ctxsw_hdr_data = gr_gp10b_init_ctxsw_hdr_data,
212 .init_gfxp_wfi_timeout_count =
213 gr_gp10b_init_gfxp_wfi_timeout_count,
214 .get_max_gfxp_wfi_timeout_count =
215 gr_gp10b_get_max_gfxp_wfi_timeout_count,
212 }, 216 },
213 .fb = { 217 .fb = {
214 .reset = fb_gk20a_reset, 218 .reset = fb_gk20a_reset,
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c
index a7491b20..a470377c 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c
@@ -248,6 +248,10 @@ static const struct gpu_ops vgpu_gv11b_ops = {
248 gr_gv11b_handle_tpc_sm_ecc_exception, 248 gr_gv11b_handle_tpc_sm_ecc_exception,
249 .decode_egpc_addr = gv11b_gr_decode_egpc_addr, 249 .decode_egpc_addr = gv11b_gr_decode_egpc_addr,
250 .init_ctxsw_hdr_data = gr_gp10b_init_ctxsw_hdr_data, 250 .init_ctxsw_hdr_data = gr_gp10b_init_ctxsw_hdr_data,
251 .init_gfxp_wfi_timeout_count =
252 gr_gv11b_init_gfxp_wfi_timeout_count,
253 .get_max_gfxp_wfi_timeout_count =
254 gr_gv11b_get_max_gfxp_wfi_timeout_count,
251 }, 255 },
252 .fb = { 256 .fb = {
253 .reset = gv11b_fb_reset, 257 .reset = gv11b_fb_reset,
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 8f3900a1..a361648f 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -433,7 +433,9 @@ struct gpu_ops {
433 void (*disable_rd_coalesce)(struct gk20a *g); 433 void (*disable_rd_coalesce)(struct gk20a *g);
434 void (*init_ctxsw_hdr_data)(struct gk20a *g, 434 void (*init_ctxsw_hdr_data)(struct gk20a *g,
435 struct nvgpu_mem *mem); 435 struct nvgpu_mem *mem);
436 436 void (*init_gfxp_wfi_timeout_count)(struct gk20a *g);
437 unsigned long (*get_max_gfxp_wfi_timeout_count)
438 (struct gk20a *g);
437 } gr; 439 } gr;
438 struct { 440 struct {
439 void (*init_hw)(struct gk20a *g); 441 void (*init_hw)(struct gk20a *g);
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
index 64b54699..73b49927 100644
--- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
@@ -79,7 +79,6 @@
79#define CTXSW_MEM_SCRUBBING_TIMEOUT_DEFAULT 10 79#define CTXSW_MEM_SCRUBBING_TIMEOUT_DEFAULT 10
80#define FECS_ARB_CMD_TIMEOUT_MAX 40 80#define FECS_ARB_CMD_TIMEOUT_MAX 40
81#define FECS_ARB_CMD_TIMEOUT_DEFAULT 2 81#define FECS_ARB_CMD_TIMEOUT_DEFAULT 2
82#define GFXP_WFI_TIMEOUT_COUNT_DEFAULT 100000
83 82
84static int gk20a_init_gr_bind_fecs_elpg(struct gk20a *g); 83static int gk20a_init_gr_bind_fecs_elpg(struct gk20a *g);
85 84
@@ -4840,7 +4839,8 @@ static int gk20a_init_gr_setup_sw(struct gk20a *g)
4840 if (g->ops.gr.init_czf_bypass) 4839 if (g->ops.gr.init_czf_bypass)
4841 g->ops.gr.init_czf_bypass(g); 4840 g->ops.gr.init_czf_bypass(g);
4842 4841
4843 gr->gfxp_wfi_timeout_count = GFXP_WFI_TIMEOUT_COUNT_DEFAULT; 4842 if (g->ops.gr.init_gfxp_wfi_timeout_count)
4843 g->ops.gr.init_gfxp_wfi_timeout_count(g);
4844 4844
4845 nvgpu_mutex_init(&gr->ctx_mutex); 4845 nvgpu_mutex_init(&gr->ctx_mutex);
4846 nvgpu_spinlock_init(&gr->ch_tlb_lock); 4846 nvgpu_spinlock_init(&gr->ch_tlb_lock);
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c
index 27a42a45..c232c4ab 100644
--- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c
@@ -46,6 +46,8 @@
46#include <nvgpu/hw/gp10b/hw_mc_gp10b.h> 46#include <nvgpu/hw/gp10b/hw_mc_gp10b.h>
47#include <nvgpu/hw/gp10b/hw_fuse_gp10b.h> 47#include <nvgpu/hw/gp10b/hw_fuse_gp10b.h>
48 48
49#define GFXP_WFI_TIMEOUT_COUNT_DEFAULT 100000
50
49bool gr_gp10b_is_valid_class(struct gk20a *g, u32 class_num) 51bool gr_gp10b_is_valid_class(struct gk20a *g, u32 class_num)
50{ 52{
51 bool valid = false; 53 bool valid = false;
@@ -2351,3 +2353,16 @@ void gr_gp10b_init_ctxsw_hdr_data(struct gk20a *g, struct nvgpu_mem *mem)
2351 nvgpu_mem_wr(g, mem, 2353 nvgpu_mem_wr(g, mem,
2352 ctxsw_prog_main_image_num_cilp_save_ops_o(), 0); 2354 ctxsw_prog_main_image_num_cilp_save_ops_o(), 0);
2353} 2355}
2356
2357void gr_gp10b_init_gfxp_wfi_timeout_count(struct gk20a *g)
2358{
2359 struct gr_gk20a *gr = &g->gr;
2360
2361 gr->gfxp_wfi_timeout_count = GFXP_WFI_TIMEOUT_COUNT_DEFAULT;
2362}
2363
2364unsigned long gr_gp10b_get_max_gfxp_wfi_timeout_count(struct gk20a *g)
2365{
2366 /* 100msec @ 1GHZ */
2367 return (100 * 1000 * 1000UL);
2368}
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h
index 55117022..3b0f0f2e 100644
--- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h
+++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h
@@ -144,5 +144,7 @@ void gr_gp10b_set_preemption_buffer_va(struct gk20a *g,
144int gr_gp10b_set_czf_bypass(struct gk20a *g, struct channel_gk20a *ch); 144int gr_gp10b_set_czf_bypass(struct gk20a *g, struct channel_gk20a *ch);
145void gr_gp10b_init_czf_bypass(struct gk20a *g); 145void gr_gp10b_init_czf_bypass(struct gk20a *g);
146void gr_gp10b_init_ctxsw_hdr_data(struct gk20a *g, struct nvgpu_mem *mem); 146void gr_gp10b_init_ctxsw_hdr_data(struct gk20a *g, struct nvgpu_mem *mem);
147void gr_gp10b_init_gfxp_wfi_timeout_count(struct gk20a *g);
148unsigned long gr_gp10b_get_max_gfxp_wfi_timeout_count(struct gk20a *g);
147 149
148#endif 150#endif
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
index f13c2735..5ae6b638 100644
--- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
@@ -332,6 +332,10 @@ static const struct gpu_ops gp10b_ops = {
332 .create_gr_sysfs = gr_gp10b_create_sysfs, 332 .create_gr_sysfs = gr_gp10b_create_sysfs,
333 .set_ctxsw_preemption_mode = gr_gp10b_set_ctxsw_preemption_mode, 333 .set_ctxsw_preemption_mode = gr_gp10b_set_ctxsw_preemption_mode,
334 .init_ctxsw_hdr_data = gr_gp10b_init_ctxsw_hdr_data, 334 .init_ctxsw_hdr_data = gr_gp10b_init_ctxsw_hdr_data,
335 .init_gfxp_wfi_timeout_count =
336 gr_gp10b_init_gfxp_wfi_timeout_count,
337 .get_max_gfxp_wfi_timeout_count =
338 gr_gp10b_get_max_gfxp_wfi_timeout_count,
335 }, 339 },
336 .fb = { 340 .fb = {
337 .reset = fb_gk20a_reset, 341 .reset = fb_gk20a_reset,
diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
index f2397108..9d6d8d05 100644
--- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
@@ -54,6 +54,8 @@
54#include <nvgpu/hw/gv11b/hw_therm_gv11b.h> 54#include <nvgpu/hw/gv11b/hw_therm_gv11b.h>
55#include <nvgpu/hw/gv11b/hw_fb_gv11b.h> 55#include <nvgpu/hw/gv11b/hw_fb_gv11b.h>
56 56
57#define GFXP_WFI_TIMEOUT_COUNT_IN_USEC_DEFAULT 1000
58
57bool gr_gv11b_is_valid_class(struct gk20a *g, u32 class_num) 59bool gr_gv11b_is_valid_class(struct gk20a *g, u32 class_num)
58{ 60{
59 bool valid = false; 61 bool valid = false;
@@ -3625,3 +3627,35 @@ void gr_gv11b_init_gpc_mmu(struct gk20a *g)
3625 gk20a_writel(g, gr_gpcs_pri_mmu_debug_rd_r(), 3627 gk20a_writel(g, gr_gpcs_pri_mmu_debug_rd_r(),
3626 gk20a_readl(g, fb_mmu_debug_rd_r())); 3628 gk20a_readl(g, fb_mmu_debug_rd_r()));
3627} 3629}
3630
3631int gr_gv11b_init_preemption_state(struct gk20a *g)
3632{
3633 u32 debug_2;
3634 struct gr_gk20a *gr = &g->gr;
3635
3636 nvgpu_log_fn(g, " ");
3637
3638 gk20a_writel(g, gr_fe_gfxp_wfi_timeout_r(),
3639 gr_fe_gfxp_wfi_timeout_count_f(
3640 gr->gfxp_wfi_timeout_count));
3641
3642 debug_2 = gk20a_readl(g, gr_debug_2_r());
3643 debug_2 = set_field(debug_2,
3644 gr_debug_2_gfxp_wfi_timeout_unit_m(),
3645 gr_debug_2_gfxp_wfi_timeout_unit_usec_f());
3646 gk20a_writel(g, gr_debug_2_r(), debug_2);
3647
3648 return 0;
3649}
3650void gr_gv11b_init_gfxp_wfi_timeout_count(struct gk20a *g)
3651{
3652 struct gr_gk20a *gr = &g->gr;
3653
3654 gr->gfxp_wfi_timeout_count = GFXP_WFI_TIMEOUT_COUNT_IN_USEC_DEFAULT;
3655}
3656
3657unsigned long gr_gv11b_get_max_gfxp_wfi_timeout_count(struct gk20a *g)
3658{
3659 /* 100 msec in usec count */
3660 return (100 * 1000UL);
3661}
diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.h b/drivers/gpu/nvgpu/gv11b/gr_gv11b.h
index 1941f239..7c56f62d 100644
--- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.h
+++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.h
@@ -213,5 +213,8 @@ void gv11b_gr_egpc_etpc_priv_addr_table(struct gk20a *g, u32 addr,
213 u32 gpc, u32 broadcast_flags, u32 *priv_addr_table, u32 *t); 213 u32 gpc, u32 broadcast_flags, u32 *priv_addr_table, u32 *t);
214u32 gv11b_gr_get_egpc_base(struct gk20a *g); 214u32 gv11b_gr_get_egpc_base(struct gk20a *g);
215void gr_gv11b_init_gpc_mmu(struct gk20a *g); 215void gr_gv11b_init_gpc_mmu(struct gk20a *g);
216int gr_gv11b_init_preemption_state(struct gk20a *g);
217void gr_gv11b_init_gfxp_wfi_timeout_count(struct gk20a *g);
218unsigned long gr_gv11b_get_max_gfxp_wfi_timeout_count(struct gk20a *g);
216 219
217#endif 220#endif
diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
index 5649d758..e6cf0e62 100644
--- a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
@@ -361,7 +361,7 @@ static const struct gpu_ops gv11b_ops = {
361 .set_czf_bypass = NULL, 361 .set_czf_bypass = NULL,
362 .pre_process_sm_exception = gr_gv11b_pre_process_sm_exception, 362 .pre_process_sm_exception = gr_gv11b_pre_process_sm_exception,
363 .set_preemption_buffer_va = gr_gv11b_set_preemption_buffer_va, 363 .set_preemption_buffer_va = gr_gv11b_set_preemption_buffer_va,
364 .init_preemption_state = NULL, 364 .init_preemption_state = gr_gv11b_init_preemption_state,
365 .update_boosted_ctx = gr_gp10b_update_boosted_ctx, 365 .update_boosted_ctx = gr_gp10b_update_boosted_ctx,
366 .set_bes_crop_debug3 = gr_gp10b_set_bes_crop_debug3, 366 .set_bes_crop_debug3 = gr_gp10b_set_bes_crop_debug3,
367 .create_gr_sysfs = gr_gv11b_create_sysfs, 367 .create_gr_sysfs = gr_gv11b_create_sysfs,
@@ -388,6 +388,10 @@ static const struct gpu_ops gv11b_ops = {
388 gr_gv11b_handle_tpc_sm_ecc_exception, 388 gr_gv11b_handle_tpc_sm_ecc_exception,
389 .decode_egpc_addr = gv11b_gr_decode_egpc_addr, 389 .decode_egpc_addr = gv11b_gr_decode_egpc_addr,
390 .init_ctxsw_hdr_data = gr_gp10b_init_ctxsw_hdr_data, 390 .init_ctxsw_hdr_data = gr_gp10b_init_ctxsw_hdr_data,
391 .init_gfxp_wfi_timeout_count =
392 gr_gv11b_init_gfxp_wfi_timeout_count,
393 .get_max_gfxp_wfi_timeout_count =
394 gr_gv11b_get_max_gfxp_wfi_timeout_count,
391 }, 395 },
392 .fb = { 396 .fb = {
393 .reset = gv11b_fb_reset, 397 .reset = gv11b_fb_reset,
diff --git a/drivers/gpu/nvgpu/include/nvgpu/hw/gv11b/hw_gr_gv11b.h b/drivers/gpu/nvgpu/include/nvgpu/hw/gv11b/hw_gr_gv11b.h
index 692b7ba3..805d8b0e 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/hw/gv11b/hw_gr_gv11b.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/hw/gv11b/hw_gr_gv11b.h
@@ -4292,6 +4292,10 @@ static inline u32 gr_fe_gfxp_wfi_timeout_count_disabled_f(void)
4292{ 4292{
4293 return 0x0U; 4293 return 0x0U;
4294} 4294}
4295static inline u32 gr_fe_gfxp_wfi_timeout_count_init_f(void)
4296{
4297 return 0x800U;
4298}
4295static inline u32 gr_gpcs_tpcs_sm_texio_control_r(void) 4299static inline u32 gr_gpcs_tpcs_sm_texio_control_r(void)
4296{ 4300{
4297 return 0x00419bd8U; 4301 return 0x00419bd8U;
@@ -4936,4 +4940,20 @@ static inline u32 gr_fecs_falcon_ecc_uncorrected_err_count_unique_total_v(u32 r)
4936{ 4940{
4937 return (r >> 16U) & 0xffffU; 4941 return (r >> 16U) & 0xffffU;
4938} 4942}
4943static inline u32 gr_debug_2_r(void)
4944{
4945 return 0x00400088U;
4946}
4947static inline u32 gr_debug_2_gfxp_wfi_timeout_unit_m(void)
4948{
4949 return 0x1U << 27U;
4950}
4951static inline u32 gr_debug_2_gfxp_wfi_timeout_unit_usec_f(void)
4952{
4953 return 0x0U;
4954}
4955static inline u32 gr_debug_2_gfxp_wfi_timeout_unit_sysclk_f(void)
4956{
4957 return 0x8000000U;
4958}
4939#endif 4959#endif