diff options
author | Debarshi Dutta <ddutta@nvidia.com> | 2019-04-30 04:24:08 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2019-05-09 17:41:30 -0400 |
commit | c81cc032c48a1b25e095b17b77399166c9091ff3 (patch) | |
tree | ace7d238c55bbb5e96fb6fd74deb156f3c513bae /drivers/gpu/nvgpu/gv11b | |
parent | f495f52c70c6bd7b7a4e6897270e4696efa57d5c (diff) |
gpu: nvgpu: add cg and pg function
Add new power/clock gating functions that can be called by
other units.
New clock_gating functions will reside in cg.c under
common/power_features/cg unit.
New power gating functions will reside in pg.c under
common/power_features/pg unit.
Use nvgpu_pg_elpg_disable and nvgpu_pg_elpg_enable to disable/enable
elpg and also in gr_gk20a_elpg_protected macro to access gr registers.
Add cg_pg_lock to make elpg_enabled, elcg_enabled, blcg_enabled
and slcg_enabled thread safe.
JIRA NVGPU-2014
Change-Id: I00d124c2ee16242c9a3ef82e7620fbb7f1297aff
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2025493
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
(cherry-picked from c90585856567a547173a8b207365b3a4a3ccdd57 in
dev-kernel)
Reviewed-on: https://git-master.nvidia.com/r/2108406
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gv11b')
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/fifo_gv11b.c | 45 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/pmu_gv11b.c | 2 |
2 files changed, 15 insertions, 32 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c index 5b84df47..b3c59f84 100644 --- a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c | |||
@@ -43,6 +43,8 @@ | |||
43 | #include <nvgpu/gk20a.h> | 43 | #include <nvgpu/gk20a.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/cg.h> | ||
47 | #include <nvgpu/power_features/power_features.h> | ||
46 | 48 | ||
47 | #include "gk20a/fifo_gk20a.h" | 49 | #include "gk20a/fifo_gk20a.h" |
48 | 50 | ||
@@ -1095,25 +1097,11 @@ void gv11b_fifo_teardown_ch_tsg(struct gk20a *g, u32 act_eng_bitmask, | |||
1095 | g->fifo.deferred_reset_pending = false; | 1097 | g->fifo.deferred_reset_pending = false; |
1096 | 1098 | ||
1097 | /* Disable power management */ | 1099 | /* Disable power management */ |
1098 | if (g->support_pmu && g->elpg_enabled) { | 1100 | if (g->support_pmu) { |
1099 | if (nvgpu_pmu_disable_elpg(g)) { | 1101 | if (nvgpu_cg_pg_disable(g) != 0) { |
1100 | nvgpu_err(g, "failed to set disable elpg"); | 1102 | nvgpu_warn(g, "fail to disable power mgmt"); |
1101 | } | 1103 | } |
1102 | } | 1104 | } |
1103 | if (g->ops.clock_gating.slcg_gr_load_gating_prod) { | ||
1104 | g->ops.clock_gating.slcg_gr_load_gating_prod(g, | ||
1105 | false); | ||
1106 | } | ||
1107 | if (g->ops.clock_gating.slcg_perf_load_gating_prod) { | ||
1108 | g->ops.clock_gating.slcg_perf_load_gating_prod(g, | ||
1109 | false); | ||
1110 | } | ||
1111 | if (g->ops.clock_gating.slcg_ltc_load_gating_prod) { | ||
1112 | g->ops.clock_gating.slcg_ltc_load_gating_prod(g, | ||
1113 | false); | ||
1114 | } | ||
1115 | |||
1116 | gr_gk20a_init_cg_mode(g, ELCG_MODE, ELCG_RUN); | ||
1117 | 1105 | ||
1118 | if (rc_type == RC_TYPE_MMU_FAULT) { | 1106 | if (rc_type == RC_TYPE_MMU_FAULT) { |
1119 | gk20a_debug_dump(g); | 1107 | gk20a_debug_dump(g); |
@@ -1220,8 +1208,10 @@ void gv11b_fifo_teardown_ch_tsg(struct gk20a *g, u32 act_eng_bitmask, | |||
1220 | gk20a_fifo_set_runlist_state(g, runlists_mask, RUNLIST_ENABLED); | 1208 | gk20a_fifo_set_runlist_state(g, runlists_mask, RUNLIST_ENABLED); |
1221 | 1209 | ||
1222 | /* It is safe to enable ELPG again. */ | 1210 | /* It is safe to enable ELPG again. */ |
1223 | if (g->support_pmu && g->elpg_enabled) { | 1211 | if (g->support_pmu) { |
1224 | nvgpu_pmu_enable_elpg(g); | 1212 | if (nvgpu_cg_pg_enable(g) != 0) { |
1213 | nvgpu_warn(g, "fail to enable power mgmt"); | ||
1214 | } | ||
1225 | } | 1215 | } |
1226 | 1216 | ||
1227 | g->ops.fifo.teardown_unmask_intr(g); | 1217 | g->ops.fifo.teardown_unmask_intr(g); |
@@ -1312,18 +1302,11 @@ int gv11b_init_fifo_reset_enable_hw(struct gk20a *g) | |||
1312 | /* enable pmc pfifo */ | 1302 | /* enable pmc pfifo */ |
1313 | g->ops.mc.reset(g, g->ops.mc.reset_mask(g, NVGPU_UNIT_FIFO)); | 1303 | g->ops.mc.reset(g, g->ops.mc.reset_mask(g, NVGPU_UNIT_FIFO)); |
1314 | 1304 | ||
1315 | if (g->ops.clock_gating.slcg_ce2_load_gating_prod) { | 1305 | nvgpu_cg_slcg_ce2_load_enable(g); |
1316 | g->ops.clock_gating.slcg_ce2_load_gating_prod(g, | 1306 | |
1317 | g->slcg_enabled); | 1307 | nvgpu_cg_slcg_fifo_load_enable(g); |
1318 | } | 1308 | |
1319 | if (g->ops.clock_gating.slcg_fifo_load_gating_prod) { | 1309 | nvgpu_cg_blcg_fifo_load_enable(g); |
1320 | g->ops.clock_gating.slcg_fifo_load_gating_prod(g, | ||
1321 | g->slcg_enabled); | ||
1322 | } | ||
1323 | if (g->ops.clock_gating.blcg_fifo_load_gating_prod) { | ||
1324 | g->ops.clock_gating.blcg_fifo_load_gating_prod(g, | ||
1325 | g->blcg_enabled); | ||
1326 | } | ||
1327 | 1310 | ||
1328 | timeout = gk20a_readl(g, fifo_fb_timeout_r()); | 1311 | timeout = gk20a_readl(g, fifo_fb_timeout_r()); |
1329 | nvgpu_log_info(g, "fifo_fb_timeout reg val = 0x%08x", timeout); | 1312 | nvgpu_log_info(g, "fifo_fb_timeout reg val = 0x%08x", timeout); |
diff --git a/drivers/gpu/nvgpu/gv11b/pmu_gv11b.c b/drivers/gpu/nvgpu/gv11b/pmu_gv11b.c index a9f183b1..1001ba16 100644 --- a/drivers/gpu/nvgpu/gv11b/pmu_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/pmu_gv11b.c | |||
@@ -124,7 +124,7 @@ int gv11b_pmu_setup_elpg(struct gk20a *g) | |||
124 | 124 | ||
125 | nvgpu_log_fn(g, " "); | 125 | nvgpu_log_fn(g, " "); |
126 | 126 | ||
127 | if (g->elpg_enabled) { | 127 | if (g->can_elpg && g->elpg_enabled) { |
128 | reg_writes = ((sizeof(_pginitseq_gv11b) / | 128 | reg_writes = ((sizeof(_pginitseq_gv11b) / |
129 | sizeof((_pginitseq_gv11b)[0]))); | 129 | sizeof((_pginitseq_gv11b)[0]))); |
130 | /* Initialize registers with production values*/ | 130 | /* Initialize registers with production values*/ |