diff --git a/userspace/units/gr/falcon/nvgpu-gr-falcon.c b/userspace/units/gr/falcon/nvgpu-gr-falcon.c index 6a758dc46..09b4b0513 100644 --- a/userspace/units/gr/falcon/nvgpu-gr-falcon.c +++ b/userspace/units/gr/falcon/nvgpu-gr-falcon.c @@ -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; diff --git a/userspace/units/gr/intr/nvgpu-gr-intr.c b/userspace/units/gr/intr/nvgpu-gr-intr.c index 046cb1c36..d1600dd4e 100644 --- a/userspace/units/gr/intr/nvgpu-gr-intr.c +++ b/userspace/units/gr/intr/nvgpu-gr-intr.c @@ -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); diff --git a/userspace/units/gr/intr/nvgpu-gr-intr.h b/userspace/units/gr/intr/nvgpu-gr-intr.h index cafe33b5b..5994f3188 100644 --- a/userspace/units/gr/intr/nvgpu-gr-intr.h +++ b/userspace/units/gr/intr/nvgpu-gr-intr.h @@ -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. * diff --git a/userspace/units/gr/libnvgpu-gr.export b/userspace/units/gr/libnvgpu-gr.export index b8e547181..76f5b42d2 100644 --- a/userspace/units/gr/libnvgpu-gr.export +++ b/userspace/units/gr/libnvgpu-gr.export @@ -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 diff --git a/userspace/units/gr/nvgpu-gr.c b/userspace/units/gr/nvgpu-gr.c index 0aa7f69d2..ce5ee0a96 100644 --- a/userspace/units/gr/nvgpu-gr.c +++ b/userspace/units/gr/nvgpu-gr.c @@ -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; +} diff --git a/userspace/units/gr/nvgpu-gr.h b/userspace/units/gr/nvgpu-gr.h index 3a1c20c1d..24a3315e0 100644 --- a/userspace/units/gr/nvgpu-gr.h +++ b/userspace/units/gr/nvgpu-gr.h @@ -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 */ /**