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/gk20a/dbg_gpu_gk20a.c | |
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/gk20a/dbg_gpu_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | 59 |
1 files changed, 14 insertions, 45 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c index adc13c3d..1686d01e 100644 --- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Tegra GK20A GPU Debugger/Profiler Driver | 2 | * Tegra GK20A GPU Debugger/Profiler Driver |
3 | * | 3 | * |
4 | * Copyright (c) 2013-2018, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2013-2019, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
7 | * copy of this software and associated documentation files (the "Software"), | 7 | * copy of this software and associated documentation files (the "Software"), |
@@ -32,6 +32,7 @@ | |||
32 | #include <nvgpu/utils.h> | 32 | #include <nvgpu/utils.h> |
33 | #include <nvgpu/channel.h> | 33 | #include <nvgpu/channel.h> |
34 | #include <nvgpu/unit.h> | 34 | #include <nvgpu/unit.h> |
35 | #include <nvgpu/power_features/power_features.h> | ||
35 | 36 | ||
36 | #include "gk20a.h" | 37 | #include "gk20a.h" |
37 | #include "gr_gk20a.h" | 38 | #include "gr_gk20a.h" |
@@ -234,60 +235,28 @@ int dbg_set_powergate(struct dbg_session_gk20a *dbg_s, bool disable_powergate) | |||
234 | return err; | 235 | return err; |
235 | } | 236 | } |
236 | 237 | ||
237 | /*do elpg disable before clock gating */ | 238 | err = nvgpu_cg_pg_disable(g); |
238 | nvgpu_pmu_pg_global_enable(g, false); | ||
239 | 239 | ||
240 | if (g->ops.clock_gating.slcg_gr_load_gating_prod) { | 240 | if (err == 0) { |
241 | g->ops.clock_gating.slcg_gr_load_gating_prod(g, | 241 | dbg_s->is_pg_disabled = true; |
242 | false); | 242 | nvgpu_log(g, gpu_dbg_gpu_dbg | gpu_dbg_fn, |
243 | "pg disabled"); | ||
243 | } | 244 | } |
244 | if (g->ops.clock_gating.slcg_perf_load_gating_prod) { | ||
245 | g->ops.clock_gating.slcg_perf_load_gating_prod(g, | ||
246 | false); | ||
247 | } | ||
248 | if (g->ops.clock_gating.slcg_ltc_load_gating_prod) { | ||
249 | g->ops.clock_gating.slcg_ltc_load_gating_prod(g, | ||
250 | false); | ||
251 | } | ||
252 | |||
253 | gr_gk20a_init_cg_mode(g, BLCG_MODE, BLCG_RUN); | ||
254 | gr_gk20a_init_cg_mode(g, ELCG_MODE, ELCG_RUN); | ||
255 | |||
256 | dbg_s->is_pg_disabled = true; | ||
257 | } else { | 245 | } else { |
258 | /* restore (can) powergate, clk state */ | 246 | /* restore (can) powergate, clk state */ |
259 | /* release pending exceptions to fault/be handled as usual */ | 247 | /* release pending exceptions to fault/be handled as usual */ |
260 | /*TBD: ordering of these? */ | 248 | /*TBD: ordering of these? */ |
261 | 249 | ||
262 | if (g->elcg_enabled) { | 250 | err = nvgpu_cg_pg_enable(g); |
263 | gr_gk20a_init_cg_mode(g, ELCG_MODE, ELCG_AUTO); | ||
264 | } | ||
265 | 251 | ||
266 | if (g->blcg_enabled) { | 252 | nvgpu_log(g, gpu_dbg_gpu_dbg | gpu_dbg_fn, "module idle"); |
267 | gr_gk20a_init_cg_mode(g, BLCG_MODE, BLCG_AUTO); | ||
268 | } | ||
269 | |||
270 | if (g->slcg_enabled) { | ||
271 | if (g->ops.clock_gating.slcg_ltc_load_gating_prod) { | ||
272 | g->ops.clock_gating.slcg_ltc_load_gating_prod(g, | ||
273 | g->slcg_enabled); | ||
274 | } | ||
275 | if (g->ops.clock_gating.slcg_perf_load_gating_prod) { | ||
276 | g->ops.clock_gating.slcg_perf_load_gating_prod(g, | ||
277 | g->slcg_enabled); | ||
278 | } | ||
279 | if (g->ops.clock_gating.slcg_gr_load_gating_prod) { | ||
280 | g->ops.clock_gating.slcg_gr_load_gating_prod(g, | ||
281 | g->slcg_enabled); | ||
282 | } | ||
283 | } | ||
284 | nvgpu_pmu_pg_global_enable(g, true); | ||
285 | |||
286 | nvgpu_log(g, gpu_dbg_gpu_dbg | gpu_dbg_fn, | ||
287 | "module idle"); | ||
288 | gk20a_idle(g); | 253 | gk20a_idle(g); |
289 | 254 | ||
290 | dbg_s->is_pg_disabled = false; | 255 | if (err == 0) { |
256 | dbg_s->is_pg_disabled = false; | ||
257 | nvgpu_log(g, gpu_dbg_gpu_dbg | gpu_dbg_fn, | ||
258 | "pg enabled"); | ||
259 | } | ||
291 | } | 260 | } |
292 | 261 | ||
293 | nvgpu_log(g, gpu_dbg_fn|gpu_dbg_gpu_dbg, "%s powergate mode = %s done", | 262 | nvgpu_log(g, gpu_dbg_fn|gpu_dbg_gpu_dbg, "%s powergate mode = %s done", |