Commit Graph

45 Commits

Author SHA1 Message Date
Sagar Kamble
0394aef90d gpu: nvgpu: cast bvec test
Add BVEC tests for following functions:
nvgpu_safe_cast_u64_to_u32, nvgpu_safe_cast_u64_to_u16,
nvgpu_safe_cast_u64_to_u8, nvgpu_safe_cast_u64_to_s64,
nvgpu_safe_cast_u64_to_s32, nvgpu_safe_cast_s64_to_u64,
nvgpu_safe_cast_s64_to_u32, nvgpu_safe_cast_s64_to_s32,
nvgpu_safe_cast_u32_to_u16, nvgpu_safe_cast_u32_to_u8,
nvgpu_safe_cast_u32_to_s32, nvgpu_safe_cast_u32_to_s8,
nvgpu_safe_cast_s32_to_u64, nvgpu_safe_cast_s32_to_u32,
nvgpu_safe_cast_s8_to_u8, nvgpu_safe_cast_bool_to_u32

JIRA NVGPU-6412

Change-Id: Ic97e45051570a7133045de6cb4345c5f935cf9f6
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2555469
(cherry picked from commit be2ba5f1a7ead4c062eab74c7587c32797a651df)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2623637
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2021-11-12 21:37:01 -08:00
Sagar Kamble
a1e75fe9bc gpu: nvgpu: add unit test for nvgpu_wrapping_add_u32
Add BVEC unit test for the function nvgpu_wrapping_add_u32.

JIRA NVGPU-7211

Change-Id: I5c4c870c75b3e7643a771110b2c0d248c1f8cb56
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2614166
(cherry picked from commit f6a2fae67c3dd0d3f11deba2cb943a8c6420fda5)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2623633
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2021-11-12 21:36:55 -08:00
Sagar Kamble
d944313a54 gpu: nvgpu: arithmetic bvec tests
Add BVEC tests for following functions:
nvgpu_safe_sub_u8, nvgpu_safe_add_u32, nvgpu_safe_add_s32,
nvgpu_safe_sub_u32, nvgpu_safe_sub_s32, nvgpu_safe_mult_u32,
nvgpu_safe_add_u64, nvgpu_safe_add_s64, nvgpu_safe_sub_u64,
nvgpu_safe_sub_s64, nvgpu_safe_mult_u64, nvgpu_safe_mult_s64

JIRA NVGPU-6412

Change-Id: Ie4f1138318314c3f53b1f188e1ca45f681ca895e
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2553170
(cherry picked from commit 74c32f975c181107372957a28aad0cb5278f42b2)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2623630
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2021-11-12 21:36:49 -08:00
ajesh
83d1ae9c0a gpu: nvgpu: add bvec tests for utils
Add boundary value tests for common utils unit.

JIRA NVGPU-6395

Change-Id: I4442f339c0238e7ee8a44277ca5f53db9c71f367
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2542636
(cherry picked from commit 125d73582d57b673b155ada6ce7430401d56dbc3)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2548579
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2021-06-29 06:58:24 -07:00
Seeta Rama Raju
a03da4a077 gpu: nvgpu: compile out bsearch.c from safety build
- We are compiling “os/posix/bsearch.c” as part of safety-build,
  but we are not using bsearch.c file API from any safety file.

JIRA NVGPU-6172

Change-Id: Id0ebf00287f7564e629c28190f90edd68288dd70
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2424541
(cherry picked from commit ce822b1c8766faf5642079f0d5dde347ac2c5087)
Signed-off-by: srajum <srajum@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2447418
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2021-01-13 09:14:02 -08:00
ajeshkv
2435b93cb8 gpu: nvgpu: fix for worker thread unit test
Fix a possible issue which could arise due to invoking the
function nvgpu_worker_init twice on same worker thread. A worker
poll task thread could be already using the mutex/condition variable
when the second init invocation is done, leading to an undefined
behaviour. Second invocation is done for branch coverage, which
can be done using a different worker with thread running status set.

Bug 3180383

