gpu: nvgpu: add unit test for gk20a_tsg_unbind_channel_check_hw_next

false branch when NEXT bit is not set is not covered. Add unit test
for same.

JIRA NVGPU-7211

Change-Id: I57725e35971605bf8144e7eaac618f44a38e5b31
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2614209
(cherry picked from commit 2064209f92700dc859d7398e061b3d7dc2725521)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2623628
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Sagar Kamble
2021-10-21 11:20:26 +05:30
committed by mobile promotions
parent b789ba7460
commit f64b5e20b0

View File

@@ -765,12 +765,14 @@ done:
} }
#define F_TSG_UNBIND_CHANNEL_CHECK_HW_NEXT BIT(0) #define F_TSG_UNBIND_CHANNEL_CHECK_HW_NEXT BIT(0)
#define F_TSG_UNBIND_CHANNEL_CHECK_HW_CTX_RELOAD BIT(1) #define F_TSG_UNBIND_CHANNEL_CHECK_HW_NEXT_CLR BIT(1)
#define F_TSG_UNBIND_CHANNEL_CHECK_HW_ENG_FAULTED BIT(2) #define F_TSG_UNBIND_CHANNEL_CHECK_HW_CTX_RELOAD BIT(2)
#define F_TSG_UNBIND_CHANNEL_CHECK_HW_LAST BIT(3) #define F_TSG_UNBIND_CHANNEL_CHECK_HW_ENG_FAULTED BIT(3)
#define F_TSG_UNBIND_CHANNEL_CHECK_HW_LAST BIT(4)
static const char *f_tsg_unbind_channel_check_hw[] = { static const char *f_tsg_unbind_channel_check_hw[] = {
"next", "next",
"next clear",
"ctx_reload", "ctx_reload",
"eng_faulted", "eng_faulted",
}; };
@@ -781,6 +783,12 @@ static void stub_channel_read_state_NEXT(struct gk20a *g,
state->next = true; state->next = true;
} }
static void stub_channel_read_state_NEXT_CLR(struct gk20a *g,
struct nvgpu_channel *ch, struct nvgpu_channel_hw_state *state)
{
state->next = false;
}
int test_tsg_unbind_channel_check_hw_state(struct unit_module *m, int test_tsg_unbind_channel_check_hw_state(struct unit_module *m,
struct gk20a *g, void *args) struct gk20a *g, void *args)
{ {
@@ -814,9 +822,15 @@ int test_tsg_unbind_channel_check_hw_state(struct unit_module *m,
unit_verbose(m, "%s branches=%s\n", __func__, unit_verbose(m, "%s branches=%s\n", __func__,
branches_str(branches, f_tsg_unbind_channel_check_hw)); branches_str(branches, f_tsg_unbind_channel_check_hw));
g->ops.channel.read_state = if (branches & F_TSG_UNBIND_CHANNEL_CHECK_HW_NEXT) {
branches & F_TSG_UNBIND_CHANNEL_CHECK_HW_NEXT ? g->ops.channel.read_state =
stub_channel_read_state_NEXT : gops.channel.read_state; stub_channel_read_state_NEXT;
} else if (branches & F_TSG_UNBIND_CHANNEL_CHECK_HW_NEXT_CLR) {
g->ops.channel.read_state =
stub_channel_read_state_NEXT_CLR;
} else {
g->ops.channel.read_state = gops.channel.read_state;
}
g->ops.tsg.unbind_channel_check_ctx_reload = g->ops.tsg.unbind_channel_check_ctx_reload =
branches & F_TSG_UNBIND_CHANNEL_CHECK_HW_CTX_RELOAD ? branches & F_TSG_UNBIND_CHANNEL_CHECK_HW_CTX_RELOAD ?