gpu: nvgpu: unit: add unit tests for fe idle and pwr_mode HALs

Add unit test coverage for below HALs in common.gr.init subunit:

- g->ops.gr.init.wait_fe_idle
- g->ops.gr.init.fe_pwr_mode_force_on

Jira NVGPU-4458

Change-Id: I924f9e49abcb5846f24c620bba7fd1c704c36932
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2270652
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
dnibade
2019-12-27 17:27:18 +05:30
committed by Alex Waterman
parent f2cc27f3d1
commit 27122d10d7
4 changed files with 151 additions and 4 deletions

View File

@@ -2519,6 +2519,18 @@
"unit": "nvgpu_gr_init",
"test_level": 0
},
{
"test": "test_gr_init_hal_wait_fe_idle",
"case": "gr_init_hal_wait_fe_idle",
"unit": "nvgpu_gr_init",
"test_level": 0
},
{
"test": "test_gr_init_hal_fe_pwr_mode",
"case": "gr_init_hal_fe_pwr_mode",
"unit": "nvgpu_gr_init",
"test_level": 0
},
{
"test": "test_gr_remove_setup",
"case": "gr_remove_setup",

View File

@@ -258,6 +258,83 @@ int test_gr_init_hal_wait_empty(struct unit_module *m,
return UNIT_SUCCESS;
}
int test_gr_init_hal_wait_fe_idle(struct unit_module *m,
struct gk20a *g, void *args)
{
int err;
struct nvgpu_posix_fault_inj *timer_fi =
nvgpu_timers_get_fault_injection();
/* Fail timeout initialization */
nvgpu_posix_enable_fault_injection(timer_fi, true, 0);
err = g->ops.gr.init.wait_fe_idle(g);
if (err != -ETIMEDOUT) {
return UNIT_FAIL;
}
nvgpu_posix_enable_fault_injection(timer_fi, false, 0);
/* Set FE status active */
nvgpu_writel(g, gr_status_r(), BIT32(2U));
/* Should fail */
err = g->ops.gr.init.wait_fe_idle(g);
if (err != -EAGAIN) {
return UNIT_FAIL;
}
/* Success */
nvgpu_writel(g, gr_status_r(), 0);
err = g->ops.gr.init.wait_fe_idle(g);
if (err != 0) {
return UNIT_FAIL;
}
return UNIT_SUCCESS;
}
int test_gr_init_hal_fe_pwr_mode(struct unit_module *m,
struct gk20a *g, void *args)
{
int err;
struct nvgpu_posix_fault_inj *timer_fi =
nvgpu_timers_get_fault_injection();
struct nvgpu_posix_fault_inj *readl_fi =
nvgpu_readl_get_fault_injection();
/* Fail timeout initialization */
nvgpu_posix_enable_fault_injection(timer_fi, true, 0);
err = g->ops.gr.init.fe_pwr_mode_force_on(g, true);
if (err != -ETIMEDOUT) {
return UNIT_FAIL;
}
nvgpu_posix_enable_fault_injection(timer_fi, false, 0);
/* Trigger timeout by default */
err = g->ops.gr.init.fe_pwr_mode_force_on(g, true);
if (err != -ETIMEDOUT) {
return UNIT_FAIL;
}
/* Inject readl error so that timeout is not hit */
nvgpu_posix_enable_fault_injection(readl_fi, true, 0);
err = g->ops.gr.init.fe_pwr_mode_force_on(g, true);
if (err != 0) {
return UNIT_FAIL;
}
/* Call with flag set to false, should pass */
err = g->ops.gr.init.fe_pwr_mode_force_on(g, false);
if (err != 0) {
return UNIT_FAIL;
}
nvgpu_posix_enable_fault_injection(readl_fi, false, 0);
return UNIT_SUCCESS;
}
static u32 gr_get_max_u32(struct gk20a *g)
{
return 0xFFFFFFFF;

View File

@@ -38,7 +38,7 @@ struct unit_module;
*
* Description: Verify error handling in g->ops.gr.init.wait_empty.
*
* Test Type: Feature, Error guessing.
* Test Type: Feature, Error guessing
*
* Targets: g->ops.gr.init.wait_empty.
*
@@ -58,12 +58,68 @@ struct unit_module;
int test_gr_init_hal_wait_empty(struct unit_module *m,
struct gk20a *g, void *args);
/**
* Test specification for: test_gr_init_hal_wait_fe_idle.
*
* Description: Verify error handling in g->ops.gr.init.wait_fe_idle.
*
* Test Type: Feature, Error guessing
*
* Targets: g->ops.gr.init.wait_fe_idle.
*
* Input: gr_init_setup, gr_init_prepare, gr_init_support must have
* been executed successfully.
*
* Steps:
* - Inject timeout error and call g->ops.gr.init.wait_fe_idle.
* Should fail since timeout initialization fails.
* - Set FE active status in register gr_status_r(), and call
* g->ops.gr.init.wait_fe_idle. Should fail since FE fails to idle.
* - Set FE idle status in register gr_status_r(), and call
* g->ops.gr.init.wait_fe_idle. Should pass this time.
*
* Output: Returns PASS if the steps above were executed successfully. FAIL
* otherwise.
*/
int test_gr_init_hal_wait_fe_idle(struct unit_module *m,
struct gk20a *g, void *args);
/**
* Test specification for: test_gr_init_hal_fe_pwr_mode.
*
* Description: Verify error handling in g->ops.gr.init.fe_pwr_mode_force_on.
*
* Test Type: Feature, Error guessing
*
* Targets: g->ops.gr.init.fe_pwr_mode_force_on.
*
* Input: gr_init_setup, gr_init_prepare, gr_init_support must have
* been executed successfully.
*
* Steps:
* - Inject timeout error and call g->ops.gr.init.fe_pwr_mode_force_on.
* should fail since timeout initialization fails.
* - Disable timeout error injection.
* - Call g->ops.gr.init.fe_pwr_mode_force_on. By default this should
* timeout and return error.
* - Enable readl function error injection and call
* g->ops.gr.init.fe_pwr_mode_force_on. Now this should return success.
* - Also call g->ops.gr.init.fe_pwr_mode_force_on with force flag set to
* false. Should return success.
* - Disable readl function error injection.
*
* Output: Returns pass if the steps above were executed successfully. fail
* otherwise.
*/
int test_gr_init_hal_fe_pwr_mode(struct unit_module *m,
struct gk20a *g, void *args);
/**
* Test specification for: test_gr_init_hal_ecc_scrub_reg.
*
* Description: Verify error handling in gops.gr.init.ecc_scrub_reg function.
*
* Test Type: Feature, Error guessing.
* Test Type: Feature, Error guessing
*
* Targets: g->ops.gr.init.ecc_scrub_reg.
*
@@ -94,7 +150,7 @@ int test_gr_init_hal_ecc_scrub_reg(struct unit_module *m,
* Description: Verify error handling in gr.init HAL functions that
* require tweaks to gr engine configuration.
*
* Test Type: Feature, Error guessing.
* Test Type: Feature, Error guessing
*
* Targets: g->ops.gr.init.get_nonpes_aware_tpc,
* g->ops.gr.init.sm_id_config,
@@ -144,7 +200,7 @@ int test_gr_init_hal_config_error_injection(struct unit_module *m,
*
* Description: Code coverage test for g->ops.gr.init.commit_global_pagepool.
*
* Test Type: Feature, Error guessing.
* Test Type: Feature, Error guessing
*
* Targets: g->ops.gr.init.commit_global_pagepool.
*

View File

@@ -185,6 +185,8 @@ struct unit_module_test nvgpu_gr_init_tests[] = {
UNIT_TEST(gr_init_support, test_gr_init_support, NULL, 0),
UNIT_TEST(gr_init_hal_error_injection, test_gr_init_hal_error_injection, NULL, 0),
UNIT_TEST(gr_init_hal_wait_empty, test_gr_init_hal_wait_empty, NULL, 0),
UNIT_TEST(gr_init_hal_wait_fe_idle, test_gr_init_hal_wait_fe_idle, NULL, 0),
UNIT_TEST(gr_init_hal_fe_pwr_mode, test_gr_init_hal_fe_pwr_mode, NULL, 0),
UNIT_TEST(gr_init_hal_ecc_scrub_reg, test_gr_init_hal_ecc_scrub_reg, NULL, 0),
UNIT_TEST(gr_init_hal_config_error_injection, test_gr_init_hal_config_error_injection, NULL, 0),
UNIT_TEST(gr_suspend, test_gr_suspend, NULL, 0),