From 12bc49a0787077da1cc0a8ee262c858eed6f1ef5 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Thu, 9 Jan 2020 16:07:15 +0530 Subject: [PATCH] gpu: nvgpu: unit: update dummy pes_tpc_mask for better coverage Update gr_test_config_get_pes_tpc_mask() to return 0x2F when called for third time. There are 2 PES in a GPC. So essentially we want to cover below two cases 1. pes_tpc_count[pes0][gpc0] > pes_tpc_count[pes1][gpc0] 2. pes_tpc_count[pes0][gpc0] < pes_tpc_count[pes1][gpc0] Also, run gr_test_diff_gpc_skip_mask() before gr_test_diff_pes_tpc_mask() so that gpc_skip_mask calculation can generate above two cases first. Jira NVGPU-4778 Change-Id: I1c34bbc36b0e126d34529725b6c45b59b7e66b67 Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2277156 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert GVS: Gerrit_Virtual_Submit Reviewed-by: Vinod Gopalakrishnakurup Reviewed-by: mobile promotions Tested-by: mobile promotions --- userspace/units/gr/config/nvgpu-gr-config.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/userspace/units/gr/config/nvgpu-gr-config.c b/userspace/units/gr/config/nvgpu-gr-config.c index 13fae0c59..9bb6682d8 100644 --- a/userspace/units/gr/config/nvgpu-gr-config.c +++ b/userspace/units/gr/config/nvgpu-gr-config.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"), @@ -86,7 +86,7 @@ static u32 gr_test_config_get_pes_tpc_mask(struct gk20a *g, if (gr_test_config_lits.pes_tpc_mask == 2) { return 0x1F; }else if (gr_test_config_lits.pes_tpc_mask == 3) { - return 0; + return 0x2F; }else if (gr_test_config_lits.pes_tpc_mask > 3) { return 0xF; }else { @@ -483,15 +483,20 @@ int test_gr_config_error_injection(struct unit_module *m, "gr_test_invalid_gpc_count test failed\n"); } - /* Pass with diff pes_tpc_mask */ - err = gr_test_diff_pes_tpc_mask(g); + /* Pass with diff gpc_skip_mask */ + err = gr_test_diff_gpc_skip_mask(g); if (err != 0) { unit_return_fail(m, "gr_test_invalid_pes_tpc_mask test failed\n"); } - /* Pass with diff gpc_skip_mask */ - err = gr_test_diff_gpc_skip_mask(g); + /* + * Pass with diff pes_tpc_mask. + * Run this after gr_test_diff_gpc_skip_mask() so that this + * test receives appropriate pes_tpc_mask from + * gr_test_config_get_pes_tpc_mask(). + */ + err = gr_test_diff_pes_tpc_mask(g); if (err != 0) { unit_return_fail(m, "gr_test_invalid_pes_tpc_mask test failed\n");