Change-Id: Ife2917e349aa039a4e0baa399c696a7c9ab3015e
Signed-off-by: ajeshkv <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2453218
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:13:48 -06:00
Seeta Rama Raju
ec5ed9fd79 gpu: nvgpu: whitelist worker.test_enqueue test
- Seeing intermittent failures with test_enqueue
  test in GVS, so skipping this test.

Bug 3038298

Change-Id: I814bce82cc436a4b8bea537aeb9d24caf4f1338a
Signed-off-by: Seeta Rama Raju <srajum@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2368088
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:13:28 -06:00
Terje Bergstrom
cc2e1be0bb gpu: nvgpu: unit: atomic: Use labs when operating on long
Use labs() instead of abs() when operating with longs.

Change-Id: Ibb1f2c69099387478b41b66cf68539b460bc2be3
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2318390
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:13:28 -06:00
Petlozu Pravareshwar
566b1df08c gpu: nvgpu: unit: Update interface.lock unit tests
Implement APIs which mimic below QNX standard APIs and use them in
interface.lock unit tests. This is required because as part of writing
UTs for "daemon_igpu.c" file, the below standard APIs are mocked.
 - sem_init()
 - sem_wait()
 - sem_post()

JIRA NVGPU-3909

Change-Id: I8f7e9c031b2a840e04e03a0f871a9e5d72c3e4dd
Signed-off-by: Petlozu Pravareshwar <petlozup@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2293634
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2020-12-15 14:13:28 -06:00
Philip Elcan
8366e2980d gpu: nvgpu: unit: fix typo in static_analysis SWUTS
Fix a typo in the doxygen for the static_analysis unit test was
preventing it from being included in the generated SWUTS.

JIRA NVGPU-4825

Change-Id: I3cbc1bb275c28d6d51adce48c74f88593d36ea72
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2293623
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2020-12-15 14:13:28 -06:00
Nicolas Benech
da0fb30256 gpu: nvgpu: unit: add SWUTS for interface.list
This patch adds SWUTS for interface.list and moves the unit test
files to the appropriate 'interface' folder.

JIRA NVGPU-3510

Change-Id: I6d67d784fcf4d89ba4ee7cfe5f5d7a0e558d71a8
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2289225
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:13:28 -06:00
ajesh
245cf29bc0 gpu: nvgpu: add tests for kref
Add unit tests for kref unit.

Jira NVGPU-4417

Change-Id: Ie5c6efc72b95aa1f200a59fd9184f20e65548fee
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2287553
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:13:28 -06:00
Philip Elcan
cdaa77c40c gpu: nvgpu: unit: add bit-utils test
Add test for common.utils.bit-utils.

JIRA NVGPU-4818

Change-Id: Ibb07d01fdf312e661bba76fe3c09b69424b62420
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2279609
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:10:29 -06:00
Philip Elcan
748f83af2f gpu: nvgpu: unit: static_analysis: add test for safety_checks
Add test for nvgpu_safety_checks().

JIRA NVGPU-4825

Change-Id: I0d0b94c87b1e17f3087831b904740e14e26b6355
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2279563
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>
2020-12-15 14:10:29 -06:00
Philip Elcan
2cf72837ec gpu: nvgpu: unit: add nvgpu_gk20a test
Add test for common.nvgpu.gk20a unit.

JIRA NVGPU-4818

Change-Id: Iae23d39675789fad141411162774c05f976c9831
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2279562
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
a8426d6c75 gpu: nvgpu: unit: rbtree: update SWUTS
Add Targets keyword

JIRA NVGPU-4818

Change-Id: Iee33a2e2f7246b8b58e8f38945f77bb3196fb363
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2278497
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>
2020-12-15 14:10:29 -06:00
Philip Elcan
f2e2b29194 gpu: nvgpu: unit: add test for common.utils.string
Add unit test for the common.utils.string unit.

JIRA NVGPU-4826

Change-Id: I4bfca346fb2202f9572199590f33a0461443fbc9
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2275456
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
7601d1c620 gpu: nvgpu: unit: add static_analysis unit test
Add unit test for common.utils static_analysis unit.

