From 511344da855c4a6fc06432fb478c42664519f93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konsta=20H=C3=B6ltt=C3=A4?= Date: Wed, 9 Jun 2021 14:00:12 +0300 Subject: gpu: nvgpu: avoid faulty elpg protection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't store the return value of elpg re-enable if disable fails; this could make the local status value zero again, causing the elpg-protected call to be executed with elpg still enabled and elpg re-enabled twice. Commit c90585856567 ("gpu: nvgpu: add cg and pg function") introduced this bug; failure of re-enabling after a failed disable might be another problem (and it's not clear why this is done in the first place) which isn't propagated to the caller, but that would belong to another patch. Bug 200565050 Change-Id: I7cf7a0887ae59e85bf0c56c38aaaadfefd16cc1c Signed-off-by: Konsta Hölttä Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2541859 (cherry picked from commit 4b3591aafb8a53b051ce75629b15d2957943bd76) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2543030 Reviewed-by: Alex Waterman Reviewed-by: Debarshi Dutta Reviewed-by: Bibek Basu Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/gr_gk20a.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h index 08b81e86..901835c8 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h @@ -1,7 +1,7 @@ /* * GK20A Graphics Engine * - * Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2011-2021, 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"), @@ -602,7 +602,7 @@ u32 gk20a_gr_get_sm_no_lock_down_hww_global_esr_mask(struct gk20a *g); if (g->support_pmu) {\ err = nvgpu_pg_elpg_disable(g);\ if (err != 0) {\ - err = nvgpu_pg_elpg_enable(g); \ + (void)nvgpu_pg_elpg_enable(g); \ } \ } \ if (err == 0) { \ -- cgit v1.2.2