Commit Graph

81 Commits

Author SHA1 Message Date
Tejal Kudav
c8c8e59a46 gpu: nvgpu: unit: add priv_ring unit tests
Add unit tests for common.priv_ring unit.

JIRA NVGPU-934

Change-Id: Ic825f571a3032cf9a194773df09a255bcba1bf79
Signed-off-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2248567
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Thomas Fleury
1ab3f73230 gpu: nvgpu: unit: improve coverage for gm20b channel HAL
Add unit test for the following HAL:
- gm20b_channel_force_ctx_reload

Jira NVGPU-4384

Change-Id: Icb802348349a790371e6d84efe449c309105c5e8
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2250014
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
ajesh
c46a68c231 gpu: nvgpu: add rwsem unit test
Add unit tests for rwsem unit.

Jira NVGPU-2698

Change-Id: Id8c6f336b3cc2c458f42a8c21a9bace3a7711e05
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2208425
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Deepak Nibade
df5924cf57 gpu: nvgpu: unit: add common.class unit tests
Add unit tests for API exposed by common.class unit

Jira NVGPU-4373

Change-Id: Id72df78c5a3c8a85ac71dd3b559d19c296c87b5f
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2246808
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Tejal Kudav
836abc253d gpu: nvgpu: unit: common.fbp tests
Add unit tests for all the APIs exposed by common.fbp unit.

JIRA NVGPU-4393

Change-Id: I4aef64359919418ee5446925331fa9ef9eb5d5f0
Signed-off-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2244373
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Thomas Fleury
0ba37ecf4d gpu: nvgpu: unit: enable pbdma tests on target
Add missing pbdma, runlist and channel files to tmake
makefile and fix compilation issues.
Update exports to fix link issues.
Update required tests in JSON file.

Jira NVGPU-3490

Change-Id: Ib5f7dd15ebbd81c5f5f304f8c22ea8299c469a93
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2247248
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
vinodg
2a81cea0e0 gpu: nvgpu: unit: setup preemption error test
Add Setup set_preemption_mode error tests with
test_gr_setup_preemption_mode_errors function.

Update Doxygen for test_gr_setup_preemption_mode_errors.

Jira NVGPU-3698

Change-Id: I21e84c9f7f2618656cb6b79b97802e182aed4516
Signed-off-by: vinodg <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2247378
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Philip Elcan
95c3e56961 gpu: nvgpu: unit: propagate fault injection to threads
Change approach to how the fault injection state is stored to facilitate
propagating fault injection state to child-threads. Rather than each
unit maintaining a thread-local object, there is a thread-local
container stored in the posix-fault-injection itself. This container is
initialized for each test module so that is independent of other other
test modules (for parallel test module execution). When child threads
are created with nvgpu_create_thread(), the fault injection container is
configured for the child.

JIRA NVGPU-3981

Change-Id: I9b580dc7f1621a7770eef8eba796f3918f2738bf
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2238474
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Sagar Kamble
a8c9c800cd gpu: nvgpu: reorganization of MC interrupts control
Previously, unit interrupt enabling/disabling and corresponding MC level
interrupt enabling/disabling was not done at the same time.
With this change, stall and nonstall interrupt for units are programmed
at MC level along with individual unit interrupts. Kept access to MC
interrupt registers through mc.intr_lock spinlock.

For doing this separated CE and GR interrupt mask functions.
mc.intr_enable is only used when there is global interrupt
control to be set. Removed mc_gp10b.c as mc_gp10b_intr_enable
is now removed. Removed following functions - mc_gv100_intr_enable,
mc_gv11b_intr_enable & intr_tu104_enable. Removed intr_pmu_unit_config
as we can use the generic unit interrupt control function.

JIRA NVGPU-4336

Change-Id: Ibd296d4a60fda6ba930f18f518ee56ab3f9dacad
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2196178
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Philip Elcan
d9230e4087 gpu: nvgpu: unit: init: add testing for get_litter API
Add unit testing for gv11b_get_litter_value().

JIRA NVGPU-927

Change-Id: I9ddfbe5780ce1a383818672837f8f052c663cac7
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2245610
Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Divya Singhatwaria
15c9355c69 gpu: nvgpu: Add more test scenarios for ACR unit
Add more test scenarios for nvgpu_acr_bootstrap_hs_acr()
and nvgpu_acr_construct_execute() to cover more
branches and fail scenarios

JIRA NVGPU-4319

Change-Id: Ifae3fdce87c4a42d0fbdb4dff25dfb10537f31d0
Signed-off-by: Divya Singhatwaria <dsinghatwari@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2238098
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Tejal Kudav
59282bdee8 gpu: nvgpu: unit: common.top tests
Add unit tests for all the HALs exposed by common.top unit.

