From 8bae56a075420bae48478cafe4b8400c00b4faac Mon Sep 17 00:00:00 2001 From: Dinesh T Date: Mon, 8 May 2023 17:34:02 +0000 Subject: [PATCH] gpu: nvgpu: Disabling Global context buffers commit for Compute engine Global context buffers are to be mapped and committed only for engine supporting gfx. With MIG, all engines support compute only hence skip that. Bug 4016530 Change-Id: I9f9a01070776f5fa1b18287e62a3080a42c21c60 Signed-off-by: Dinesh T Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2900314 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/gpu/nvgpu/common/gr/obj_ctx.c | 13 ++++++++----- userspace/required_tests.ini | 2 +- userspace/units/gr/setup/nvgpu-gr-setup.c | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/nvgpu/common/gr/obj_ctx.c b/drivers/gpu/nvgpu/common/gr/obj_ctx.c index 15adac92e..900d6e3f4 100644 --- a/drivers/gpu/nvgpu/common/gr/obj_ctx.c +++ b/drivers/gpu/nvgpu/common/gr/obj_ctx.c @@ -368,11 +368,13 @@ static void nvgpu_gr_obj_ctx_commit_veid0_preemption_buffers(struct gk20a *g, bool nvgpu_gr_obj_ctx_is_gfx_engine(struct gk20a *g, struct nvgpu_tsg_subctx *subctx) { if (nvgpu_is_enabled(g, NVGPU_SUPPORT_TSG_SUBCONTEXTS)) { - if (!nvgpu_is_enabled(g, NVGPU_SUPPORT_MIG) && + if ((subctx != NULL) && (!nvgpu_is_enabled(g, NVGPU_SUPPORT_MIG)) && nvgpu_tsg_subctx_get_id(subctx) == CHANNEL_INFO_VEID0) { return true; } - } else if (!nvgpu_is_enabled(g, NVGPU_SUPPORT_MIG)) { + } + + if (!nvgpu_is_enabled(g, NVGPU_SUPPORT_MIG)) { return true; } @@ -1085,7 +1087,8 @@ static int nvgpu_gr_golden_ctx_prepare_gr_ctx( } } err = nvgpu_gr_ctx_mappings_map_global_ctx_buffers(g, - gr->global_ctx_buffer, true, mappings, false); + gr->global_ctx_buffer, + nvgpu_gr_obj_ctx_is_gfx_engine(g, NULL), mappings, false); if (err != 0) { nvgpu_err(g, "map global ctx buffers failed err=%d", err); goto unmap_ctx_buffer; @@ -1184,14 +1187,14 @@ int nvgpu_gr_obj_ctx_init_golden_context_image(struct gk20a *g) } nvgpu_gr_obj_ctx_commit_global_ctx_buffers(g, gr->global_ctx_buffer, - gr->config, &gr_ctx, true, + gr->config, &gr_ctx, nvgpu_gr_obj_ctx_is_gfx_engine(g, NULL), &mappings, true); /* commit gr ctx buffer */ nvgpu_gr_obj_ctx_commit_inst(g, &inst_block, &gr_ctx, subctx, &mappings); err = nvgpu_gr_obj_ctx_alloc_golden_ctx_image(g, golden_image, gr->global_ctx_buffer, gr->config, &gr_ctx, - true, + nvgpu_gr_obj_ctx_is_gfx_engine(g, NULL), &mappings, &inst_block); if (err != 0) { nvgpu_err(g, "create golden image failed err=%d", err); diff --git a/userspace/required_tests.ini b/userspace/required_tests.ini index 789c8a137..5066261d3 100644 --- a/userspace/required_tests.ini +++ b/userspace/required_tests.ini @@ -673,7 +673,7 @@ test_gr_setup_free_obj_ctx.gr_setup_free_obj_ctx=0 test_gr_setup_preemption_mode_errors.gr_setup_preemption_mode_errors=2 test_gr_setup_set_preemption_mode.gr_setup_set_preemption_mode=0 test_gr_validate_subctx_gr_ctx_buffers.gr_setup_subctx_gr_ctx_buffers=0 -test_gr_validate_multi_as_subctx_gr_ctx_buffers.gr_setup_subctx_multi_as_gr_ctx_buffers=0 +test_gr_validate_multi_as_subctx_gr_ctx_buffers.gr_setup_subctx_multi_as_gr_ctx_buffers=2 test_gr_validate_subctx_inst_blocks.gr_setup_subctx_inst_blocks=0 test_gr_validate_ch_class_veid_pbdma.gr_setup_class_veid_pbdma=0 diff --git a/userspace/units/gr/setup/nvgpu-gr-setup.c b/userspace/units/gr/setup/nvgpu-gr-setup.c index d33a23f79..b0bd67f6f 100644 --- a/userspace/units/gr/setup/nvgpu-gr-setup.c +++ b/userspace/units/gr/setup/nvgpu-gr-setup.c @@ -1848,7 +1848,7 @@ struct unit_module_test nvgpu_gr_setup_tests[] = { UNIT_TEST(gr_setup_subctx_gr_ctx_buffers, test_gr_validate_subctx_gr_ctx_buffers, NULL, 0), UNIT_TEST(gr_setup_subctx_multi_as_gr_ctx_buffers, - test_gr_validate_multi_as_subctx_gr_ctx_buffers, NULL, 0), + test_gr_validate_multi_as_subctx_gr_ctx_buffers, NULL, 2), UNIT_TEST(gr_setup_subctx_inst_blocks, test_gr_validate_subctx_inst_blocks, NULL, 0), UNIT_TEST(gr_setup_class_veid_pbdma,