mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 01:50:07 +03:00
gpu: nvgpu: Add fail scenarios in ACR unit tests
- Add more fail scenarios in ACR unit tests to cover branches - Return "err" value when "get_lsf_ucode_details" ops for fecs fails. JIRA NVGPU-4319 Change-Id: Ic9ba0afb26b23f6e0c0ebd76feae5b1ba3098b93 Signed-off-by: Divya Singhatwaria <dsinghatwari@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2252801 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
648de73142
commit
8592b0591c
@@ -452,9 +452,9 @@ static int lsfm_discover_ucode_images(struct gk20a *g,
|
||||
acr->lsf[i].get_lsf_ucode_details != NULL) {
|
||||
|
||||
(void) memset(&ucode_img, 0, sizeof(ucode_img));
|
||||
|
||||
if (acr->lsf[i].get_lsf_ucode_details(g,
|
||||
(void *)&ucode_img) != 0) {
|
||||
err = acr->lsf[i].get_lsf_ucode_details(g,
|
||||
(void *)&ucode_img);
|
||||
if (err != 0) {
|
||||
nvgpu_err(g, "LS falcon-%d ucode get failed", i);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@@ -471,6 +471,8 @@ int test_acr_prepare_ucode_blob(struct unit_module *m,
|
||||
struct gk20a *g, void *args)
|
||||
{
|
||||
int err;
|
||||
struct nvgpu_posix_fault_inj *kmem_fi =
|
||||
nvgpu_kmem_get_fault_injection();
|
||||
|
||||
/*
|
||||
* Initialise the test env and register space
|
||||
@@ -488,10 +490,51 @@ int test_acr_prepare_ucode_blob(struct unit_module *m,
|
||||
if (prepare_gr_hw_sw(m, g) != 0) {
|
||||
unit_return_fail(m, "Test env init failed\n");
|
||||
}
|
||||
/*
|
||||
* Case 1: fail scenario
|
||||
* g->acr->prepare_ucode_blob(g) fails due to memory
|
||||
* allocation failure
|
||||
*
|
||||
* HAL init parameters for gv11b: Correct chip id
|
||||
*/
|
||||
g->params.gpu_arch = NV_PMC_BOOT_0_ARCHITECTURE_GV110;
|
||||
g->params.gpu_impl = NV_PMC_BOOT_0_IMPLEMENTATION_B;
|
||||
|
||||
nvgpu_posix_enable_fault_injection(kmem_fi, true, 0);
|
||||
|
||||
err = g->acr->prepare_ucode_blob(g);
|
||||
if (err == -ENOENT) {
|
||||
unit_info(m, "test failed as expected\n");
|
||||
} else {
|
||||
unit_return_fail(m, "test did not fail as expected\n");
|
||||
}
|
||||
|
||||
nvgpu_posix_enable_fault_injection(kmem_fi, false, 0);
|
||||
|
||||
/*
|
||||
* Case 2: Fail scenario
|
||||
* giving incorrect chip version number
|
||||
*/
|
||||
|
||||
/*
|
||||
* giving incorrect chip id
|
||||
*/
|
||||
g->params.gpu_arch = NV_PMC_BOOT_0_ARCHITECTURE_INVALID;
|
||||
g->params.gpu_impl = NV_PMC_BOOT_0_IMPLEMENTATION_INVALID;
|
||||
|
||||
err = g->acr->prepare_ucode_blob(g);
|
||||
if (err == -ENOENT) {
|
||||
unit_info(m, "test failed as expected\n");
|
||||
} else {
|
||||
unit_return_fail(m, "test did not fail as expected\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* case:pass scenario
|
||||
*/
|
||||
g->params.gpu_arch = NV_PMC_BOOT_0_ARCHITECTURE_GV110;
|
||||
g->params.gpu_impl = NV_PMC_BOOT_0_IMPLEMENTATION_B;
|
||||
|
||||
err = g->acr->prepare_ucode_blob(g);
|
||||
if (err != 0) {
|
||||
unit_return_fail(m, "test failed\n");
|
||||
|
||||
Reference in New Issue
Block a user