JIRA NVGPU-2204

Change-Id: Id4866e181ba495c6e7d827ae534b76070677aa0e
Signed-off-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2243164
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Thomas Fleury
d7e629de4f gpu: nvgpu: unit: add tests for gk20a runlist HAL
Added unit tests for the following HALs:
- gk20a_runlist_length_max
- gk20a_runlist_hw_submit
- gk20a_runlist_wait_pending
- gk20a_runlist_write_state

Jira NVGPU-3793

Change-Id: I710b702662693771d11341971137e6f8fa47cf9b
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2239478
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Thomas Fleury
0130ebd349 gpu: nvgpu: unit: add tests for gv11b runlist HAL
Add unit tests for the following HALs:
- gv11b_runlist_entry_size
- gv11b_runlist_get_tsg_entry
- gv11b_runlist_get_ch_entry

Jira NVGPU-3793

Change-Id: If4c574efacc316e6c410b3f2872fd41b1470011b
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2239477
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
ajesh
d7dcc2b77e gpu: nvgpu: add ut for posix kmem
Add unit tests for posix kmem unit.

Jira NVGPU-2658

Change-Id: If2b8a3eb44d0f440d10ab0aade36ba334d0de329
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2237255
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
ajesh
1241cb3014 gpu: nvgpu: add UT for os_sched
Add unit tests for posix os_sched unit.

Jira NVGPU-2689

Change-Id: Ideaf6ad8a0b2419efbe4e8960afa46a30f9f0e7a
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2215620
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Philip Elcan
1f3cdf361f gpu: nvgpu: unit: add ptimer unit test
Add unit test for common.ptimer unit.

JIRA NVGPU-2238

Change-Id: I55be34e324ab407f341b9e82070f92e83f154681
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2235288
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dinesh T <dt@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Divya Singhatwaria
3853636720 gpu: nvgpu: Adding more tests in ACR unit
Test the following function:
nvgpu_acr_construct_execute()

Also, add check for "invalid falcon id"
in the function nvgpu_acr_is_lsf_lazy_bootstrap()

JIRA NVGPU-4123

Change-Id: Icedca3eec76f5cedbd5f2857755a0a79c476dc8b
Signed-off-by: Divya Singhatwaria <dsinghatwari@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2214742
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Nicolas Benech
cb2170d3c8 gpu: nvgpu: unit: add tests for common.mm.vm_area
Expand testing within commom.mm.vm to include vm_area as well since
those 2 units are very closely related.

JIRA NVGPU-909

Change-Id: Id9721bcf4bfdaf7f1a2711859ab2ac524c81e004
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2231656
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Philip Elcan
49a620e48a gpu: nvgpu: mm: limit recursion depth for pd levels
The two MM functions nvgpu_set_pd_level() and nvgpu_vm_do_free_entries()
are simple recursive functions for processing page descriptors (PDs) by
traversing the levels in the PDs. MISRA Rule 17.2 prohibits functions
calling themselves because "unless recursion is tightly controlled, it
is not possible to determine before execution what the worst-case stack
usage could be." So, this change limits the recursion depth of each of
these functions to the maximum number of page table levels by checking
the level against the MM HAL max_page_table_levels().

This also required configuring this HAL in various unit tests as they
were no previously using this HAL.

JIRA NVGPU-3489

Change-Id: Iadee3fa5ba9f45cd643ac6c202e9296d75d51880
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2224450
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Sagar Kamble
222dfacb11 gpu: nvgpu: fix the falcon unit and unit tests
nvgpu_falcon_setup_bootstrap_config functionality can be kept static.
nvgpu_falcon_bl_bootstrap and nvgpu_falcon_bl_info are removed as it
is replaced by nvgpu_falcon_hs_ucode_load_bootstrap.
Update the test case accordingly, SWUTS and doxygen comments. Other
nits addressed about doxygen documentation.

JIRA NVGPU-2412

Change-Id: Idaa670ce6d6d6b735b4a2af34e1f1a229ff2a3e9
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2220089
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Philip Elcan
c6affb85ba gpu: nvgpu: unit: init: cleanup quiesce
The init unit test starts the quiesce feature during testing. This
includes starting the quiesce thread. The thread should be stopped when
the init unit tests complete, so call nvgpu_sw_quiesce_remove_support()
when complete.

Bug 2732985

