From 0836f31c47f7af3d74b3daca40da58cffdc2542d Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Wed, 8 Jan 2020 16:00:44 -0500 Subject: [PATCH] gpu: nvgpu: unit: improve gv11b tsg coverage test_gv11b_tsg_bind_channel_eng_method_buffers was missing in the list of tests for the module. Added the test, and fixed couple issues: - wrong test on gpu_va in valid case. - NULL pointer assignment during test setup, when tsg->eng_method_buffers is NULL. Jira NVGPU-4673 Change-Id: I2478425f0380540e8295325ffd3df672dc5d9fd0 Signed-off-by: Thomas Fleury Reviewed-on: https://git-master.nvidia.com/r/2276068 Reviewed-by: mobile promotions Tested-by: mobile promotions --- userspace/required_tests.json | 6 ++++++ userspace/units/fifo/tsg/gv11b/nvgpu-tsg-gv11b.c | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/userspace/required_tests.json b/userspace/required_tests.json index 0cebaff36..ee323776b 100644 --- a/userspace/required_tests.json +++ b/userspace/required_tests.json @@ -3365,6 +3365,12 @@ "unit": "nvgpu_tsg", "test_level": 0 }, + { + "test": "test_gv11b_tsg_bind_channel_eng_method_buffers", + "case": "gv11b_tsg_bind_channel_eng_method_buffers", + "unit": "nvgpu_tsg_gv11b", + "test_level": 0 + }, { "test": "test_gv11b_tsg_init_eng_method_buffers", "case": "gv11b_tsg_init_eng_method_buffers", diff --git a/userspace/units/fifo/tsg/gv11b/nvgpu-tsg-gv11b.c b/userspace/units/fifo/tsg/gv11b/nvgpu-tsg-gv11b.c index 113bb4873..76a5e186c 100644 --- a/userspace/units/fifo/tsg/gv11b/nvgpu-tsg-gv11b.c +++ b/userspace/units/fifo/tsg/gv11b/nvgpu-tsg-gv11b.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -238,10 +238,10 @@ int test_gv11b_tsg_bind_channel_eng_method_buffers(struct unit_module *m, if (branches & F_TSG_BIND_BUF_FAST_CE_RUNLIST_ID) { tsg->runlist_id = nvgpu_engine_get_fast_ce_runlist_id(g); - gpu_va = tsg->eng_method_buffers[ASYNC_CE_RUNQUE].gpu_va; + gpu_va = eng_method_buffers[ASYNC_CE_RUNQUE].gpu_va; } else { tsg->runlist_id = nvgpu_engine_get_gr_runlist_id(g); - gpu_va = tsg->eng_method_buffers[GR_RUNQUE].gpu_va; + gpu_va = eng_method_buffers[GR_RUNQUE].gpu_va; } nvgpu_mem_wr32(g, &ch->inst_block, @@ -259,7 +259,7 @@ int test_gv11b_tsg_bind_channel_eng_method_buffers(struct unit_module *m, } else { assert(nvgpu_mem_rd32(g, &ch->inst_block, - ram_in_eng_method_buffer_addr_lo_w()) != + ram_in_eng_method_buffer_addr_lo_w()) == u64_lo32(gpu_va)); assert(nvgpu_mem_rd32(g, &ch->inst_block, ram_in_eng_method_buffer_addr_hi_w()) == @@ -378,6 +378,8 @@ struct unit_module_test nvgpu_tsg_gv11b_tests[] = { UNIT_TEST(init_support, test_fifo_init_support, &unit_ctx, 0), UNIT_TEST(gv11b_tsg_init_eng_method_buffers, \ test_gv11b_tsg_init_eng_method_buffers, &unit_ctx, 0), + UNIT_TEST(gv11b_tsg_bind_channel_eng_method_buffers, + test_gv11b_tsg_bind_channel_eng_method_buffers, &unit_ctx, 0), UNIT_TEST(gv11b_tsg_unbind_channel_check_eng_faulted, \ test_gv11b_tsg_unbind_channel_check_eng_faulted, &unit_ctx, 0), UNIT_TEST(remove_support, test_fifo_remove_support, &unit_ctx, 0),