summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/pmu/pmu_pg.c
diff options
context:
space:
mode:
authorDeepak Bhosale <dbhosale@nvidia.com>2018-07-03 17:29:41 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-07-06 16:26:10 -0400
commit46a66efb0e72172233ef79f2db0cc2f042bfe90e (patch)
tree7b6fc6533826d24726dd4bbe51410719809d473a /drivers/gpu/nvgpu/common/pmu/pmu_pg.c
parent4b889fb8b02e7b65eb7054463c0c1bda37688762 (diff)
gpu: nvgpu: pmu: Fix pmu_state state update
- Commit c61e21c868246faf7a9ffc812590941fc362af17 fixed race codition in PMU state transition. - The race condition is such that PMU response(intr callback for messages) can run faster than kthread posting commands to PMU and thus PMU message callback may skip important pmu state change. - Commit c61e21c868246faf7a9ffc812590941fc362af17 introduced a fix where PMU state change was only updated from callback while other places can only update pmu_state variable - However, this commit introduced a regression as follows: - When PMU state is PMU_STATE_INIT_RECEIVED, we loop over every engine supported by GPU --> If state = PMU_STATE_INIT_RECEIVED, change the state to PMU_STATE_ELPG_BOOTING and init ELPG else If state != PMU_STATE_INIT_RECEIVED throw an error saying "PMU INIT not received" - Now, if GPU supports multiple engines, first engine will check that pmu_state is PMU_STATE_INIT_RECEIVED and change it to PMU_STATE_ELPG_BOOTING However, from second engine onwards, since state is already changed to PMU_STATE_ELPG_BOOTING, all engines except first engine start throwing error "PMU INIT not received" - This patch fixes the issue by changing pmu state from PMU_STATE_INIT_RECEIVED to PMU_STATE_ELPG_BOOTING only once. Bug 200372838 JIRA EVLR-2164 Change-Id: Ic8c954d14acb1d6ec3adcbc4bcf4d4745542d9f0 Signed-off-by: Deepak Bhosale <dbhosale@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1769814 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com> Reviewed-by: Deepak Goyal <dgoyal@nvidia.com> Reviewed-by: Aparna Das <aparnad@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/pmu/pmu_pg.c')
-rw-r--r--drivers/gpu/nvgpu/common/pmu/pmu_pg.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/common/pmu/pmu_pg.c b/drivers/gpu/nvgpu/common/pmu/pmu_pg.c
index 2d0fc499..30bf9008 100644
--- a/drivers/gpu/nvgpu/common/pmu/pmu_pg.c
+++ b/drivers/gpu/nvgpu/common/pmu/pmu_pg.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"), 5 * copy of this software and associated documentation files (the "Software"),
@@ -374,12 +374,6 @@ static int pmu_pg_init_send(struct gk20a *g, u32 pg_engine_id)
374 374
375 nvgpu_log_fn(g, " "); 375 nvgpu_log_fn(g, " ");
376 376
377 if (pmu->pmu_state == PMU_STATE_INIT_RECEIVED)
378 nvgpu_pmu_state_change(g,
379 PMU_STATE_ELPG_BOOTING, false);
380 else
381 nvgpu_err(g, "PMU INIT not received\n");
382
383 gk20a_pmu_pg_idle_counter_config(g, pg_engine_id); 377 gk20a_pmu_pg_idle_counter_config(g, pg_engine_id);
384 378
385 if (g->ops.pmu.pmu_pg_init_param) 379 if (g->ops.pmu.pmu_pg_init_param)
@@ -446,6 +440,7 @@ int nvgpu_pmu_init_powergating(struct gk20a *g)
446{ 440{
447 u32 pg_engine_id; 441 u32 pg_engine_id;
448 u32 pg_engine_id_list = 0; 442 u32 pg_engine_id_list = 0;
443 struct nvgpu_pmu *pmu = &g->pmu;
449 444
450 nvgpu_log_fn(g, " "); 445 nvgpu_log_fn(g, " ");
451 446
@@ -459,6 +454,9 @@ int nvgpu_pmu_init_powergating(struct gk20a *g)
459 pg_engine_id++) { 454 pg_engine_id++) {
460 455
461 if (BIT(pg_engine_id) & pg_engine_id_list) { 456 if (BIT(pg_engine_id) & pg_engine_id_list) {
457 if (pmu && pmu->pmu_state == PMU_STATE_INIT_RECEIVED)
458 nvgpu_pmu_state_change(g,
459 PMU_STATE_ELPG_BOOTING, false);
462 pmu_pg_init_send(g, pg_engine_id); 460 pmu_pg_init_send(g, pg_engine_id);
463 } 461 }
464 } 462 }