summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a
diff options
context:
space:
mode:
authorDebarshi Dutta <ddutta@nvidia.com>2019-04-30 04:24:08 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2019-05-09 17:41:30 -0400
commitc81cc032c48a1b25e095b17b77399166c9091ff3 (patch)
treeace7d238c55bbb5e96fb6fd74deb156f3c513bae /drivers/gpu/nvgpu/gk20a
parentf495f52c70c6bd7b7a4e6897270e4696efa57d5c (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')
-rw-r--r--drivers/gpu/nvgpu/gk20a/ce2_gk20a.c12
-rw-r--r--drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c59
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.c49
-rw-r--r--drivers/gpu/nvgpu/gk20a/gr_gk20a.c104
-rw-r--r--drivers/gpu/nvgpu/gk20a/gr_gk20a.h11
5 files changed, 49 insertions, 186 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c
index 6df8f6e4..5052fc35 100644
--- a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c
@@ -30,6 +30,7 @@
30#include <nvgpu/io.h> 30#include <nvgpu/io.h>
31#include <nvgpu/utils.h> 31#include <nvgpu/utils.h>
32#include <nvgpu/channel.h> 32#include <nvgpu/channel.h>
33#include <nvgpu/power_features/cg.h>
33 34
34#include "gk20a.h" 35#include "gk20a.h"
35#include "gk20a/fence_gk20a.h" 36#include "gk20a/fence_gk20a.h"
@@ -339,14 +340,9 @@ int gk20a_init_ce_support(struct gk20a *g)
339 340
340 g->ops.mc.reset(g, ce_reset_mask); 341 g->ops.mc.reset(g, ce_reset_mask);
341 342
342 if (g->ops.clock_gating.slcg_ce2_load_gating_prod) { 343 nvgpu_cg_slcg_ce2_load_enable(g);
343 g->ops.clock_gating.slcg_ce2_load_gating_prod(g, 344
344 g->slcg_enabled); 345 nvgpu_cg_blcg_ce_load_enable(g);
345 }
346 if (g->ops.clock_gating.blcg_ce_load_gating_prod) {
347 g->ops.clock_gating.blcg_ce_load_gating_prod(g,
348 g->blcg_enabled);
349 }
350 346
351 if (ce_app->initialised) { 347 if (ce_app->initialised) {
352 /* assume this happen during poweron/poweroff GPU sequence */ 348 /* assume this happen during poweron/poweroff GPU sequence */
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",
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
index 78f777ae..6d89940a 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
@@ -45,6 +45,8 @@
45#include <nvgpu/utils.h> 45#include <nvgpu/utils.h>
46#include <nvgpu/channel.h> 46#include <nvgpu/channel.h>
47#include <nvgpu/unit.h> 47#include <nvgpu/unit.h>
48#include <nvgpu/power_features/power_features.h>
49#include <nvgpu/power_features/cg.h>
48 50
49#include "gk20a.h" 51#include "gk20a.h"
50#include "mm_gk20a.h" 52#include "mm_gk20a.h"
@@ -824,14 +826,9 @@ int gk20a_init_fifo_reset_enable_hw(struct gk20a *g)
824 /* enable pmc pfifo */ 826 /* enable pmc pfifo */
825 g->ops.mc.reset(g, g->ops.mc.reset_mask(g, NVGPU_UNIT_FIFO)); 827 g->ops.mc.reset(g, g->ops.mc.reset_mask(g, NVGPU_UNIT_FIFO));
826 828
827 if (g->ops.clock_gating.slcg_fifo_load_gating_prod) { 829 nvgpu_cg_slcg_fifo_load_enable(g);
828 g->ops.clock_gating.slcg_fifo_load_gating_prod(g, 830
829 g->slcg_enabled); 831 nvgpu_cg_blcg_fifo_load_enable(g);
830 }
831 if (g->ops.clock_gating.blcg_fifo_load_gating_prod) {
832 g->ops.clock_gating.blcg_fifo_load_gating_prod(g,
833 g->blcg_enabled);
834 }
835 832
836 timeout = gk20a_readl(g, fifo_fb_timeout_r()); 833 timeout = gk20a_readl(g, fifo_fb_timeout_r());
837 timeout = set_field(timeout, fifo_fb_timeout_period_m(), 834 timeout = set_field(timeout, fifo_fb_timeout_period_m(),
@@ -1361,8 +1358,8 @@ void gk20a_fifo_reset_engine(struct gk20a *g, u32 engine_id)
1361 } 1358 }
1362 1359
1363 if (engine_enum == ENGINE_GR_GK20A) { 1360 if (engine_enum == ENGINE_GR_GK20A) {
1364 if (g->support_pmu && g->can_elpg) { 1361 if (g->support_pmu) {
1365 if (nvgpu_pmu_disable_elpg(g)) { 1362 if (nvgpu_pg_elpg_disable(g) != 0 ) {
1366 nvgpu_err(g, "failed to set disable elpg"); 1363 nvgpu_err(g, "failed to set disable elpg");
1367 } 1364 }
1368 } 1365 }
@@ -1391,8 +1388,10 @@ void gk20a_fifo_reset_engine(struct gk20a *g, u32 engine_id)
1391 "HALT gr pipe not supported and " 1388 "HALT gr pipe not supported and "
1392 "gr cannot be reset without halting gr pipe"); 1389 "gr cannot be reset without halting gr pipe");
1393 } 1390 }
1394 if (g->support_pmu && g->can_elpg) { 1391 if (g->support_pmu) {
1395 nvgpu_pmu_enable_elpg(g); 1392 if (nvgpu_pg_elpg_enable(g) != 0 ) {
1393 nvgpu_err(g, "failed to set enable elpg");
1394 }
1396 } 1395 }
1397 } 1396 }
1398 if ((engine_enum == ENGINE_GRCE_GK20A) || 1397 if ((engine_enum == ENGINE_GRCE_GK20A) ||
@@ -1638,25 +1637,11 @@ static bool gk20a_fifo_handle_mmu_fault_locked(
1638 g->fifo.deferred_reset_pending = false; 1637 g->fifo.deferred_reset_pending = false;
1639 1638
1640 /* Disable power management */ 1639 /* Disable power management */
1641 if (g->support_pmu && g->can_elpg) { 1640 if (g->support_pmu) {
1642 if (nvgpu_pmu_disable_elpg(g)) { 1641 if (nvgpu_cg_pg_disable(g) != 0) {
1643 nvgpu_err(g, "failed to set disable elpg"); 1642 nvgpu_warn(g, "fail to disable power mgmt");
1644 } 1643 }
1645 } 1644 }
1646 if (g->ops.clock_gating.slcg_gr_load_gating_prod) {
1647 g->ops.clock_gating.slcg_gr_load_gating_prod(g,
1648 false);
1649 }
1650 if (g->ops.clock_gating.slcg_perf_load_gating_prod) {
1651 g->ops.clock_gating.slcg_perf_load_gating_prod(g,
1652 false);
1653 }
1654 if (g->ops.clock_gating.slcg_ltc_load_gating_prod) {
1655 g->ops.clock_gating.slcg_ltc_load_gating_prod(g,
1656 false);
1657 }
1658
1659 gr_gk20a_init_cg_mode(g, ELCG_MODE, ELCG_RUN);
1660 1645
1661 /* Disable fifo access */ 1646 /* Disable fifo access */
1662 grfifo_ctl = gk20a_readl(g, gr_gpfifo_ctl_r()); 1647 grfifo_ctl = gk20a_readl(g, gr_gpfifo_ctl_r());
@@ -1842,8 +1827,10 @@ static bool gk20a_fifo_handle_mmu_fault_locked(
1842 gr_gpfifo_ctl_semaphore_access_enabled_f()); 1827 gr_gpfifo_ctl_semaphore_access_enabled_f());
1843 1828
1844 /* It is safe to enable ELPG again. */ 1829 /* It is safe to enable ELPG again. */
1845 if (g->support_pmu && g->can_elpg) { 1830 if (g->support_pmu) {
1846 nvgpu_pmu_enable_elpg(g); 1831 if (nvgpu_cg_pg_enable(g) != 0) {
1832 nvgpu_warn(g, "fail to enable power mgmt");
1833 }
1847 } 1834 }
1848 1835
1849 return verbose; 1836 return verbose;
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 */
92static int gr_gk20a_init_golden_ctx_image(struct gk20a *g, 94static int gr_gk20a_init_golden_ctx_image(struct gk20a *g,
93 struct channel_gk20a *c); 95 struct channel_gk20a *c);
94/*elcg init */
95static void gr_gk20a_enable_elcg(struct gk20a *g);
96 96
97int gr_gk20a_get_ctx_id(struct gk20a *g, 97int 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
4230void 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
4257void gr_gk20a_program_zcull_mapping(struct gk20a *g, u32 zcull_num_entries, 4230void 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
4658static 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
4712static int gk20a_init_gr_prepare(struct gk20a *g) 4631static 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
5131static 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
5140int gk20a_gr_reset(struct gk20a *g) 5050int 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}
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h
index d795a3fc..8ff2cfd4 100644
--- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h
@@ -28,6 +28,7 @@
28 28
29#include "gr_ctx_gk20a.h" 29#include "gr_ctx_gk20a.h"
30#include "mm_gk20a.h" 30#include "mm_gk20a.h"
31#include <nvgpu/power_features/pg.h>
31 32
32#include <nvgpu/comptags.h> 33#include <nvgpu/comptags.h>
33#include <nvgpu/cond.h> 34#include <nvgpu/cond.h>
@@ -598,16 +599,16 @@ u32 gk20a_gr_get_sm_no_lock_down_hww_global_esr_mask(struct gk20a *g);
598#define gr_gk20a_elpg_protected_call(g, func) \ 599#define gr_gk20a_elpg_protected_call(g, func) \
599 ({ \ 600 ({ \
600 int err = 0; \ 601 int err = 0; \
601 if ((g->support_pmu) && (g->elpg_enabled)) {\ 602 if (g->support_pmu) {\
602 err = nvgpu_pmu_disable_elpg(g); \ 603 err = nvgpu_pg_elpg_disable(g);\
603 if (err != 0) {\ 604 if (err != 0) {\
604 nvgpu_pmu_enable_elpg(g); \ 605 err = nvgpu_pg_elpg_enable(g); \
605 } \ 606 } \
606 } \ 607 } \
607 if (err == 0) { \ 608 if (err == 0) { \
608 err = func; \ 609 err = func; \
609 if ((g->support_pmu) && (g->elpg_enabled)) {\ 610 if (g->support_pmu) {\
610 nvgpu_pmu_enable_elpg(g); \ 611 (void)nvgpu_pg_elpg_enable(g); \
611 } \ 612 } \
612 } \ 613 } \
613 err; \ 614 err; \