Change-Id: I701e1dd1ce753781fa81327e3cdc7e2881a33d00
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2224307
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Thomas Fleury <tfleury@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>
2020-12-15 14:10:29 -06:00
Nicolas Benech
0f5c61748a gpu: nvgpu: unit: increase coverage of mm.vm
This patch brings a number of changes to the mm.vm unit test:
- test_map_buf: add steps to check for error cases and increase
  coverage.
- test_map_buf_gpu_va: add steps to check for error cases and
  increase coverage.
- test_init_error_paths: new test to target all possible error
  paths in the VM init code.
- test_map_buffer_error_cases: new test to target all possible
  error paths in the buffer mapping logic.
- test_nvgpu_vm_alloc_va: new test to target the nvgpu_vm_alloc_va
  API and also target error paths.
- test_vm_bind: new test to target the nvgpu_vm_bind_channel API
  and also target error paths.
- test_vm_aspace_id: new test to target the vm_aspace_id API
  and also target error paths.

JIRA NVGPU-909

Change-Id: I755c89a6de09376d2624130a98966c172d850bfe
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2217679
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Thomas Fleury
10adb9accc gpu: nvgpu: unit: fix build w/ recovery disabled
nvgpu_gr_falcon_get_fecs_mutex is compiled out when
CONFIG_NVGPU_ENGINE_RESET is undefined.

g->ops.fifo.recovery is compiled out when
CONFIG_NVGPU_RECOVERY is undefined.

Jira NVGPU-4089

Change-Id: I637517e17f5853a2b79568724177c7a411e3c1ba
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2209500
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Divya Singhatwaria
d1d400b36e gpu: nvgpu: ACR unit tests
Add unit tests for ACR unit for the following
function:
- nvgpu_acr_prepare_ucode_blob_v1()
- nvgpu_acr_is_lsf_lazy_bootstrap()

JIRA NVGPU-3978

Change-Id: I41ea1faf5a0aaf90c14006bb2ede00f20cec1064
Signed-off-by: Divya Singhatwaria <dsinghatwari@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2206929
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:24 -06:00
Seshendra Gadagottu
7ee17a1173 gpu: nvgpu: ltc: add ltc unit test
Added ltc unit tests to cover all ltc APIs and code.
Also updated SWUT plan for ltc.

JIRA NVGPU-902

Change-Id: I057b92b1f2602a72fa4622c161af86c515d25218
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2213653
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
Seshendra Gadagottu
68f756d621 gpu: nvgpu: add netlist unit test
Added netlist unit test to cover all netlist APIs.
Also updated netlist SWUT plan.

JIRA NVGPU-2773

Change-Id: I76b3f54c2c40d08377d22c57ae8dfcf59101aab2
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2207477
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
Vedashree Vidwans
d6fc9d176e gpu: nvgpu: fix MISRA 17.1 in timeout_expired_msg
MISRA rule 17.1 forbids use of stdarg.h features defined for variable
arguments. This patch creates timers.h header for posix and QNX to
change nvgpu_timeout_expired_msg() to macro definition.

Jira NVGPU-4075

Change-Id: I8167f0ff7fdfb74adbbbed9c3021a9df2ad6401b
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2200885
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
Sagar Kamble
6c3c360462 gpu: nvgpu: protect nvgpu power state access using spinlock
IRQs can get triggered during nvgpu power-on due to MMU fault, invalid
PRIV ring or bus access etc. Handlers for those IRQs can't access the
full state related to the IRQ unless nvgpu is fully powered on.

In order to let the IRQ handlers know about the nvgpu power-on state
gk20a.power_on_state variable has to be protected through spinlock
to avoid the deadlock due to usage of earlier power_lock mutex.

Further the IRQs need to be disabled on local CPU while updating the
power state variable hence use spin_lock_irqsave and spin_unlock_-
irqrestore APIs for protecting the access.

JIRA NVGPU-1592

Change-Id: If5d1b5e2617ad90a68faa56ff47f62bb3f0b232b
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2203860
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
Thomas Fleury
99ffa2622c gpu: nvgpu: unit: add tests for TSG hal
Add unit tests for:
- gv11b_tsg_init_eng_method_buffers
- gv11b_tsg_deinit_eng_method_buffers
- gv11b_tsg_bind_channel_eng_method_buffers
- gv11b_tsg_unbind_channel_check_eng_faulted

Note: gv11b_tsg_enable was already tested as part of TSG common.

Added SWUTS documentation for above tests.

Modified gv11b_tsg_init_eng_method_buffers to inline computation
of method buffer size, as existing static function could never
return 0, making one branch not testable.

Added dummy IO register spaces for PFB, CE, PBUS and HSUB_COMMON,
so that g->ops.mm.init_mm_support can be called as part of
test_fifo_init_support. MM support is needed to test allocation
and mapping of DMA buffers.

