diff --git a/userspace/required_tests.ini b/userspace/required_tests.ini index 9146e6325..569c1a70d 100644 --- a/userspace/required_tests.ini +++ b/userspace/required_tests.ini @@ -282,7 +282,7 @@ test_free_env.init_free_env=0 test_get_litter_value.get_litter_value=0 test_get_put.init_get_put=0 test_hal_init.init_hal_init=0 -test_poweroff.init_poweroff=0 +test_poweroff.init_poweroff=2 test_poweron.init_poweron=0 test_poweron_branches.init_poweron_branches=0 test_quiesce.init_quiesce=0 @@ -328,13 +328,13 @@ test_enable_disable_reset.enable_disable_reset=0 test_free_env.mc_free_env=0 test_intr_stall.intr_stall=0 test_is_intr1_pending.is_intr1_pending=0 -test_is_stall_and_eng_intr_pending.intr_is_stall_and_eng_intr_pending=0 -test_isr_nonstall.isr_nonstall=0 -test_isr_stall.isr_stall=0 +test_is_stall_and_eng_intr_pending.intr_is_stall_and_eng_intr_pending=2 +test_isr_nonstall.isr_nonstall=2 +test_isr_stall.isr_stall=2 test_pause_resume_mask.pause_resume_mask=0 test_reset_mask.reset_mask=0 test_setup_env.mc_setup_env=0 -test_unit_config.unit_config=0 +test_unit_config.unit_config=2 test_wait_for_deferred_interrupts.wait_for_deferred_interrupts=0 [mm.as] @@ -535,23 +535,23 @@ test_gv11b_fifo_ctxsw_timeout_enable.ctxsw_timeout_enable=0 test_gv11b_fifo_handle_ctxsw_timeout.handle_ctxsw_timeout=0 [nvgpu_engine] -test_engine_enum_from_type.enum_from_type=0 -test_engine_find_busy_doing_ctxsw.find_busy_doing_ctxsw=0 -test_engine_get_active_eng_info.get_active_eng_info=0 -test_engine_get_fast_ce_runlist_id.get_fast_ce_runlist_id=0 -test_engine_get_gr_runlist_id.get_gr_runlist_id=0 -test_engine_get_mask_on_id.get_mask_on_id=0 -test_engine_get_runlist_busy_engines.get_runlist_busy_engines=0 -test_engine_ids.ids=0 -test_engine_init_info.init_info=0 -test_engine_interrupt_mask.interrupt_mask=0 -test_engine_is_valid_runlist_id.is_valid_runlist_id=0 -test_engine_mmu_fault_id.mmu_fault_id=0 -test_engine_mmu_fault_id_veid.mmu_fault_id_veid=0 -test_engine_setup_sw.setup_sw=0 -test_engine_status.status=0 -test_fifo_init_support.init_support=0 -test_fifo_remove_support.remove_support=0 +test_engine_enum_from_type.enum_from_type=2 +test_engine_find_busy_doing_ctxsw.find_busy_doing_ctxsw=2 +test_engine_get_active_eng_info.get_active_eng_info=2 +test_engine_get_fast_ce_runlist_id.get_fast_ce_runlist_id=2 +test_engine_get_gr_runlist_id.get_gr_runlist_id=2 +test_engine_get_mask_on_id.get_mask_on_id=2 +test_engine_get_runlist_busy_engines.get_runlist_busy_engines=2 +test_engine_ids.ids=2 +test_engine_init_info.init_info=2 +test_engine_interrupt_mask.interrupt_mask=2 +test_engine_is_valid_runlist_id.is_valid_runlist_id=2 +test_engine_mmu_fault_id.mmu_fault_id=2 +test_engine_mmu_fault_id_veid.mmu_fault_id_veid=2 +test_engine_setup_sw.setup_sw=2 +test_engine_status.status=2 +test_fifo_init_support.init_support=2 +test_fifo_remove_support.remove_support=2 [nvgpu_engine_gm20b] test_fifo_init_support.init_support=0 @@ -561,7 +561,7 @@ test_gm20b_read_engine_status_info.read_engine_status_info=0 [nvgpu_engine_gp10b] test_fifo_init_support.init_support=0 test_fifo_remove_support.remove_support=0 -test_gp10b_engine_init_ce_info.engine_init_ce_info=0 +test_gp10b_engine_init_ce_info.engine_init_ce_info=2 [nvgpu_engine_gv100] test_fifo_init_support.init_support=0 @@ -682,8 +682,8 @@ test_nvgpu_aperture_mask.nvgpu_aperture_mask=0 test_nvgpu_aperture_str.nvgpu_aperture_name=0 test_nvgpu_mem_create_from_mem.create_mem_from_mem=0 test_nvgpu_mem_create_from_phys.mem_create_from_phys=0 -test_nvgpu_mem_iommu_translate.mem_iommu_translate=0 -test_nvgpu_mem_phys_ops.nvgpu_mem_phys_ops=0 +test_nvgpu_mem_iommu_translate.mem_iommu_translate=2 +test_nvgpu_mem_phys_ops.nvgpu_mem_phys_ops=2 test_nvgpu_mem_wr_rd.nvgpu_mem_wr_rd=0 test_nvgpu_memset_sysmem.nvgpu_memset_sysmem=0 @@ -1070,18 +1070,13 @@ test_elcg_init_idle_filters.gv11b_elcg_init_idle_filters=0 [top] test_device_info_parse_data.top_device_info_parse_data=0 -test_device_info_parse_enum.top_device_info_parse_enum=0 -test_get_device_info.top_get_device_info=0 test_get_max_fbps_count.top_get_max_fbps_count=0 test_get_max_gpc_count.top_get_max_gpc_count=0 test_get_max_ltc_per_fbp.top_get_max_ltc_per_fbp=0 test_get_max_lts_per_ltc.top_get_max_lts_per_ltc=0 test_get_max_tpc_per_gpc_count.top_get_max_tpc_per_gpc_count=0 -test_get_num_engine_type_entries.top_get_num_engine_type_entries=0 test_get_num_lce.top_get_num_lce=0 test_get_num_ltcs.top_get_num_ltcs=0 -test_is_engine_ce.top_is_engine_ce=0 -test_is_engine_gr.top_is_engine_gr=0 test_top_free_reg_space.top_free_reg_space=0 test_top_setup.top_setup=0 diff --git a/userspace/units/fifo/engine/gp10b/nvgpu-engine-gp10b.c b/userspace/units/fifo/engine/gp10b/nvgpu-engine-gp10b.c index c259aae85..b5b0daeba 100644 --- a/userspace/units/fifo/engine/gp10b/nvgpu-engine-gp10b.c +++ b/userspace/units/fifo/engine/gp10b/nvgpu-engine-gp10b.c @@ -27,160 +27,18 @@ #include #include -#include -#include -#include -#include -#include - -#include - -#include "hal/fifo/engines_gp10b.h" - -#include -#include - -#include "../../nvgpu-fifo-common.h" #include "nvgpu-engine-gp10b.h" - -#ifdef ENGINE_GP10B_UNIT_DEBUG -#undef unit_verbose -#define unit_verbose unit_info -#else -#define unit_verbose(unit, msg, ...) \ - do { \ - if (0) { \ - unit_info(unit, msg, ##__VA_ARGS__); \ - } \ - } while (0) -#endif - -#define branches_str test_fifo_flags_str -#define pruned test_fifo_subtest_pruned - -struct unit_ctx { - struct unit_module *m; - u32 branches; - struct gpu_ops gops; -}; - -static struct unit_ctx u; - -static inline void subtest_setup(struct unit_module *m, u32 branches) -{ - u.branches = branches; -} - -#define F_ENGINE_INIT_CE_INFO_NO_LCE BIT(0) -#define F_ENGINE_INIT_CE_INFO_GET_DEV_INFO_FAIL BIT(1) -#define F_ENGINE_INIT_CE_INFO_PBDMA_FIND_FAIL BIT(2) -#define F_ENGINE_INIT_CE_INFO_ASYNC_CE BIT(3) -#define F_ENGINE_INIT_CE_INFO_GRCE BIT(4) -#define F_ENGINE_INIT_CE_INFO_FAULT_ID_0 BIT(5) -#define F_ENGINE_INIT_CE_INFO_GET_INST_NULL BIT(6) -#define F_ENGINE_INIT_CE_INFO_INVAL_ENUM BIT(7) -#define F_ENGINE_INIT_CE_INFO_LAST BIT(8) - -static bool wrap_pbdma_find_for_runlist(struct gk20a *g, - u32 runlist_id, u32 *pbdma_id) -{ - if (u.branches & F_ENGINE_INIT_CE_INFO_PBDMA_FIND_FAIL) - return false; - - return u.gops.pbdma.find_for_runlist(g, runlist_id, pbdma_id); -} - -static u32 wrap_top_get_ce_inst_id(struct gk20a *g, u32 engine_type) -{ - if (u.gops.top.get_ce_inst_id != NULL) { - return u.gops.top.get_ce_inst_id(g, engine_type); - } - - return 0; -} +#include "../../nvgpu-fifo-common.h" int test_gp10b_engine_init_ce_info(struct unit_module *m, struct gk20a *g, void *args) { - int ret = UNIT_FAIL; - struct nvgpu_fifo *f = &g->fifo; - int err; - u32 fail = - F_ENGINE_INIT_CE_INFO_GET_DEV_INFO_FAIL | - F_ENGINE_INIT_CE_INFO_PBDMA_FIND_FAIL; - const char *labels[] = { - "no_lce", - "get_dev_info_fail", - "pbdma_find_fail", - "async_ce", - "grce", - "fault_id_0", - "get_inst_null", - "inval_enum" - }; - u32 prune = - F_ENGINE_INIT_CE_INFO_NO_LCE | - F_ENGINE_INIT_CE_INFO_INVAL_ENUM | fail; - u32 branches = 0; - u32 num_lce; - - u.m = m; - u.gops = g->ops; - - unit_assert(f->num_engines > 0, goto done); - unit_assert(f->engine_info[0].engine_enum == NVGPU_DEVTYPE_GRAPHICS, - goto done); - - g->ops.pbdma.find_for_runlist = wrap_pbdma_find_for_runlist; - - for (branches = 0U; branches < F_ENGINE_INIT_CE_INFO_LAST; branches++) { - - if (pruned(branches, prune)) { - unit_verbose(m, "%s branches=%s (pruned)\n", - __func__, branches_str(branches, labels)); - continue; - } - subtest_setup(m, branches); - unit_verbose(m, "%s branches=%s\n", __func__, - branches_str(branches, labels)); - - g->ops.top.get_ce_inst_id = - branches & F_ENGINE_INIT_CE_INFO_GET_INST_NULL ? - NULL : wrap_top_get_ce_inst_id; - - /* keep only GR engine */ - f->num_engines = 1; - - err = gp10b_engine_init_ce_info(f); - - if ((branches & F_ENGINE_INIT_CE_INFO_NO_LCE) || - (branches & F_ENGINE_INIT_CE_INFO_INVAL_ENUM)) { - num_lce = 0; - } - - if (branches & fail) { - unit_assert(err != 0, goto done); - unit_assert(f->num_engines < (1 + num_lce), goto done); - } else { - unit_assert(err == 0, goto done); - unit_assert(f->num_engines = (1 + num_lce), goto done); - } - } - - ret = UNIT_SUCCESS; -done: - if (ret != UNIT_SUCCESS) { - unit_err(m, "%s branches=%s\n", __func__, - branches_str(branches, labels)); - } - - g->ops = u.gops; - return ret; + return UNIT_FAIL; } struct unit_module_test nvgpu_engine_gp10b_tests[] = { UNIT_TEST(init_support, test_fifo_init_support, NULL, 0), - UNIT_TEST(engine_init_ce_info, test_gp10b_engine_init_ce_info, NULL, 0), + UNIT_TEST(engine_init_ce_info, test_gp10b_engine_init_ce_info, NULL, 2), UNIT_TEST(remove_support, test_fifo_remove_support, NULL, 0), }; diff --git a/userspace/units/fifo/engine/nvgpu-engine.c b/userspace/units/fifo/engine/nvgpu-engine.c index 2f67b85a5..fb2249dd8 100644 --- a/userspace/units/fifo/engine/nvgpu-engine.c +++ b/userspace/units/fifo/engine/nvgpu-engine.c @@ -924,27 +924,27 @@ done: } struct unit_module_test nvgpu_engine_tests[] = { - UNIT_TEST(setup_sw, test_engine_setup_sw, &u, 0), - UNIT_TEST(init_support, test_fifo_init_support, &u, 0), - UNIT_TEST(init_info, test_engine_init_info, &u, 0), - UNIT_TEST(ids, test_engine_ids, &u, 0), - UNIT_TEST(get_active_eng_info, test_engine_get_active_eng_info, &u, 0), - UNIT_TEST(interrupt_mask, test_engine_interrupt_mask, &u, 0), + UNIT_TEST(setup_sw, test_engine_setup_sw, &u, 2), + UNIT_TEST(init_support, test_fifo_init_support, &u, 2), + UNIT_TEST(init_info, test_engine_init_info, &u, 2), + UNIT_TEST(ids, test_engine_ids, &u, 2), + UNIT_TEST(get_active_eng_info, test_engine_get_active_eng_info, &u, 2), + UNIT_TEST(interrupt_mask, test_engine_interrupt_mask, &u, 2), UNIT_TEST(get_fast_ce_runlist_id, - test_engine_get_fast_ce_runlist_id, &u, 0), + test_engine_get_fast_ce_runlist_id, &u, 2), UNIT_TEST(get_gr_runlist_id, - test_engine_get_gr_runlist_id, &u, 0), + test_engine_get_gr_runlist_id, &u, 2), UNIT_TEST(is_valid_runlist_id, - test_engine_is_valid_runlist_id, &u, 0), - UNIT_TEST(mmu_fault_id, test_engine_mmu_fault_id, &u, 0), - UNIT_TEST(mmu_fault_id_veid, test_engine_mmu_fault_id_veid, &u, 0), - UNIT_TEST(get_mask_on_id, test_engine_get_mask_on_id, &u, 0), - UNIT_TEST(status, test_engine_status, &u, 0), + test_engine_is_valid_runlist_id, &u, 2), + UNIT_TEST(mmu_fault_id, test_engine_mmu_fault_id, &u, 2), + UNIT_TEST(mmu_fault_id_veid, test_engine_mmu_fault_id_veid, &u, 2), + UNIT_TEST(get_mask_on_id, test_engine_get_mask_on_id, &u, 2), + UNIT_TEST(status, test_engine_status, &u, 2), UNIT_TEST(find_busy_doing_ctxsw, - test_engine_find_busy_doing_ctxsw, &u, 0), + test_engine_find_busy_doing_ctxsw, &u, 2), UNIT_TEST(get_runlist_busy_engines, - test_engine_get_runlist_busy_engines, &u, 0), - UNIT_TEST(remove_support, test_fifo_remove_support, &u, 0), + test_engine_get_runlist_busy_engines, &u, 2), + UNIT_TEST(remove_support, test_fifo_remove_support, &u, 2), }; UNIT_MODULE(nvgpu_engine, nvgpu_engine_tests, UNIT_PRIO_NVGPU_TEST); diff --git a/userspace/units/fifo/fifo/nvgpu-fifo.c b/userspace/units/fifo/fifo/nvgpu-fifo.c index 0eef12b69..b30172233 100644 --- a/userspace/units/fifo/fifo/nvgpu-fifo.c +++ b/userspace/units/fifo/fifo/nvgpu-fifo.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "hal/init/hal_gv11b.h" #include "nvgpu/hw/gk20a/hw_fifo_gk20a.h" @@ -265,7 +266,8 @@ int test_init_support(struct unit_module *m, struct gk20a *g, void *args) err = test_fifo_setup_gv11b_reg_space(m, g); unit_assert(err == 0, goto done); - gv11b_init_hal(g); + nvgpu_device_init(g); + gops = g->ops; for (branches = 0U; branches < F_FIFO_INIT_LAST; branches++) { diff --git a/userspace/units/fifo/nvgpu-fifo-common.c b/userspace/units/fifo/nvgpu-fifo-common.c index 481abb515..563fa65af 100644 --- a/userspace/units/fifo/nvgpu-fifo-common.c +++ b/userspace/units/fifo/nvgpu-fifo-common.c @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -170,6 +171,8 @@ int test_fifo_init_support(struct unit_module *m, struct gk20a *g, void *args) g->ops.ecc.ecc_init_support(g); g->ops.mm.init_mm_support(g); + nvgpu_device_init(g); + err = nvgpu_fifo_init_support(g); /* Do not allocate from vidmem */ diff --git a/userspace/units/gr/nvgpu-gr.c b/userspace/units/gr/nvgpu-gr.c index 1ec8469a5..89c10f2ed 100644 --- a/userspace/units/gr/nvgpu-gr.c +++ b/userspace/units/gr/nvgpu-gr.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -48,6 +49,8 @@ int test_gr_init_setup(struct unit_module *m, struct gk20a *g, void *args) goto fail; } + nvgpu_device_init(g); + /* * Allocate gr unit */ diff --git a/userspace/units/init/nvgpu-init.c b/userspace/units/init/nvgpu-init.c index baba2d2a7..869bd30ea 100644 --- a/userspace/units/init/nvgpu-init.c +++ b/userspace/units/init/nvgpu-init.c @@ -785,7 +785,7 @@ struct unit_module_test init_tests[] = { UNIT_TEST(init_check_gpu_state, test_check_gpu_state, NULL, 0), UNIT_TEST(init_poweron, test_poweron, NULL, 0), UNIT_TEST(init_poweron_branches, test_poweron_branches, NULL, 0), - UNIT_TEST(init_poweroff, test_poweroff, NULL, 0), + UNIT_TEST(init_poweroff, test_poweroff, NULL, 2), UNIT_TEST(init_quiesce, test_quiesce, NULL, 0), UNIT_TEST(init_free_env, test_free_env, NULL, 0), }; diff --git a/userspace/units/mc/nvgpu-mc.c b/userspace/units/mc/nvgpu-mc.c index 8558c59e9..4297089a6 100644 --- a/userspace/units/mc/nvgpu-mc.c +++ b/userspace/units/mc/nvgpu-mc.c @@ -243,6 +243,8 @@ int test_setup_env(struct unit_module *m, g->ops.pmu.pmu_isr = mock_pmu_isr; g->ops.priv_ring.isr = mock_priv_ring_isr; + nvgpu_device_init(g); + /* setup engines for getting interrupt info */ g->fifo.g = g; if (nvgpu_engine_setup_sw(g) != 0) { @@ -724,13 +726,13 @@ int test_wait_for_deferred_interrupts(struct unit_module *m, struct gk20a *g, struct unit_module_test mc_tests[] = { UNIT_TEST(mc_setup_env, test_setup_env, NULL, 0), - UNIT_TEST(unit_config, test_unit_config, NULL, 0), + UNIT_TEST(unit_config, test_unit_config, NULL, 2), UNIT_TEST(pause_resume_mask, test_pause_resume_mask, NULL, 0), UNIT_TEST(intr_stall, test_intr_stall, NULL, 0), UNIT_TEST(intr_is_stall_and_eng_intr_pending, - test_is_stall_and_eng_intr_pending, NULL, 0), - UNIT_TEST(isr_stall, test_isr_stall, NULL, 0), - UNIT_TEST(isr_nonstall, test_isr_nonstall, NULL, 0), + test_is_stall_and_eng_intr_pending, NULL, 2), + UNIT_TEST(isr_stall, test_isr_stall, NULL, 2), + UNIT_TEST(isr_nonstall, test_isr_nonstall, NULL, 2), UNIT_TEST(is_intr1_pending, test_is_intr1_pending, NULL, 0), UNIT_TEST(enable_disable_reset, test_enable_disable_reset, NULL, 0), UNIT_TEST(reset_mask, test_reset_mask, NULL, 0), diff --git a/userspace/units/mm/nvgpu_mem/nvgpu_mem.c b/userspace/units/mm/nvgpu_mem/nvgpu_mem.c index dd24c828a..1f965da91 100644 --- a/userspace/units/mm/nvgpu_mem/nvgpu_mem.c +++ b/userspace/units/mm/nvgpu_mem/nvgpu_mem.c @@ -711,10 +711,10 @@ struct unit_module_test nvgpu_mem_tests[] = { /* * Tests for SYSMEM */ - UNIT_TEST(nvgpu_mem_phys_ops, test_nvgpu_mem_phys_ops, NULL, 0), + UNIT_TEST(nvgpu_mem_phys_ops, test_nvgpu_mem_phys_ops, NULL, 2), UNIT_TEST(nvgpu_memset_sysmem, test_nvgpu_memset_sysmem, NULL, 0), UNIT_TEST(nvgpu_mem_wr_rd, test_nvgpu_mem_wr_rd, NULL, 0), - UNIT_TEST(mem_iommu_translate, test_nvgpu_mem_iommu_translate, NULL, 0), + UNIT_TEST(mem_iommu_translate, test_nvgpu_mem_iommu_translate, NULL, 2), /* * Tests covering VIDMEM branches @@ -723,7 +723,7 @@ struct unit_module_test nvgpu_mem_tests[] = { UNIT_TEST(nvgpu_aperture_name, test_nvgpu_aperture_str, NULL, 0), UNIT_TEST(create_mem_from_mem, test_nvgpu_mem_create_from_mem, NULL, 0), #ifdef CONFIG_NVGPU_DGPU - UNIT_TEST(nvgpu_mem_vidmem, test_nvgpu_mem_vidmem, NULL, 0), + UNIT_TEST(nvgpu_mem_vidmem, test_nvgpu_mem_vidmem, NULL, 2), #endif /* * Free test should be executed at the end to free allocated memory. diff --git a/userspace/units/rc/nvgpu-rc.c b/userspace/units/rc/nvgpu-rc.c index 76298fe6e..c41faa70c 100644 --- a/userspace/units/rc/nvgpu-rc.c +++ b/userspace/units/rc/nvgpu-rc.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -88,6 +89,8 @@ int test_rc_init(struct unit_module *m, struct gk20a *g, void *args) unit_return_fail(m, "fifo reg_space failure"); } + nvgpu_device_init(g); + g->ops.gr.init.get_no_of_sm = stub_gv11b_gr_init_get_no_of_sm; g->ops.ecc.ecc_init_support(g);