gpu: nvgpu: Add more tests for common.gr.falcon subunit

Add more test coverage for common.gr.falcon subunit.
Rearrange few tests that use nvgpu_gr_falcon_init_ctxsw to a single test.
Support alloc failure for nvgpu_gr_falcon_init_support.

Add Doxygen for common.gr.falcon subunit.

Jira NVGPU-4453
Jira NVGPU-4381

Change-Id: I8fa9059c2c5c6e30af7ea8a2321ba3e19164dc98
Signed-off-by: vinodg <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2253770
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
vinodg
2019-12-02 15:33:58 -08:00
committed by Alex Waterman
parent 4cc1fa1a0b
commit 234a82fc9a
7 changed files with 278 additions and 74 deletions

View File

@@ -428,6 +428,33 @@ static int gr_setup_alloc_fail_fe_pwr_mode(struct unit_module *m, struct gk20a *
return (err != 0) ? UNIT_SUCCESS: UNIT_FAIL;
}
static int gr_setup_alloc_fail_ctrl_ctxsw(struct unit_module *m,
struct gk20a *g, void *args)
{
int err;
err = gr_test_setup_allocate_ch_tsg(m, g);
if (err != 0) {
unit_return_fail(m, "alloc setup channel failed\n");
}
g->ops.mm.cache.l2_flush = stub_mm_l2_flush;
g->ops.gr.init.fe_pwr_mode_force_on = stub_gr_init_fe_pwr_mode;
/* Reset golden image ready bit */
g->gr->golden_image->ready = false;
g->gr->golden_image->size = 0x800;
err = g->ops.gr.setup.alloc_obj_ctx(gr_setup_ch, VOLTA_COMPUTE_A, 0);
if (err == 0) {
unit_err(m, "setup alloc ctrl_ctxsw failed\n");
}
test_gr_setup_free_obj_ctx(m, g, args);
return (err != 0) ? UNIT_SUCCESS: UNIT_FAIL;
}
static int gr_setup_alloc_fail_l2_flush(struct unit_module *m, struct gk20a *g)
{
int err;
@@ -440,6 +467,12 @@ static int gr_setup_alloc_fail_l2_flush(struct unit_module *m, struct gk20a *g)
unit_return_fail(m, "setup alloc l2 flush failed\n");
}
/* Subctx already created - redo for branch coverage */
err = g->ops.gr.setup.alloc_obj_ctx(gr_setup_ch, VOLTA_COMPUTE_A, 0);
if (err != 0) {
unit_return_fail(m, "setup alloc l2 flush failed\n");
}
g->ops.mm.cache.l2_flush = stub_mm_l2_flush;
return (err == 0) ? UNIT_SUCCESS: UNIT_FAIL;
@@ -529,6 +562,12 @@ int test_gr_setup_alloc_obj_ctx_error_injections(struct unit_module *m,
test_gr_setup_free_obj_ctx(m, g, args);
g->allow_all = false;
/* TEST-8 fail ctrl_ctxsw */
err = gr_setup_alloc_fail_ctrl_ctxsw(m, g, args);
if (err != 0) {
unit_return_fail(m, "setup alloc TEST-8 failed\n");
}
return UNIT_SUCCESS;
}

View File

@@ -27,7 +27,7 @@
struct gk20a;
struct unit_module;
/** @addtogroup SWUTS-common-gr-setup
/** @addtogroup SWUTS-gr-setup
* @{
*
* Software Unit Test Specification for common.gr.setup
@@ -162,12 +162,13 @@ int test_gr_setup_preemption_mode_errors(struct unit_module *m,
* - Test-1 using invalid tsg, classobj and classnum.
* - Test-2 error injection in subctx allocation call.
* - Test-3 fail nvgpu_gr_obj_ctx_alloc by setting zero image size.
* - Test-4 fail nvgpu_gr_obj_ctx_alloc_golden_ctx_image by failing ctrl_ctsw.
* - Test-5 Fail L2 flush for branch coverage
* - Test-6 Fake setup_free call for NULL checking
* - Test-4 and Test-8 fail nvgpu_gr_obj_ctx_alloc_golden_ctx_image
* by failing ctrl_ctsw.
* - Test-5 Fail L2 flush for branch coverage.
* - Test-6 Fake setup_free call for NULL checking.
*
* - Positive Tests
* - Test-7 nvgpu_gr_setup_alloc_obj_ctx pass without TST subcontexts
* - Test-7 nvgpu_gr_setup_alloc_obj_ctx pass without TSG subcontexts.
*
* Output: Returns PASS if the steps above were executed successfully. FAIL
* otherwise.