Jira NVGPU-3788

Change-Id: I5356531b23c0456662187d16b35955bf0e528782
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2207384
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Seema Khowala <seemaj@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>
2020-12-15 14:05:52 -06:00
Nicolas Benech
7918cbb4f0 gpu: nvgpu: unit: unit tests for mm.as
This patch adds unit testing for the mm.as unit including:
- feature tests
- error injection testing
- 100% line coverage and 96% branches (one missing branch that
  cannot be tested or removed)

JIRA NVGPU-917

Change-Id: I54bdac21e56554d1d960955f1a140ab98c9f3e5e
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2194399
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
Sagar Kamble
9615857d9b gpu: nvgpu: userspace: add the elcg unit test
Add unit test to verify the ELCG enable/disable interface for
various engines.

JIRA NVGPU-2175

Change-Id: If308a8ef1fefe019c936c8bfdacf1d7b44ae35f1
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2173830
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
Sagar Kamble
be5a82b73e gpu: nvgpu: userspace: cg unit tests
Add unit tests for verifying the blcg and slcg prod values loading
interfaces.

JIRA NVGPU-2175

Change-Id: Ia48f3fe9ce463e47f819d15aa64e120040a31fb4
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2173829
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
Seshendra Gadagottu
bc83d6aa9c gpu: nvgpu: unit: gr: add gr falcon unit test
Added following unit tests to cover common gr falcon unit:
gr_falcon_init
gr_falcon_init_ctxsw
gr_falcon_nonsecure_gpccs_init_ctxsw
gr_falcon_recovery_ctxsw
gr_falcon_nonsecure_gpccs_recovery_ctxsw
gr_falcon_query_test
gr_falcon_init_ctx_state
gr_falcon_deinit

JIRA NVGPU-3930

Change-Id: I46f02ac62d8fbdd8704bca34a8088e2de4e2483a
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2201977
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
Divya Singhatwaria
8f1c95f3c3 gpu: nvgpu: ACR unit test
Add unit tests for ACR unit for the following
function:
nvgpu_acr_init()

JIRA NVGPU-2220

Change-Id: I40c6cf21439e1e9e376230b89cdae6740aec666b
Signed-off-by: Divya Singhatwaria <dsinghatwari@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2181677
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
Debarshi Dutta
b2d8c4774f gpu: nvgpu: disable KMDKickoff for safety build
Disable KMDKickoff for safety builds.

Jira NVPU-3172

Change-Id: I96536066e5bae83179750d4bf15f77e115219ddd
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2142917
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
Nicolas Benech
8a923f35a4 gpu: nvgpu: unit: increase test coverage of mm.mm
This patch increases the test coverage of mm.mm and provide the
corresponding SWUTS document.

JIRA NVGPU-3650

Change-Id: I1f8df4021531b44a165b1953ef3113ea0e87a9f3
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2191099
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
ajesh
26d83f4fae gpu: nvgpu: add UT for timers unit
Add unit test cases for timers unit.

Jira NVGPU-2655

Change-Id: Ie3f3001dc8b89cdd13cde3d4c326f2481dabd425
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2179108
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
ajesh
b9c2a0ec2d gpu: nvgpu: add unit test for cond unit
Add unit test cases for cond unit.

Jira NVGPU-2661

Change-Id: Id0bdd069787d567f99d53a9d69eaba1a6e7de97d
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2169112
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
vinodg
c91822381b gpu: nvgpu: unit: gr: Add more gr unit tests
Rename gr register space allocation and deallocation functions
to test_gr_init_setup and test_gr_remove_setup

Add tests to support following functions
nvgpu_gr_init
nvgpu_gr_init_support
nvgpu_gr_suspend
nvgpu_gr_remove_support

Jira NVGPU-3970

Change-Id: I11418ddcb9946ef75de162fd5689fdbbbfb62e79
Signed-off-by: vinodg <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2194612
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
vinodg
4af1f8a665 gpu: nvgpu: unit: add gr_init tests
Move gr_init_prepare to separate gr unit test

Use of global register spaces between two different
gr unit tests corrupt the memory in multi thread support.
Add support for local register spaces with pre initialized
register values for each gr unit test.

Jira NVGPU-3582

Change-Id: I4e47c1ca4f312335cd33a73a377f9fa9f12ccd5f
Signed-off-by: vinodg <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2189502
GVS: Gerrit_Virtual_Submit
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
vinodg
ff4610e910 gpu: nvgpu: unit: add gr_prepare test
Add support gr_prepare for sw and hw.
Add needed registers using nvgpu_posix_io_add_reg_space calls.

