gpu: nvgpu: unit: add common gr test functions for sub-units

Provide test_gr_init_setup_ready function which cover the
test_gr_init_setup, test_gr_init_prepare and test_gr_init_support
calls needed for each gr sub-units.
test_gr_setup_cleanup function which cover the
test_gr_remove_support and test_gr_remove_setup calls.

Update gr.intr and gr.falcon subunit tests to use these functions.

Jira NVGPU-3968

Change-Id: I90c890dc9802b59f60d8f2db436491acba313398
Signed-off-by: vinodg <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2242861
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-11-19 17:40:27 -08:00
committed by Alex Waterman
parent 8ca378e1c0
commit 4030549a42
6 changed files with 89 additions and 103 deletions

View File

@@ -59,21 +59,11 @@ static int test_gr_falcon_init(struct unit_module *m,
int err = 0;
/* Allocate and Initialize GR */
err = test_gr_init_setup(m, g, args);
err = test_gr_init_setup_ready(m, g, args);
if (err != 0) {
unit_return_fail(m, "gr init setup failed\n");
}
err = test_gr_init_prepare(m, g, args);
if (err != 0) {
unit_return_fail(m, "gr init prepare failed\n");
}
err = test_gr_init_support(m, g, args);
if (err != 0) {
unit_return_fail(m, "gr init support failed\n");
}
/* set up test specific HALs */
g->ops.gr.falcon.load_ctxsw_ucode =
nvgpu_gr_falcon_load_secure_ctxsw_ucode;
@@ -206,14 +196,9 @@ static int test_gr_falcon_deinit(struct unit_module *m,
}
/* Cleanup GR */
err = test_gr_remove_support(m, g, args);
err = test_gr_init_setup_cleanup(m, g, args);
if (err != 0) {
unit_return_fail(m, "gr remove support failed\n");
}
err = test_gr_remove_setup(m, g, args);
if (err != 0) {
unit_return_fail(m, "gr remove setup failed\n");
unit_return_fail(m, "gr setup cleanup failed\n");
}
return UNIT_SUCCESS;

View File

@@ -67,49 +67,6 @@ static void gr_test_intr_fifo_recover(struct gk20a *g, u32 bitmask, u32 id,
}
#endif
int test_gr_intr_setup(struct unit_module *m,
struct gk20a *g, void *args)
{
int err = 0;
/* Allocate and Initialize GR */
err = test_gr_init_setup(m, g, args);
if (err != 0) {
unit_return_fail(m, "gr init setup failed\n");
}
err = test_gr_init_prepare(m, g, args);
if (err != 0) {
unit_return_fail(m, "gr init prepare failed\n");
}
err = test_gr_init_support(m, g, args);
if (err != 0) {
unit_return_fail(m, "gr init support failed\n");
}
return UNIT_SUCCESS;
}
int test_gr_intr_cleanup(struct unit_module *m,
struct gk20a *g, void *args)
{
int err = 0;
/* Cleanup GR */
err = test_gr_remove_support(m, g, args);
if (err != 0) {
unit_return_fail(m, "gr remove support failed\n");
}
err = test_gr_remove_setup(m, g, args);
if (err != 0) {
unit_return_fail(m, "gr remove setup failed\n");
}
return UNIT_SUCCESS;
}
static u32 stub_channel_count(struct gk20a *g)
{
return 4;
@@ -715,13 +672,13 @@ int test_gr_intr_fecs_exceptions(struct unit_module *m,
}
struct unit_module_test nvgpu_gr_intr_tests[] = {
UNIT_TEST(gr_intr_setup, test_gr_intr_setup, NULL, 0),
UNIT_TEST(gr_intr_setup, test_gr_init_setup_ready, NULL, 0),
UNIT_TEST(gr_intr_channel_free, test_gr_intr_without_channel, NULL, 0),
UNIT_TEST(gr_intr_sw_method, test_gr_intr_sw_exceptions, NULL, 0),
UNIT_TEST(gr_intr_fecs_exceptions, test_gr_intr_fecs_exceptions, NULL, 0),
UNIT_TEST(gr_intr_gpc_exceptions, test_gr_intr_gpc_exceptions, NULL, 0),
UNIT_TEST(gr_intr_with_channel, test_gr_intr_setup_channel, NULL, 0),
UNIT_TEST(gr_intr_cleanup, test_gr_intr_cleanup, NULL, 0),
UNIT_TEST(gr_intr_cleanup, test_gr_init_setup_cleanup, NULL, 0),
};
UNIT_MODULE(nvgpu_gr_intr, nvgpu_gr_intr_tests, UNIT_PRIO_NVGPU_TEST);

View File

@@ -33,46 +33,6 @@ struct unit_module;
* Software Unit Test Specification for common.gr.intr
*/
/**
* Test specification for: test_gr_intr_setup.
*
* Description: Setup for common.gr.intr unit. Use the common.gr init calls
* to setup and initialize common.gr.intr unit.
*
* Test Type: Feature based.
*
* Input: None
*
* Steps:
* - Call #test_gr_init_setup.
* - Setup gv11b arch and allocate struct for common.gr.
* - Call #test_gr_init_prepare.
* - To initialize the s/w and enable h/w for GR engine.
* - Call #test_gr_init_support.
*
* Output: Returns PASS if the steps above were executed successfully. FAIL
* otherwise.
*/
int test_gr_intr_setup(struct unit_module *m, struct gk20a *g, void *args);
/**
* Test specification for: test_gr_intr_cleanup.
*
* Description: Cleanup common.gr.intr unit.
*
* Test Type: Feature based.
*
* Input: test_gr_intr_setup must have been executed successfully.
*
* Steps:
* - Call #test_gr_remove_support.
* - Call #test_gr_remove_setup.
*
* Output: Returns PASS if the steps above were executed successfully. FAIL
* otherwise.
*/
int test_gr_intr_cleanup(struct unit_module *m, struct gk20a *g, void *args);
/**
* Test specification for: test_gr_intr_without_channel.
*

View File

@@ -27,3 +27,5 @@ test_gr_init_support
test_gr_suspend
test_gr_remove_support
test_gr_setup_gv11b_reg_space
test_gr_init_setup_ready
test_gr_init_setup_cleanup

View File

@@ -151,6 +151,30 @@ int test_gr_suspend(struct unit_module *m, struct gk20a *g, void *args)
return UNIT_SUCCESS;
}
int test_gr_init_setup_ready(struct unit_module *m,
struct gk20a *g, void *args)
{
int err = 0;
/* Allocate and Initialize GR */
err = test_gr_init_setup(m, g, args);
if (err != 0) {
unit_return_fail(m, "gr init setup failed\n");
}
err = test_gr_init_prepare(m, g, args);
if (err != 0) {
unit_return_fail(m, "gr init prepare failed\n");
}
err = test_gr_init_support(m, g, args);
if (err != 0) {
unit_return_fail(m, "gr init support failed\n");
}
return UNIT_SUCCESS;
}
int test_gr_remove_support(struct unit_module *m, struct gk20a *g, void *args)
{
nvgpu_gr_remove_support(g);
@@ -166,3 +190,22 @@ int test_gr_remove_setup(struct unit_module *m,
return UNIT_SUCCESS;
}
int test_gr_init_setup_cleanup(struct unit_module *m,
struct gk20a *g, void *args)
{
int err = 0;
/* Cleanup GR */
err = test_gr_remove_support(m, g, args);
if (err != 0) {
unit_return_fail(m, "gr remove support failed\n");
}
err = test_gr_remove_setup(m, g, args);
if (err != 0) {
unit_return_fail(m, "gr remove setup failed\n");
}
return UNIT_SUCCESS;
}

View File

@@ -169,6 +169,45 @@ int test_gr_remove_support(struct unit_module *m, struct gk20a *g, void *args);
int test_gr_init_ecc_features(struct unit_module *m,
struct gk20a *g, void *args);
/**
* Test specification for: test_gr_init_setup_ready.
*
* Description: Setup for common.gr unit.
*
* Test Type: Feature based.
*
* Input: None
*
* Steps:
* - Call #test_gr_init_setup.
* - Setup gv11b arch and allocate struct for common.gr.
* - Call #test_gr_init_prepare.
* - To initialize the s/w and enable h/w for GR engine.
* - Call #test_gr_init_support.
*
* Output: Returns PASS if the steps above were executed successfully. FAIL
* otherwise.
*/
int test_gr_init_setup_ready(struct unit_module *m, struct gk20a *g, void *args);
/**
* Test specification for: test_gr_setup_cleanup.
*
* Description: Cleanup common.gr unit.
*
* Test Type: Feature based.
*
* Input: test_gr_setup_ready must have been executed successfully.
*
* Steps:
* - Call #test_gr_remove_support.
* - Call #test_gr_remove_setup.
*
* Output: Returns PASS if the steps above were executed successfully. FAIL
* otherwise.
*/
int test_gr_init_setup_cleanup(struct unit_module *m, struct gk20a *g, void *args);
#endif /* UNIT_NVGPU_GR_H */
/**