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>
This commit is contained in:
David Nieto
2017-01-26 14:44:54 -08:00
committed by mobile promotions
parent c71346ad94
commit 5fb7f2a262

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * 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)
err = gk20a_init_pmu(pmu); err = gk20a_init_pmu(pmu);
if (err) { if (err) {
gp106_dbg_pmu("failed to set function pointers\n"); gk20a_err(dev_from_gk20a(g),
"failed to set function pointers\n");
goto release_sig; goto release_sig;
} }
@@ -455,33 +456,34 @@ static int lsfm_discover_ucode_images(struct gk20a *g,
/* Obtain the PMU ucode image and add it to the list if required*/ /* Obtain the PMU ucode image and add it to the list if required*/
memset(&ucode_img, 0, sizeof(ucode_img)); memset(&ucode_img, 0, sizeof(ucode_img));
status = pmu_ucode_details(g, &ucode_img); status = pmu_ucode_details(g, &ucode_img);
if (status == 0) { if (status)
if (ucode_img.lsf_desc != NULL) { return status;
/* The falon_id is formed by grabbing the static base
* falon_id from the image and adding the
* engine-designated falcon instance.*/
pmu->pmu_mode |= PMU_SECURE_MODE;
falcon_id = ucode_img.lsf_desc->falcon_id +
ucode_img.flcn_inst;
if (!lsfm_falcon_disabled(g, plsfm, falcon_id)) { if (ucode_img.lsf_desc != NULL) {
pmu->falcon_id = falcon_id; /* The falon_id is formed by grabbing the static base
if (lsfm_add_ucode_img(g, plsfm, &ucode_img, * falon_id from the image and adding the
pmu->falcon_id) == 0) * engine-designated falcon instance.*/
pmu->pmu_mode |= PMU_LSFM_MANAGED; pmu->pmu_mode |= PMU_SECURE_MODE;
falcon_id = ucode_img.lsf_desc->falcon_id +
ucode_img.flcn_inst;
plsfm->managed_flcn_cnt++; if (!lsfm_falcon_disabled(g, plsfm, falcon_id)) {
} else { pmu->falcon_id = falcon_id;
gp106_dbg_pmu("id not managed %d\n", if (lsfm_add_ucode_img(g, plsfm, &ucode_img,
ucode_img.lsf_desc->falcon_id); pmu->falcon_id) == 0)
} pmu->pmu_mode |= PMU_LSFM_MANAGED;
plsfm->managed_flcn_cnt++;
} else {
gp106_dbg_pmu("id not managed %d\n",
ucode_img.lsf_desc->falcon_id);
} }
}
/*Free any ucode image resources if not managing this falcon*/ /*Free any ucode image resources if not managing this falcon*/
if (!(pmu->pmu_mode & PMU_LSFM_MANAGED)) { if (!(pmu->pmu_mode & PMU_LSFM_MANAGED)) {
gp106_dbg_pmu("pmu is not LSFM managed\n"); gp106_dbg_pmu("pmu is not LSFM managed\n");
lsfm_free_ucode_img_res(&ucode_img); lsfm_free_ucode_img_res(&ucode_img);
}
} }
/* Enumerate all constructed falcon objects, /* Enumerate all constructed falcon objects,