mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 01:50:07 +03:00
gpu: nvgpu: unit: improve coverage for quiesce
Add more cases for branch coverage of the following functions: - nvgpu_sw_quiesce - nvgpu_sw_quiesce_init_support - nvgpu_sw_quiesce_bug_cb Add SWUTS steps for test_quiesce. Jira NVGPU-4905 Change-Id: Ib14c03f30bb7556123faf4d49abf2b307b82014b Signed-off-by: Thomas Fleury <tfleury@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2280610 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Philip Elcan <pelcan@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
Alex Waterman
parent
1f2f414fde
commit
726d2a8d4a
@@ -740,8 +740,11 @@ int test_quiesce(struct unit_module *m, struct gk20a *g, void *args)
|
||||
nvgpu_thread_join(&g->sw_quiesce_thread);
|
||||
|
||||
if (!intr_masked) {
|
||||
unit_err(m, "quiesce failed to mask interrupts\n");
|
||||
ret = UNIT_FAIL;
|
||||
unit_return_fail(m, "quiesce failed to mask interrupts\n");
|
||||
}
|
||||
|
||||
if (nvgpu_can_busy(g)) {
|
||||
unit_return_fail(m, "nvgpu_can_busy() should be false\n");
|
||||
}
|
||||
|
||||
/* setup quiesce again */
|
||||
@@ -767,6 +770,30 @@ int test_quiesce(struct unit_module *m, struct gk20a *g, void *args)
|
||||
unit_return_fail(m, "failed to re-enable quiesce\n");
|
||||
}
|
||||
|
||||
/* setup quiesce again */
|
||||
nvgpu_sw_quiesce_remove_support(g);
|
||||
set_poweron_funcs_success(g);
|
||||
err = nvgpu_finalize_poweron(g);
|
||||
if (err != 0) {
|
||||
unit_return_fail(m, "failed to re-enable quiesce\n");
|
||||
}
|
||||
|
||||
/* make sure we simulate interrupts enabled */
|
||||
intr_masked = false;
|
||||
|
||||
err = EXPECT_BUG(BUG());
|
||||
if (err == 0) {
|
||||
unit_return_fail(m, "BUG() was expected\n");
|
||||
}
|
||||
|
||||
/* wait for quiesce thread to complete */
|
||||
nvgpu_thread_join(&g->sw_quiesce_thread);
|
||||
|
||||
if (!intr_masked) {
|
||||
unit_err(m, "BUG() was expected to quiesce\n");
|
||||
ret = UNIT_FAIL;
|
||||
}
|
||||
|
||||
/* branch coverage for error states when requesting quiesce */
|
||||
g->is_virtual = true;
|
||||
nvgpu_sw_quiesce(g);
|
||||
@@ -783,6 +810,19 @@ int test_quiesce(struct unit_module *m, struct gk20a *g, void *args)
|
||||
nvgpu_set_enabled(g, NVGPU_DISABLE_SW_QUIESCE, false);
|
||||
/* Note: quiesce should still be configured */
|
||||
|
||||
/* coverage for quiesce already requested */
|
||||
g->sw_quiesce_pending = true;
|
||||
nvgpu_sw_quiesce(g);
|
||||
g->sw_quiesce_pending = false;
|
||||
|
||||
/* coverage for quiesce not initialized */
|
||||
g->sw_quiesce_init_done = false;
|
||||
nvgpu_sw_quiesce(g);
|
||||
g->sw_quiesce_init_done = true;
|
||||
if (g->sw_quiesce_pending) {
|
||||
unit_return_fail(m, "unexpected quiesce pending\n");
|
||||
}
|
||||
|
||||
/* coverage for device powered off when quiesce requested */
|
||||
nvgpu_set_power_state(g, NVGPU_STATE_POWERED_OFF);
|
||||
nvgpu_sw_quiesce(g);
|
||||
|
||||
Reference in New Issue
Block a user