mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: unit: improve coverage for gv11b tsg HAL
Add test for the following HAL: - gv11b_tsg_enable Jira NVGPU-4890 Change-Id: Ia79be676098e18ca71f6f9983485bf107c15f37c Signed-off-by: Thomas Fleury <tfleury@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2280135 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
45a6b873d2
commit
bdaa8519d5
@@ -192,6 +192,7 @@ gv11b_runlist_entry_size
|
|||||||
gv11b_runlist_get_tsg_entry
|
gv11b_runlist_get_tsg_entry
|
||||||
gv11b_runlist_get_ch_entry
|
gv11b_runlist_get_ch_entry
|
||||||
gv11b_therm_init_elcg_mode
|
gv11b_therm_init_elcg_mode
|
||||||
|
gv11b_tsg_enable
|
||||||
gv11b_usermode_base
|
gv11b_usermode_base
|
||||||
gv11b_usermode_bus_base
|
gv11b_usermode_bus_base
|
||||||
gv11b_usermode_doorbell_token
|
gv11b_usermode_doorbell_token
|
||||||
|
|||||||
@@ -3491,6 +3491,12 @@
|
|||||||
"unit": "nvgpu_tsg_gv11b",
|
"unit": "nvgpu_tsg_gv11b",
|
||||||
"test_level": 0
|
"test_level": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"test": "test_gv11b_tsg_enable",
|
||||||
|
"case": "gv11b_tsg_enable",
|
||||||
|
"unit": "nvgpu_tsg_gv11b",
|
||||||
|
"test_level": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"test": "test_gv11b_tsg_init_eng_method_buffers",
|
"test": "test_gv11b_tsg_init_eng_method_buffers",
|
||||||
"case": "gv11b_tsg_init_eng_method_buffers",
|
"case": "gv11b_tsg_init_eng_method_buffers",
|
||||||
|
|||||||
@@ -96,6 +96,64 @@ static void subtest_setup(u32 branches)
|
|||||||
#define branches_str test_fifo_flags_str
|
#define branches_str test_fifo_flags_str
|
||||||
#define pruned test_fifo_subtest_pruned
|
#define pruned test_fifo_subtest_pruned
|
||||||
|
|
||||||
|
static void stub_channel_enable(struct nvgpu_channel *ch)
|
||||||
|
{
|
||||||
|
stub[0].chid = ch->chid;
|
||||||
|
stub[0].count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void stub_usermode_ring_doorbell(struct nvgpu_channel *ch)
|
||||||
|
{
|
||||||
|
stub[1].chid = ch->chid;
|
||||||
|
stub[1].count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
int test_gv11b_tsg_enable(struct unit_module *m,
|
||||||
|
struct gk20a *g, void *args)
|
||||||
|
{
|
||||||
|
struct gpu_ops gops = g->ops;
|
||||||
|
struct nvgpu_tsg *tsg = NULL;
|
||||||
|
struct nvgpu_channel *ch = NULL;
|
||||||
|
int ret = UNIT_FAIL;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
memset(stub, 0, sizeof(stub));
|
||||||
|
g->ops.channel.enable = stub_channel_enable;
|
||||||
|
g->ops.usermode.ring_doorbell = stub_usermode_ring_doorbell;
|
||||||
|
|
||||||
|
tsg = nvgpu_tsg_open(g, getpid());
|
||||||
|
unit_assert(tsg != NULL, goto done);
|
||||||
|
|
||||||
|
/* standalone TSG */
|
||||||
|
gv11b_tsg_enable(tsg);
|
||||||
|
unit_assert(stub[0].count == 0, goto done);
|
||||||
|
unit_assert(stub[1].count == 0, goto done);
|
||||||
|
|
||||||
|
ch = nvgpu_channel_open_new(g, ~0U, false, getpid(), getpid());
|
||||||
|
unit_assert(ch != NULL, goto done);
|
||||||
|
|
||||||
|
err = nvgpu_tsg_bind_channel(tsg, ch);
|
||||||
|
unit_assert(err == 0, goto done);
|
||||||
|
|
||||||
|
/* TSG with bound channel */
|
||||||
|
gv11b_tsg_enable(tsg);
|
||||||
|
unit_assert(stub[0].count == 1, goto done);
|
||||||
|
unit_assert(stub[0].chid == ch->chid, goto done);
|
||||||
|
unit_assert(stub[1].count == 1, goto done);
|
||||||
|
unit_assert(stub[1].chid == ch->chid, goto done);
|
||||||
|
|
||||||
|
ret = UNIT_SUCCESS;
|
||||||
|
done:
|
||||||
|
if (ch != NULL) {
|
||||||
|
nvgpu_channel_close(ch);
|
||||||
|
}
|
||||||
|
if (tsg != NULL) {
|
||||||
|
nvgpu_ref_put(&tsg->refcount, nvgpu_tsg_release);
|
||||||
|
}
|
||||||
|
g->ops = gops;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
#define GR_RUNQUE 0U /* pbdma 0 */
|
#define GR_RUNQUE 0U /* pbdma 0 */
|
||||||
#define ASYNC_CE_RUNQUE 2U /* pbdma 2 */
|
#define ASYNC_CE_RUNQUE 2U /* pbdma 2 */
|
||||||
|
|
||||||
@@ -383,6 +441,7 @@ done:
|
|||||||
|
|
||||||
struct unit_module_test nvgpu_tsg_gv11b_tests[] = {
|
struct unit_module_test nvgpu_tsg_gv11b_tests[] = {
|
||||||
UNIT_TEST(init_support, test_fifo_init_support, &unit_ctx, 0),
|
UNIT_TEST(init_support, test_fifo_init_support, &unit_ctx, 0),
|
||||||
|
UNIT_TEST(gv11b_tsg_enable, test_gv11b_tsg_enable, &unit_ctx, 0),
|
||||||
UNIT_TEST(gv11b_tsg_init_eng_method_buffers, \
|
UNIT_TEST(gv11b_tsg_init_eng_method_buffers, \
|
||||||
test_gv11b_tsg_init_eng_method_buffers, &unit_ctx, 0),
|
test_gv11b_tsg_init_eng_method_buffers, &unit_ctx, 0),
|
||||||
UNIT_TEST(gv11b_tsg_bind_channel_eng_method_buffers,
|
UNIT_TEST(gv11b_tsg_bind_channel_eng_method_buffers,
|
||||||
|
|||||||
@@ -33,6 +33,33 @@ struct gk20a;
|
|||||||
* Software Unit Test Specification for fifo/tsg/gv11b
|
* Software Unit Test Specification for fifo/tsg/gv11b
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test specification for: test_gv11b_tsg_enable
|
||||||
|
*
|
||||||
|
* Description: Enable TSG
|
||||||
|
*
|
||||||
|
* Test Type: Feature
|
||||||
|
*
|
||||||
|
* Targets: gops_tsg.enable, gv11b_tsg_enable
|
||||||
|
*
|
||||||
|
* Input: test_fifo_init_support() run for this GPU
|
||||||
|
*
|
||||||
|
* Steps:
|
||||||
|
* - Use stubs for gops_channel.enable and gops_usermode.ring_doorbell.
|
||||||
|
* - Call gv11b for a standalone TSG:
|
||||||
|
* - Check that gops_channel.enable is not called.
|
||||||
|
* - Check that gops_usermode.ring_doorbell is not called.
|
||||||
|
* - Call gv11b for a TSG with one bound channel:
|
||||||
|
* - Check that gops_channel.enable is called for this channel.
|
||||||
|
* - Check that gops_usermode.ring_doorbell is called for this
|
||||||
|
* channel.
|
||||||
|
*
|
||||||
|
* Output: Returns PASS if all branches gave expected results. FAIL otherwise.
|
||||||
|
*/
|
||||||
|
int test_gv11b_tsg_enable(struct unit_module *m,
|
||||||
|
struct gk20a *g, void *args);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test specification for: test_gv11b_tsg_init_eng_method_buffers
|
* Test specification for: test_gv11b_tsg_init_eng_method_buffers
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user