Add unit tests covering following functions
nvgpu_gr_prepare_sw
nvgpu_gr_enable_hw

install-unit.sh modified to copy the firmware binaries under
nvgpu-unit/firmware directory

Currently the gr_init_prepare test is called as part of the
gr_config test, later this will be moved as separate unit test.

Jira NVGPU-3582
Bug 2693908

Change-Id: If8f5ac4988deba0db477b2177981f7912bdb8eec
Signed-off-by: vinodg <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2191254
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
ajesh
8a927abdce gpu: nvgpu: add unit test for thread unit
Add unit test cases for thread unit.

Jira NVGPU-2662

Change-Id: I84a108fa83f66a3a5194f2553bf336ef2373cabf
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2164113
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:01:38 -06:00
Bo Yan
df8f8e24b2 Revert "gpu: nvgpu: unit: add gr_prepare tests"
This reverts commit 9bfdb2ba03f90f0cf828f08b99101a3a3e6c4532.

Bug 2693908

Change-Id: I3ef56773e46aad3626f16b84ea5e51c2fdcc3f1c
Signed-off-by: Bo Yan <byan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2189200
2020-12-15 14:01:33 -06:00
vinodg
ac8afda036 gpu: nvgpu: unit: add gr_prepare tests
Add support gr_prepare for sw and hw.
Add needed registers using nvgpu_posix_io_add_reg_space calls.

Add unit tests covering following functions
nvgpu_gr_prepare_sw
nvgpu_gr_enable_hw

Copy the falcon ucode binaries under userspace/firmware
directory
install-unit.sh modified to copy the firmware binaries
under nvgpu-unnit/firmware directory

Jira NVGPU-3582

Change-Id: If2131d2c48e828251208da86688b0594e62de82e
Signed-off-by: vinodg <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2184293
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:00:13 -06:00
Philip Elcan
373e7e8452 gpu: nvgpu: unit: init: add tests for poweron/poweroff
Add unit test cases for nvgpu_finalize_poweron() and
nvgpu_prepare_poweroff().

JIRA NVGPU-2239

Change-Id: I5735b1d04095aae41532750a6ba0f1fb186261ce
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2184928
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-08-28 16:55:20 -07:00
Thomas Fleury
95bb19827e gpu: nvgpu: add sw quiesce
For safety build, nvgpu driver should enter SW quiesce state
in case an uncorrectable error has occurred. In this state, any
activity on the GPU should be prevented, without powering off the GPU.
Also, a minimal set of operations should be used to enter SW quiesce
state.

Entering SW quiesce state does the following:
- set sw_quiesce_pending: when this flag is set, interrupt
  handlers exit after masking interrupts. This should help mitigate
  an interrupt storm.
- wake up thread to complete quiescing.

The thread performs the following:
- set NVGPU_DRIVER_IS_DYING to prevent allocation of new resources
- disable interrupts
- disable fifo scheduling
- preempt all runlists
- set error notifier for all active channels

Note: for channels with usermode submit enabled, userspace can
still ring doorbell, but this will not trigger any work on
engines since fifo scheduling is disabled.

Jira NVGPU-3493

Change-Id: I639a32da754d8833f54dcec1fa23135721d8d89a
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2172391
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-08-27 10:37:21 -07:00
Philip Elcan
bb2aee6d1a gpu: nvgpu: unit: add nvgpu.common.init unit test
This creates the basic test and validates all interfaces besides poweron
and poweroff.

JIRA NVGPU-3642

Change-Id: Idd36a1d7eaa8b459500ca642c742396dea677ff2
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2182348
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-08-26 16:07:58 -07:00
Nicolas Benech
3bc55a1bf2 gpu: nvgpu: hal: remove non-FUSA runlist HALs from FUSA build
A number of gk20a_runlist HALs are not used in FUSA builds and are
removed by this patch. It also removes dependencies on those HALs
in the runlist unit test.

JIRA NVGPU-3690

Change-Id: If00bdedd59cf12e91609dd075c9732c6e80a05ff
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2174743
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-08-21 16:26:59 -07:00
vinodg
dc2084c723 gpu: nvgpu: unit: add gr_config tests
Add support for the fuse and gv11b_gr related
registers and with initialized values need for
gr_config tests.

Add unit tests covering following functions
nvgpu_gr_alloc
nvgpu_gr_config_init
nvgpu_gr_config_deinit
nvgpu_gr_free

Most of the gr_config.h get and set functions
will be used in config_check_set_get test

Jira NVGPU-3582

Change-Id: I69637b3047d844559ac5b44ffd366551af8ea12c
Signed-off-by: vinodg <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2176369
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-08-18 08:17:04 -07:00