diff --git a/userspace/units/gr/init/nvgpu-gr-init-hal-gv11b.c b/userspace/units/gr/init/nvgpu-gr-init-hal-gv11b.c index d06db78a6..9ba44a13e 100644 --- a/userspace/units/gr/init/nvgpu-gr-init-hal-gv11b.c +++ b/userspace/units/gr/init/nvgpu-gr-init-hal-gv11b.c @@ -828,6 +828,14 @@ int test_gr_init_hal_error_injection(struct unit_module *m, unit_return_fail(m, "expected size not set"); } + /* + * Trigger these HALs with tpc_count = 0, only for code coverage. + * We are not interested in return values since tpc_count cannot be + * 0 in any practical case. + */ + EXPECT_BUG(g->ops.gr.init.get_attrib_cb_size(g, 0)); + EXPECT_BUG(g->ops.gr.init.get_alpha_cb_size(g, 0)); + /* cleanup */ nvgpu_gr_ctx_free_patch_ctx(g, vm, gr_ctx); nvgpu_free_gr_ctx_struct(g, gr_ctx); diff --git a/userspace/units/gr/init/nvgpu-gr-init-hal-gv11b.h b/userspace/units/gr/init/nvgpu-gr-init-hal-gv11b.h index ad882e712..99f440d0f 100644 --- a/userspace/units/gr/init/nvgpu-gr-init-hal-gv11b.h +++ b/userspace/units/gr/init/nvgpu-gr-init-hal-gv11b.h @@ -258,6 +258,10 @@ int test_gr_init_hal_config_error_injection(struct unit_module *m, * * Targets: gops_gr_init.commit_global_pagepool, * gp10b_gr_init_commit_global_pagepool + * gops_gr_init.get_attrib_cb_size, + * gv11b_gr_init_get_attrib_cb_size, + * gops_gr_init.get_alpha_cb_size, + * gv11b_gr_init_get_alpha_cb_size * * Input: gr_init_setup, gr_init_prepare, gr_init_support must have * been executed successfully. @@ -268,6 +272,9 @@ int test_gr_init_hal_config_error_injection(struct unit_module *m, * - Call g->ops.gr.init.commit_global_pagepool with global_ctx flag set * to false and with arbitrary size. * - Read back size from register and ensure correct size is set. + * - Call g->ops.gr.init.get_attrib_cb_size and g->ops.gr.init.get_alpha_cb_size + * with tpc_count = 0 for code coverage. Ensure that a BUG() is triggered. + * We are not interested in return value since tpc_count can never be 0. * - Cleanup temporary resources. * * Output: Returns PASS if the steps above were executed successfully. FAIL