JIRA NVGPU-4825

Change-Id: Id103ab101bbca8424dd7f0d136f1101ddf4bc2b5
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2276814
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
6afd472abe gpu: nvgpu: add test case target functions
Add the target function names for posix unit tests.

Jira NVGPU-4478

Change-Id: I393c3d6ba99c96e54812e29dedc8abfe7afcebab
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2276656
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
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:29 -06:00
Philip Elcan
796781313e gpu: nvgpu: unit: worker: add more coverage
This adds a test to cover a missing branch in the worker thread.

JIRA NVGPU-4818

Change-Id: I6e4a1f4615954a666549d063020308b592286347
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2276649
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
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
Philip Elcan
6800aa7c51 gpu: nvgpu: unit: add worker unit test
Add unit test for worker unit.

To get full coverage, a new fault injection is added for the thread API
nvgpu_thread_is_running to return true after a number of executions.

JIRA NVGPU-915

Change-Id: Ib631d4af7dac3dde37bed3b5de81f3164a6df1b0
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2265714
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
b682091b13 gpu: nvgpu: SWUTS: clean up test types
Apply the following changes to test types:
* "Init" --> "Other (setup)"
* "Coverage" --> Removed since it's implied for all tests
* "Feature based" --> "Feature"
* "Boundary Value analysis" and "Boundary values based" --> "Boundary values"
* "Error guessing based" --> "Error guessing"

JIRA NVGPU-3510

Change-Id: I3a9c0c59e6ad806f3479caa5e9a62f4d89f76923
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2265670
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
9ad3de64b1 gpu: nvgpu: unit: SWUTS for interface.rbtree
Add SWUTS documentation for the interface.rbtree unit.

JIRA NVGPU-3943

Change-Id: I9555090bc986f5cea76add6a46309a13b37f371c
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2207312
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
bac3b84a7b gpu: nvgpu: unit: SWUTS for interface.lock
Add SWUTS documentation for the interface.lock unit.

JIRA NVGPU-3943

Change-Id: I705755482ee98217dc5015a42fea6f13ba852a61
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2207311
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
b7066e0bf1 gpu: nvgpu: unit: SWUTS for interface.bsearch
Add SWUTS documentation for the interface.bsearch unit.

JIRA NVGPU-3943

Change-Id: I40ffe7d004823f4a04532cb01bd548579b4dbf70
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2207310
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:05:52 -06:00
Philip Elcan
2bd4e4d8e0 gpu: nvgpu: unit: atomic: add SWUT documentation
Add the doxygen documentation for the SWUT for the atomic unit test.

JIRA NVGPU-3943

Change-Id: I7ff2e4f4f212299896a1efb4f92d2a34ace6cf19
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2190148
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nicolas Benech <nbenech@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:01:38 -06:00
Philip Elcan
5f23a16bdd gpu: nvgpu: unit: atomic: decrease test time for xchg tests
The threaded xchg tests were running long and causing failures with the
QNX framework. This decreases the number of iterations for these tests.

JIRA NVGPU-3954

Change-Id: Ie4153b815ad81664ed3b4d4cb058c522cce3e609
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2189348
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Nicolas Benech <nbenech@nvidia.com>
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>
2020-12-15 14:01:38 -06:00
Philip Elcan
fa002fac86 gpu: nvgpu: unit: atomic: improve reliability of *and_test tests
The threaded tests for inc_and_test, dec_and_test, and sub_and_test were
not "passing" reliably for the "not_atomic" variants.

This updates these tests (atomic and non-atomic) to increase concurrency
of the operations by having each thread execute the operation 100 times
each rather than just once. For the sake of test time, it creates new
args for the threaded versions to keep iterations reasonable.

JIRA NVGPU-3954

Change-Id: I1fe2baa73ed1b9d4a8e13c97656411329b141db0
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2189347
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Nicolas Benech <nbenech@nvidia.com>
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>
2020-12-15 14:01:38 -06:00
Thomas Fleury
97762279b7 gpu: nvgpu: make nvgpu_init_mutex return void
Make the nvgpu_init_mutex function return void.
In linux case, this doesn't affect anything since mutex_init
returns void.
For posix, we assert() and die if pthread_mutex_init fails.

