From dfc0f3342a9e578b5251537b0c27e44a3d8db7b6 Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Wed, 8 Jan 2020 14:10:14 -0500 Subject: [PATCH] gpu: nvgpu: unit: complete tsg coverage Previous pruning rules in test_tsg_unbind_channel were skipping the case where both tsg unbind and update runlist fail. Modified pruning rules to cover all cases. Jira NVGPU-4673 Change-Id: I38a63347483252deb83fa079545cead59c7ec594 Signed-off-by: Thomas Fleury Reviewed-on: http://git-master.nvidia.com/r/c/linux-nvgpu/+/2276011 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Philip Elcan Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- userspace/units/fifo/tsg/nvgpu-tsg.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/userspace/units/fifo/tsg/nvgpu-tsg.c b/userspace/units/fifo/tsg/nvgpu-tsg.c index 0b2c83bf7..4cecf8620 100644 --- a/userspace/units/fifo/tsg/nvgpu-tsg.c +++ b/userspace/units/fifo/tsg/nvgpu-tsg.c @@ -435,21 +435,6 @@ static int stub_runlist_update_for_channel_EINVAL( return 0; } -static bool unbind_pruned(u32 branches, u32 fail) -{ - u32 branches_init = branches; - - if ((branches & fail) == 0) { - branches &= ~F_TSG_UNBIND_CHANNEL_ABORT_RUNLIST_UPDATE_FAIL; - } - - if (branches < branches_init) { - return true; - } - - return pruned(branches, fail); -} - int test_tsg_unbind_channel(struct unit_module *m, struct gk20a *g, void *args) { @@ -477,13 +462,22 @@ int test_tsg_unbind_channel(struct unit_module *m, F_TSG_UNBIND_CHANNEL_RUNLIST_UPDATE_FAIL | F_TSG_UNBIND_CHANNEL_UNBIND_HAL_FAIL; - for (branches = 0U; branches < F_TSG_UNBIND_CHANNEL_LAST; branches++) { + /* + * do not prune F_TSG_UNBIND_CHANNEL_UNBIND_HAL_FAIL, to + * exercise following abort path. + */ + u32 prune = + F_TSG_UNBIND_CHANNEL_PREEMPT_TSG_FAIL | + F_TSG_UNBIND_CHANNEL_CHECK_HW_STATE_FAIL | + F_TSG_UNBIND_CHANNEL_RUNLIST_UPDATE_FAIL; - if (unbind_pruned(branches, fail)) { + for (branches = 0U; branches < F_TSG_UNBIND_CHANNEL_LAST; branches++) { + if (pruned(branches, prune)) { unit_verbose(m, "%s branches=%s (pruned)\n", __func__, branches_str(branches, labels)); continue; } + subtest_setup(branches); unit_verbose(m, "%s branches=%s\n", __func__, branches_str(branches, labels));