diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gr_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 104 |
1 files changed, 7 insertions, 97 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 9e4d3c37..a4c1ce58 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c | |||
@@ -43,6 +43,8 @@ | |||
43 | #include <nvgpu/utils.h> | 43 | #include <nvgpu/utils.h> |
44 | #include <nvgpu/channel.h> | 44 | #include <nvgpu/channel.h> |
45 | #include <nvgpu/unit.h> | 45 | #include <nvgpu/unit.h> |
46 | #include <nvgpu/power_features/pg.h> | ||
47 | #include <nvgpu/power_features/cg.h> | ||
46 | 48 | ||
47 | #include "gk20a.h" | 49 | #include "gk20a.h" |
48 | #include "gr_gk20a.h" | 50 | #include "gr_gk20a.h" |
@@ -91,8 +93,6 @@ static void gr_gk20a_free_channel_patch_ctx(struct gk20a *g, | |||
91 | /* golden ctx image */ | 93 | /* golden ctx image */ |
92 | static int gr_gk20a_init_golden_ctx_image(struct gk20a *g, | 94 | static int gr_gk20a_init_golden_ctx_image(struct gk20a *g, |
93 | struct channel_gk20a *c); | 95 | struct channel_gk20a *c); |
94 | /*elcg init */ | ||
95 | static void gr_gk20a_enable_elcg(struct gk20a *g); | ||
96 | 96 | ||
97 | int gr_gk20a_get_ctx_id(struct gk20a *g, | 97 | int gr_gk20a_get_ctx_id(struct gk20a *g, |
98 | struct channel_gk20a *c, | 98 | struct channel_gk20a *c, |
@@ -4227,33 +4227,6 @@ int gk20a_gr_zbc_set_table(struct gk20a *g, struct gr_gk20a *gr, | |||
4227 | gr_gk20a_add_zbc(g, gr, zbc_val)); | 4227 | gr_gk20a_add_zbc(g, gr, zbc_val)); |
4228 | } | 4228 | } |
4229 | 4229 | ||
4230 | void gr_gk20a_init_cg_mode(struct gk20a *g, u32 cgmode, u32 mode_config) | ||
4231 | { | ||
4232 | u32 engine_idx; | ||
4233 | u32 active_engine_id = 0; | ||
4234 | struct fifo_engine_info_gk20a *engine_info = NULL; | ||
4235 | struct fifo_gk20a *f = &g->fifo; | ||
4236 | |||
4237 | for (engine_idx = 0; engine_idx < f->num_engines; ++engine_idx) { | ||
4238 | active_engine_id = f->active_engines_list[engine_idx]; | ||
4239 | engine_info = &f->engine_info[active_engine_id]; | ||
4240 | |||
4241 | /* gr_engine supports both BLCG and ELCG */ | ||
4242 | if ((cgmode == BLCG_MODE) && | ||
4243 | (engine_info->engine_enum == ENGINE_GR_GK20A)) { | ||
4244 | g->ops.therm.init_blcg_mode(g, mode_config, active_engine_id); | ||
4245 | break; | ||
4246 | } else if (cgmode == ELCG_MODE) { | ||
4247 | g->ops.therm.init_elcg_mode(g, mode_config, | ||
4248 | active_engine_id); | ||
4249 | } else { | ||
4250 | nvgpu_err(g, "invalid cg mode %d, config %d for " | ||
4251 | "act_eng_id %d", | ||
4252 | cgmode, mode_config, active_engine_id); | ||
4253 | } | ||
4254 | } | ||
4255 | } | ||
4256 | |||
4257 | void gr_gk20a_program_zcull_mapping(struct gk20a *g, u32 zcull_num_entries, | 4230 | void gr_gk20a_program_zcull_mapping(struct gk20a *g, u32 zcull_num_entries, |
4258 | u32 *zcull_map_tiles) | 4231 | u32 *zcull_map_tiles) |
4259 | { | 4232 | { |
@@ -4655,60 +4628,6 @@ out: | |||
4655 | return err; | 4628 | return err; |
4656 | } | 4629 | } |
4657 | 4630 | ||
4658 | static void gr_gk20a_load_gating_prod(struct gk20a *g) | ||
4659 | { | ||
4660 | nvgpu_log_fn(g, " "); | ||
4661 | |||
4662 | /* slcg prod values */ | ||
4663 | if (g->ops.clock_gating.slcg_bus_load_gating_prod) { | ||
4664 | g->ops.clock_gating.slcg_bus_load_gating_prod(g, | ||
4665 | g->slcg_enabled); | ||
4666 | } | ||
4667 | if (g->ops.clock_gating.slcg_chiplet_load_gating_prod) { | ||
4668 | g->ops.clock_gating.slcg_chiplet_load_gating_prod(g, | ||
4669 | g->slcg_enabled); | ||
4670 | } | ||
4671 | if (g->ops.clock_gating.slcg_gr_load_gating_prod) { | ||
4672 | g->ops.clock_gating.slcg_gr_load_gating_prod(g, | ||
4673 | g->slcg_enabled); | ||
4674 | } | ||
4675 | if (g->ops.clock_gating.slcg_ctxsw_firmware_load_gating_prod) { | ||
4676 | g->ops.clock_gating.slcg_ctxsw_firmware_load_gating_prod(g, | ||
4677 | g->slcg_enabled); | ||
4678 | } | ||
4679 | if (g->ops.clock_gating.slcg_perf_load_gating_prod) { | ||
4680 | g->ops.clock_gating.slcg_perf_load_gating_prod(g, | ||
4681 | g->slcg_enabled); | ||
4682 | } | ||
4683 | if (g->ops.clock_gating.slcg_xbar_load_gating_prod) { | ||
4684 | g->ops.clock_gating.slcg_xbar_load_gating_prod(g, | ||
4685 | g->slcg_enabled); | ||
4686 | } | ||
4687 | |||
4688 | /* blcg prod values */ | ||
4689 | if (g->ops.clock_gating.blcg_bus_load_gating_prod) { | ||
4690 | g->ops.clock_gating.blcg_bus_load_gating_prod(g, | ||
4691 | g->blcg_enabled); | ||
4692 | } | ||
4693 | if (g->ops.clock_gating.blcg_gr_load_gating_prod) { | ||
4694 | g->ops.clock_gating.blcg_gr_load_gating_prod(g, | ||
4695 | g->blcg_enabled); | ||
4696 | } | ||
4697 | if (g->ops.clock_gating.blcg_ctxsw_firmware_load_gating_prod) { | ||
4698 | g->ops.clock_gating.blcg_ctxsw_firmware_load_gating_prod(g, | ||
4699 | g->blcg_enabled); | ||
4700 | } | ||
4701 | if (g->ops.clock_gating.blcg_xbar_load_gating_prod) { | ||
4702 | g->ops.clock_gating.blcg_xbar_load_gating_prod(g, | ||
4703 | g->blcg_enabled); | ||
4704 | } | ||
4705 | if (g->ops.clock_gating.pg_gr_load_gating_prod) { | ||
4706 | g->ops.clock_gating.pg_gr_load_gating_prod(g, true); | ||
4707 | } | ||
4708 | |||
4709 | nvgpu_log_fn(g, "done"); | ||
4710 | } | ||
4711 | |||
4712 | static int gk20a_init_gr_prepare(struct gk20a *g) | 4631 | static int gk20a_init_gr_prepare(struct gk20a *g) |
4713 | { | 4632 | { |
4714 | u32 err = 0; | 4633 | u32 err = 0; |
@@ -4718,10 +4637,10 @@ static int gk20a_init_gr_prepare(struct gk20a *g) | |||
4718 | g->ops.mc.reset_mask(g, NVGPU_UNIT_BLG) | | 4637 | g->ops.mc.reset_mask(g, NVGPU_UNIT_BLG) | |
4719 | g->ops.mc.reset_mask(g, NVGPU_UNIT_PERFMON)); | 4638 | g->ops.mc.reset_mask(g, NVGPU_UNIT_PERFMON)); |
4720 | 4639 | ||
4721 | gr_gk20a_load_gating_prod(g); | 4640 | nvgpu_cg_init_gr_load_gating_prod(g); |
4722 | 4641 | ||
4723 | /* Disable elcg until it gets enabled later in the init*/ | 4642 | /* Disable elcg until it gets enabled later in the init*/ |
4724 | gr_gk20a_init_cg_mode(g, ELCG_MODE, ELCG_RUN); | 4643 | nvgpu_cg_elcg_disable(g); |
4725 | 4644 | ||
4726 | /* enable fifo access */ | 4645 | /* enable fifo access */ |
4727 | gk20a_writel(g, gr_gpfifo_ctl_r(), | 4646 | gk20a_writel(g, gr_gpfifo_ctl_r(), |
@@ -5041,7 +4960,7 @@ int gk20a_init_gr_support(struct gk20a *g) | |||
5041 | } | 4960 | } |
5042 | } | 4961 | } |
5043 | 4962 | ||
5044 | gr_gk20a_enable_elcg(g); | 4963 | nvgpu_cg_elcg_enable(g); |
5045 | /* GR is inialized, signal possible waiters */ | 4964 | /* GR is inialized, signal possible waiters */ |
5046 | g->gr.initialized = true; | 4965 | g->gr.initialized = true; |
5047 | nvgpu_cond_signal(&g->gr.init_wq); | 4966 | nvgpu_cond_signal(&g->gr.init_wq); |
@@ -5128,15 +5047,6 @@ int gk20a_enable_gr_hw(struct gk20a *g) | |||
5128 | return 0; | 5047 | return 0; |
5129 | } | 5048 | } |
5130 | 5049 | ||
5131 | static void gr_gk20a_enable_elcg(struct gk20a *g) | ||
5132 | { | ||
5133 | if (g->elcg_enabled) { | ||
5134 | gr_gk20a_init_cg_mode(g, ELCG_MODE, ELCG_AUTO); | ||
5135 | } else { | ||
5136 | gr_gk20a_init_cg_mode(g, ELCG_MODE, ELCG_RUN); | ||
5137 | } | ||
5138 | } | ||
5139 | |||
5140 | int gk20a_gr_reset(struct gk20a *g) | 5050 | int gk20a_gr_reset(struct gk20a *g) |
5141 | { | 5051 | { |
5142 | int err; | 5052 | int err; |
@@ -5193,8 +5103,8 @@ int gk20a_gr_reset(struct gk20a *g) | |||
5193 | return err; | 5103 | return err; |
5194 | } | 5104 | } |
5195 | 5105 | ||
5196 | gr_gk20a_load_gating_prod(g); | 5106 | nvgpu_cg_init_gr_load_gating_prod(g); |
5197 | gr_gk20a_enable_elcg(g); | 5107 | nvgpu_cg_elcg_enable(g); |
5198 | 5108 | ||
5199 | return err; | 5109 | return err; |
5200 | } | 5110 | } |