From 264691e69d825489e0a0bcee56f700e241186bb4 Mon Sep 17 00:00:00 2001 From: Peter Daifuku Date: Fri, 22 Nov 2019 16:40:41 -0800 Subject: gpu: nvgpu: re-enable elpg after golden img init Typically, the PMU init thread will finish up long before the golden context image has been initialized, which means that ELPG hasn't truly been enabled at that point. Create a new function, nvgpu_pmu_reenable_pg(), which checks if elpg had been enabled (non-zero refcnt), and if so, disables then re-enables it. Call this function from gk20a_alloc_obj_ctx() after the golden context image has been initialized to ensure that elpg is truly enabled. Manually ported from dev-main Bug 200543218 Change-Id: I0e7c4f64434c5e356829581950edce61cc88882a Signed-off-by: Peter Daifuku Reviewed-on: https://git-master.nvidia.com/r/2245768 (cherry picked from commit 077b6712b5a40340ece818416002ac8431dc4138) Reviewed-on: https://git-master.nvidia.com/r/2250091 GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu Reviewed-by: Bibek Basu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/pmu/pmu_pg.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/common/pmu/pmu_pg.c') diff --git a/drivers/gpu/nvgpu/common/pmu/pmu_pg.c b/drivers/gpu/nvgpu/common/pmu/pmu_pg.c index 3d46298d..941cee75 100644 --- a/drivers/gpu/nvgpu/common/pmu/pmu_pg.c +++ b/drivers/gpu/nvgpu/common/pmu/pmu_pg.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -359,6 +359,36 @@ exit_unlock: return ret; } +int nvgpu_pmu_reenable_elpg(struct gk20a *g) +{ + struct nvgpu_pmu *pmu = &g->pmu; + int ret = 0; + + nvgpu_log_fn(g, " "); + + if (!g->support_pmu) { + return ret; + } + + /* If pmu enabled, re-enable by first disabling, then + * enabling + */ + if (pmu->elpg_refcnt != 0) { + ret = nvgpu_pmu_disable_elpg(g); + if (ret != 0) { + nvgpu_err(g, "failed disabling elpg"); + goto exit; + } + ret = nvgpu_pmu_enable_elpg(g); + if (ret != 0) { + nvgpu_err(g, "failed enabling elpg"); + goto exit; + } + } +exit: + return ret; +} + /* PG init */ static void pmu_handle_pg_stat_msg(struct gk20a *g, struct pmu_msg *msg, void *param, u32 handle, u32 status) -- cgit v1.2.2