This alleviates the need to error inject for _every_
nvgpu_mutex_init function in the driver.

Jira NVGPU-3476

Change-Id: Ibc801116dc82cdfcedcba2c352785f2640b7d54f
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2130538
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-06-05 10:25:52 -07:00
Nicolas Benech
87379d2295 gpu: nvgpu: unit: increase rbtree coverage
This patch increases line and branch coverage in the rbtree unit test
by targeting a number of corner cases in the unlink/rebalancing
routines.

JIRA NVGPU-3392

Change-Id: I3caeca552d5c4c27d4a355c0ce289902621c2ff4
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2128048
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
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-06-04 13:15:04 -07:00
Philip Elcan
937f2a101a gpu: nvgpu: unit: atomics: increase reliability
The test atomic_cmpxchg_not_atomic_threaded is failing intermittently.
Increase the iterations to try to increase reliability.

NVGPU-2251

Change-Id: Ib585321a28c21d073acac5b7b8509d3af55316b8
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2127948
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nicolas Benech <nbenech@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>
2019-06-03 11:06:06 -07:00
Nicolas Benech
c78741f460 gpu: nvgpu: unit: rbtree unit test
Adds a unit test module for interface.rbtree. This module covers
all the APIs of rbtree, 90% of statements and 81% of branches.

JIRA NVGPU-3247

Change-Id: I6799bafdbfad16ba7eb5691d01fdce8c023e3a5e
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111529
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 12:42:13 -07:00
Philip Elcan
82ce44d882 gpu: nvgpu: unit: atomics: add cmpxchg threaded test
Add a threaded test for nvgpu_cmpxchg API. This test implements an
atomic increment using cmpxchg. It uses the existing arithmetic
threaded framework to use the cmpxchg_inc() function to verify 100
parallel threads increment the atomic the correct number of times.

These are L1 tests since they have longer run times and are unlikely to
regress.

JIRA NVGPU-2251

Change-Id: I9c2b68052b3a1b6ef20adfa24e7d50746902f754
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2100748
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
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-04-25 15:14:17 -07:00
Philip Elcan
1bfc68ef46 gpu: nvgpu: unit: atomic: add xchg atomicity test
Add a threaded test to verify xchg operation. Also validate the
non-atomic version will fail.

There are 100 threads spawned that each do exchanges on the same atomic
1000 times. Each thread starts with a unique value. When the test
completes, make sure the values are still unique.

These are L1 tests since they have longer run times and are unlikely to
regress.

JIRA NVGPU-2251

Change-Id: I4741df500d712e60d92e5221182be02dbeaa14ef
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2081067
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
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-04-25 15:13:51 -07:00
Philip Elcan
0561bace40 gpu: nvgpu: unit: atomic: add *_and_test atomicity tests
Add threaded tests for inc_and_test, dec_and_test, and sub_and_test
operations to verify atomicity. Also, add non-atomic tests for these to
verify we are actually verifying that the operations are atomic.

The new tests initialize an atomic to a non-zero value such that the
threads executing the atomic operation will reach and pass zero. The
test verifies only 1 thread observed zero (the atomic operation
returned true). The test is executed 5000 times with 100 threads.

For example, the inc_and_test will start the atomic at -50 and 100
threads will concurrently increment the atomic. The test will verify
only one of the 100 threads observed 0.

These tests are L1 tests since we don't expect regressions in the
atomics (they are basically reusing the GCC builtins) and have longer
run times in order to make sure the non-atomic variants fail.

JIRA NVGPU-2251

Change-Id: I7811779bc7c0965b4465d420066f3cff87bfa13e
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2079378
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-04-18 13:35:10 -07:00
Philip Elcan
0cd6bf1c4f gpu: nvgpu: unit: atomic: cleanup unsigned types
Use unsigned values where values are logically always positive.

JIRA NVGPU-2251

