summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp106/acr_gp106.c
diff options
context:
space:
mode:
authorDavid Nieto <dmartineznie@nvidia.com>2017-01-26 17:44:54 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-01-31 12:17:59 -0500
commit5fb7f2a262d2e9e187d8bcc4fb2ceb945fec9f8d (patch)
tree9569988f1e663258b2aae1d267659a0aa30396d5 /drivers/gpu/nvgpu/gp106/acr_gp106.c
parentc71346ad943d584ce27fb19a86fed911f722ae88 (diff)
gpu: nvgpu: Propagate pmu initialization failures
During testing it was detected that a failure in loading the firmware for the driver would not propagate, allowing some function pointers to be left unitialized. This would cause a kernel-crash later on. Bug 1866370 Change-Id: I66056a1d99229d10635293d4c1685f596f197255 Signed-off-by: David Nieto <dmartineznie@nvidia.com> Reviewed-on: http://git-master/r/1295376 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com> Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp106/acr_gp106.c')
-rw-r--r--drivers/gpu/nvgpu/gp106/acr_gp106.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/drivers/gpu/nvgpu/gp106/acr_gp106.c b/drivers/gpu/nvgpu/gp106/acr_gp106.c
index 58c4e68a..308f1caf 100644
--- a/drivers/gpu/nvgpu/gp106/acr_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/acr_gp106.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -173,7 +173,8 @@ static int pmu_ucode_details(struct gk20a *g, struct flcn_ucode_img_v1 *p_img)
173 173
174 err = gk20a_init_pmu(pmu); 174 err = gk20a_init_pmu(pmu);
175 if (err) { 175 if (err) {
176 gp106_dbg_pmu("failed to set function pointers\n"); 176 gk20a_err(dev_from_gk20a(g),
177 "failed to set function pointers\n");
177 goto release_sig; 178 goto release_sig;
178 } 179 }
179 180
@@ -455,33 +456,34 @@ static int lsfm_discover_ucode_images(struct gk20a *g,
455 /* Obtain the PMU ucode image and add it to the list if required*/ 456 /* Obtain the PMU ucode image and add it to the list if required*/
456 memset(&ucode_img, 0, sizeof(ucode_img)); 457 memset(&ucode_img, 0, sizeof(ucode_img));
457 status = pmu_ucode_details(g, &ucode_img); 458 status = pmu_ucode_details(g, &ucode_img);
458 if (status == 0) { 459 if (status)
459 if (ucode_img.lsf_desc != NULL) { 460 return status;
460 /* The falon_id is formed by grabbing the static base 461
461 * falon_id from the image and adding the 462 if (ucode_img.lsf_desc != NULL) {
462 * engine-designated falcon instance.*/ 463 /* The falon_id is formed by grabbing the static base
463 pmu->pmu_mode |= PMU_SECURE_MODE; 464 * falon_id from the image and adding the
464 falcon_id = ucode_img.lsf_desc->falcon_id + 465 * engine-designated falcon instance.*/
465 ucode_img.flcn_inst; 466 pmu->pmu_mode |= PMU_SECURE_MODE;
466 467 falcon_id = ucode_img.lsf_desc->falcon_id +
467 if (!lsfm_falcon_disabled(g, plsfm, falcon_id)) { 468 ucode_img.flcn_inst;
468 pmu->falcon_id = falcon_id; 469
469 if (lsfm_add_ucode_img(g, plsfm, &ucode_img, 470 if (!lsfm_falcon_disabled(g, plsfm, falcon_id)) {
470 pmu->falcon_id) == 0) 471 pmu->falcon_id = falcon_id;
471 pmu->pmu_mode |= PMU_LSFM_MANAGED; 472 if (lsfm_add_ucode_img(g, plsfm, &ucode_img,
472 473 pmu->falcon_id) == 0)
473 plsfm->managed_flcn_cnt++; 474 pmu->pmu_mode |= PMU_LSFM_MANAGED;
474 } else { 475
475 gp106_dbg_pmu("id not managed %d\n", 476 plsfm->managed_flcn_cnt++;
476 ucode_img.lsf_desc->falcon_id); 477 } else {
477 } 478 gp106_dbg_pmu("id not managed %d\n",
479 ucode_img.lsf_desc->falcon_id);
478 } 480 }
481 }
479 482
480 /*Free any ucode image resources if not managing this falcon*/ 483 /*Free any ucode image resources if not managing this falcon*/
481 if (!(pmu->pmu_mode & PMU_LSFM_MANAGED)) { 484 if (!(pmu->pmu_mode & PMU_LSFM_MANAGED)) {
482 gp106_dbg_pmu("pmu is not LSFM managed\n"); 485 gp106_dbg_pmu("pmu is not LSFM managed\n");
483 lsfm_free_ucode_img_res(&ucode_img); 486 lsfm_free_ucode_img_res(&ucode_img);
484 }
485 } 487 }
486 488
487 /* Enumerate all constructed falcon objects, 489 /* Enumerate all constructed falcon objects,