gpu: nvgpu: modify wait_pending

The wait_pending HAL is now modified to simply
check the pending status of a given runlist.
The while loop is removed from this HAL.

A new function nvgpu_runlist_wait_pending_legacy() is
added that emulates the older wait_pending() HAL.

nvgpu_runlist_tick() is modified to accept a 64 bit
"preempt_grace_ns" value.

These changes prepare for upcoming control-fifo parser
changes.

Jira NVGPU-8619

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: If3f288eb6f2181743c53b657219b3b30d56d26bc
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2766100
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Debarshi Dutta
2022-08-24 16:58:05 +05:30
committed by mobile promotions
parent 1e2817e022
commit 143034daab
23 changed files with 122 additions and 127 deletions

View File

@@ -744,7 +744,7 @@ test_fifo_init_support.init_support=0
test_fifo_remove_support.remove_support=0
test_gk20a_runlist_hw_submit.hw_submit=0
test_gk20a_runlist_length_max.length_max=0
test_gk20a_runlist_wait_pending.wait_pending=0
test_gk20a_runlist_wait_pending.check_pending=0
test_gk20a_runlist_write_state.write_state=0
[nvgpu_runlist_gv11b]

View File

@@ -177,22 +177,22 @@ int test_gk20a_runlist_wait_pending(struct unit_module *m,
/* no wait */
ctx->count = 0;
err = gk20a_runlist_wait_pending(g, runlist);
err = nvgpu_runlist_wait_pending_legacy(g, runlist);
unit_assert(err == 0, goto done);
/* 1 loop */
ctx->count = 1;
err = gk20a_runlist_wait_pending(g, runlist);
err = nvgpu_runlist_wait_pending_legacy(g, runlist);
unit_assert(err == 0, goto done);
/* 2 loops */
ctx->count = 2;
err = gk20a_runlist_wait_pending(g, runlist);
err = nvgpu_runlist_wait_pending_legacy(g, runlist);
unit_assert(err == 0, goto done);
/* timeout */
ctx->count = U32_MAX;
err = gk20a_runlist_wait_pending(g, runlist);
err = nvgpu_runlist_wait_pending_legacy(g, runlist);
unit_assert(err == -ETIMEDOUT, goto done);
ret = UNIT_SUCCESS;
@@ -235,7 +235,7 @@ struct unit_module_test nvgpu_runlist_gk20a_tests[] = {
UNIT_TEST(init_support, test_fifo_init_support, NULL, 0),
UNIT_TEST(length_max, test_gk20a_runlist_length_max, NULL, 0),
UNIT_TEST(hw_submit, test_gk20a_runlist_hw_submit, NULL, 0),
UNIT_TEST(wait_pending, test_gk20a_runlist_wait_pending, NULL, 0),
UNIT_TEST(check_pending, test_gk20a_runlist_wait_pending, NULL, 0),
UNIT_TEST(write_state, test_gk20a_runlist_write_state, NULL, 0),
UNIT_TEST(remove_support, test_fifo_remove_support, NULL, 0),
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2019-2022, 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"),
@@ -76,28 +76,28 @@ int test_gk20a_runlist_hw_submit(struct unit_module *m,
/**
* Test specification for: test_gk20a_runlist_wait_pending
*
* Description: Branch coverage for gk20a_runlist_wait_pending
* Description: Branch coverage for nvgpu_runlist_wait_pending_legacy
*
* Test Type: Feature
*
* Targets: gops_runlist.wait_pending, gk20a_runlist_wait_pending
* Targets: gops_runlist.check_pending, nvgpu_runlist_wait_pending_legacy
*
* Input: test_fifo_init_support() run for this GPU
*
* Steps:
* - Check case where runlist is not pending (not wait).
* - Set register to indicate that runlist is NOT pending.
* - Call gk20a_runlist_wait_pending.
* - Call nvgpu_runlist_wait_pending_legacy.
* - Check case where some polling is needed until runlist is not pending:
* - Install register IO callbacks in order to control
* value read from fifo_eng_runlist_r register.
* - Configure callback to clear pending bit after one nvgpu_readl.
* - Call gk20a_runlist_wait_pending.
* - Call nvgpu_runlist_wait_pending_legacy.
* - Configure callback to clear pending bit after two nvgpu_readl.
* - Call gk20a_runlist_wait_pending.
* - Call nvgpu_runlist_wait_pending_legacy.
* - Check case where polling times out:
* - Set register to indicate that runlist is pending.
* - Call gk20a_runlist_wait_pending.
* - Call nvgpu_runlist_wait_pending_legacy.
*
* Output: Returns PASS if all branches gave expected results. FAIL otherwise.
*/