Change-Id: Id5169a1428e834a32624613654a14f0510e366a2
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2079377
Reviewed-by: Automatic_Commit_Validation_User
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-04-18 13:35:01 -07:00
Philip Elcan
2c88cd50a4 gpu: nvgpu: unit: atomic: add non-atomic functions
In order to show that atomicity tests prove atomicity, we need to show
non-atomic operations fail. This patch is the first step toward that,
which is to add support for non-atomic operations.

Since the common functions for the different operations must now support
3 options (32-bit, 64-bit, and non-atomic), change the macros to
inline functions for decreased complexity and better readability.

JIRA NVGPU-2251

Change-Id: I721373af1eff02d82ade45d1668ad6781bd6d7e2
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2079376
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-04-18 13:34:52 -07:00
Philip Elcan
46121225a3 gpu: nvgpu: unit: atomic: add barrier to sync threads
Add a pthreads barrier to synchronize starting of the threads for the
arithmetic test.

JIRA NVGPU-2251

Change-Id: I9953e7dd66b6845d93abb524d05f4ca2fe7b3930
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2098699
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-04-18 13:34:43 -07:00
Philip Elcan
0d7e4b59ca gpu: nvgpu: unit: nvgpu.interface.atomic unit test
Introduce the unit test for the nvgpu atomics APIs.

JIRA NVGPU-2251

Change-Id: Iac9e55f6b32ac7075cc0d15be3d2c6a3f885a096
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2083385
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-04-17 10:15:07 -07:00
Philip Elcan
c0d5a715bd gpu: nvgpu: unit: add test levels
Add -t/--test-level option for the unit test framework. This
correlates with the test plan levels in GVS. L0 tests are a subset of
the L1 tests. Currently, only test levels 0 and 1 are supported.

The test output has been updated to display skipped tests. Skipped
tests are not included in the test dump.

JIRA NVGPU-2251

Change-Id: Icc2ff19a81529be8526e89f70983e96040390e00
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2085280
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-05 13:14:20 -07:00
Nicolas Benech
33aea736a2 gpu: nvgpu: fix licenses in userspace
The licenses used in the userspace folder were inconsistent.
This patch fixes the situation by ensuring all files are using the
MIT license.

JIRA NVGPU-2974

Change-Id: I8c89667f72732ff6f73e6cf4be1acd9e58a7e516
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2087125
GVS: Gerrit_Virtual_Submit
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-02 13:54:00 -07:00
Philip Elcan
57d1d0af03 Revert "gpu: nvgpu: unit: nvgpu.interface.atomic unit test"
The atomics unit test was causing the kernel_submit test to exceed the
timeout limit of 600s.

Bug 2543372

This reverts commit 0e6bdc26ae.

Change-Id: Ib3740a8655c9d0f9012ba9b23f0d5fb7bed825c0
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2081836
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-03-27 13:44:42 -07:00
Nicolas Benech
63f1fcb9cf gpu: nvgpu: unit: bsearch unit test
Unit test to target the interface.bsearch unit. The goal here is to
provide line coverage for the unit. Considering that the underlying
implementation is using POSIX's bsearch, there is no need to verify
the behavior of bsearch in depth.

JIRA NVGPU-2265

Change-Id: I93ec3193bb0f93aaa47aa0c6c44eca09320893ca
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2078427
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-26 08:04:57 -07:00
Philip Elcan
0e6bdc26ae gpu: nvgpu: unit: nvgpu.interface.atomic unit test
Introduce the unit test for the nvgpu atomics APIs.

JIRA NVGPU-2251

Change-Id: I01adb746e4dd594d312204f12b323dd33f306e24
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2034427
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-18 16:56:18 -07:00
Nicolas Benech
99721cca0d nvgpu: unit: unit test for nvgpu.interface.lock
This unit test covers all APIs of the nvgpu.interface.lock and
verify their behavior.

JIRA NVGPU-2245

Change-Id: I317663ab45a2cc93ddd46edccc9c3fdc37148e72
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2034205
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-11 18:23:52 -07:00