Commit Graph

5001 Commits

Author SHA1 Message Date
Alex Waterman
7222826680 gpu: nvgpu: Return bool from nvgpu_log_mask_enabled
This function returns a boolean describing if a given log
mask is enabled for a given GPU. Previously this returned
and int but the bool type is far better suited for this.

Also implement this function in posix, as it may be useful
to have implemented there if any common code chooses to
use this function.

Change-Id: I7382e73df83282763df1bdbccbbb219c9f3e6f1b
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1938341
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-08 21:42:14 -08:00
Nicolas Benech
ee282de11b gpu: nvgpu: posix: Add BUG() exception handling
For unit testing, this new feature allows to "catch" calls
to BUG() when they are expected.

JIRA NVGPU-1287

Change-Id: I29fc9cd7fc28f8697a865c173b6991e2a48a3b4d
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1930974
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-08 21:42:07 -08:00
Terje Bergstrom
f00d9ca1aa gpu: nvgpu: Move pmu HAL files to common/pmu
Move PMU and ACR HAL source code files to live under common/pmu. Also
update the #include paths and delete unnecessary #include dependencies.

JIRA NVGPU-961

Change-Id: I29a220bce6de0a46b6a5fe8ff7f9dc4d67395348
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1935626
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-08 20:04:06 -08:00
Terje Bergstrom
7525c1337b gpu: nvgpu: Remove the GPU-NEXT conditional
Remove build conditional for GPU-NEXT. It was used for including
code for tu104, but now it's part of main nvgpu. Leave a TURING
conditional to not need Turing code in other builds.

JIRA NVGPU-961

Change-Id: I74177863c451d78b6db6165249561f15eadc3cc3
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1936803
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-08 19:35:09 -08:00
Alex Waterman
63da5366a6 gpu: nvgpu: unit: Shuffle the paths of tests around a bit
We will need to organize the unit tests in order to keep the
units/ directory managable.

The basic idea here is to mirror the common/ structure in
nvgpu proper under units/. There's one additrion at the
moment though: posix. This is for posix environment related
tests.

Also added a fix for the runlist unit test. Add it to the
tmake sources and move the nvgpu-runlist/ directory to just
runlist/.

Change-Id: I1f4163d0e33c3af70376cfeb3441d277d559e05a
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1935710
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-07 13:10:55 -08:00
Amurthyreddy
1023c6af14 gpu: nvgpu: MISRA 14.4 boolean fixes
MISRA rule 14.4 doesn't allow the usage of non-boolean variable as
boolean in the controlling expression of an if statement or an
iteration statement.

Fix violations where a non-boolean variable is used as a boolean in the
controlling expression of if and loop statements.

JIRA NVGPU-1022

Change-Id: I61a2d24830428ffc2655bd9c45bb5403c7f22c09
Signed-off-by: Amurthyreddy <amurthyreddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1943058
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-07 10:35:22 -08:00
Amurthyreddy
710aab6ba4 gpu: nvgpu: MISRA 14.4 boolean fixes
MISRA rule 14.4 doesn't allow the usage of non-boolean variable as
boolean in the controlling expression of an if statement or an
iteration statement.

Fix violations where a non-boolean variable is used as a boolean in the
controlling expression of if and loop statements.

JIRA NVGPU-1022

Change-Id: I957f8ca1fa0eb00928c476960da1e6e420781c09
Signed-off-by: Amurthyreddy <amurthyreddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1941002
GVS: Gerrit_Virtual_Submit
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-07 10:35:13 -08:00
Richard Zhao
f9ca193a60 gpu: nvgpu: vgpu: return is_current_ctx for regops
The feature is required by ioctl API. is_current_ctx has been added to
regops ivc command.

Bug 2375942
Jira EVLR-3388

Change-Id: Ib46dc7609f6a7de6dcd26f59a36e6be77b599743
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1943077
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Nirav Patel <nipatel@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-06 23:33:24 -08:00
Nicolas Benech
99384a67b5 gpu: nvgpu: unit: install-unit: Handle subfolders
Now that some unit modules are in subfolders, this script
needed an update as well. All module .so are now searched
and all copied to the nvgpu_unit/units/ folder on target.

JIRA NVGPU-1246

Change-Id: I1da639006a0012c8a2d1e19b8b2bddd0b6376b67
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1943578
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-06 21:57:40 -08:00
Konsta Holtta
d42d112544 gpu: nvgpu: tu104: support usermode submit
Implement usermode base and doorbell token HAL ops and turn on
NVGPU_SUPPORT_USERMODE_SUBMIT for tu104.

Bug 200145225

Change-Id: I4d8819e301a1d5fb09996f5ac24f038fb8f1773a
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1924579
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-06 21:56:44 -08:00
Konsta Holtta
513cb21f26 gpu: nvgpu: move doorbell token number to HAL
Add a fifo HAL for querying the doorbell token of a specific channel and
call it instead of doing the calculation directly. For Volta the token
is just the channel id plus the possible base number.

Bug 200145225

Change-Id: Ifbb150191575fdc72e413a14c799cab7e52d8c14
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1849639
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-06 21:56:26 -08:00
tkudav
1cdcc54a53 gpu: nvgpu: Use nvlink speed from VBIOS
Different SKUs may require different nvlink speed and hence the
nvlink speed value should come from VBIOS. The initpll number
corresponding to speed is present in VBIOS Low Power Nvlink table
header. Parse this data from VBIOS and set corresponding nvlink
speed and minion initpll DLCMD as default.
We can no longer update the GV100 VBIOS with necessary nvlink speed
value. Hence the hardcoding stays for GV100.
The nvlink speed should match across the endpoints. So in speed_config
fops, communicate the speed to nvlink core-driver for co-ordination
with Tegra endpoint.

Bug 2418403

Change-Id: Ib6f60951d4ca1c275968707d4cc6d738ba3a3f08
Signed-off-by: tkudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1938046
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-06 02:14:32 -08:00
tkudav
03dcb8006e gpu: nvgpu: Remove 25G nvlink speed support
The Tegra endpoint no longer supports 25G nvlink speed. As
the dGPU nvlink endpoint is only used with Tegra nvlink
point, remove support for 25G nvlink speed to avoid speed
mismatch between endpoints.

Bug 2083356

Change-Id: I79609073af3975ce90421f66800380ec596084b3
Signed-off-by: tkudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1940134
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-06 02:14:23 -08:00
Srirangan Madhavan
ef5fdac7a6 gpu: nvgpu: Fix MISRA rule 15.6 violations
MISRA Rule-15.6 requires that all if-else blocks and loop blocks
be enclosed in braces, including single statement blocks. Fix errors
due to single statement if-else and loop blocks without braces
by introducing the braces.

JIRA NVGPU-775

Change-Id: Ib70621d39735abae3fd2eb7ccf77f36125e2d7b7
Signed-off-by: Srirangan Madhavan <smadhavan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1928745
GVS: Gerrit_Virtual_Submit
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-05 22:13:16 -08:00
Scott Long
482d7e7ca2 gpu: nvgpu: MISRA 21.15 fixes to vbios/acr code
MISRA Rule 21.15 prohibits use of memcpy() with incompatible ptrs
to qualified/unqualified types.

To circumvent this issue we've introduced a new MISRA-compliant
nvgpu_memcpy() function.

This change switches all remaining offending uses of memcpy()
in acr/* and vbios/* over to use nvgpu_memcpy() with appropriate
casts applied.

JIRA NVGPU-849

Change-Id: I30ec9481c1418289a8664bdb4ef5be7833218179
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1941260
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-misra-checker <svc-misra-checker@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>
2018-11-05 15:24:53 -08:00
Scott Long
0bceaf295a gpu: nvgpu: MISRA 21.15 fixes to netlist code
MISRA Rule 21.15 prohibits use of memcpy() with incompatible ptrs
to qualified/unqualified types.

To circumvent this issue we've introduced a new MISRA-compliant
nvgpu_memcpy() function.

This change switches all offending uses of memcpy() in netlist/*
code over to use nvgpu_memcpy() with appropriate casts applied.

Also changed the type of the memcpy src variable from u32 * to
u8 * to avoid unnecessary casts.

JIRA NVGPU-849

Change-Id: I442596d6405ac543edc3d26c1367ed37fd02941c
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1941259
Reviewed-by: Philip Elcan <pelcan@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>
2018-11-05 15:24:49 -08:00
Scott Long
f442462eb5 gpu: nvgpu: MISRA 21.15 fixes to pmu code
MISRA Rule 21.15 prohibits use of memcpy() with incompatible ptrs
to qualified/unqualified types.

To circumvent this issue we've introduced a new MISRA-compliant
nvgpu_memcpy() function.

This change switches all offending uses of memcpy() in pmu/*
over to use nvgpu_memcpy() with appropriate casts applied.

JIRA NVGPU-849

Change-Id: I8f66b3a271fdab3e5cfb625a9c9ccc56bf272182
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1941258
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-05 15:24:45 -08:00
Scott Long
8cc8aeb322 gpu: nvgpu: MISRA 21.15 fixes to mm code
MISRA Rule 21.15 prohibits use of memcpy() with incompatible ptrs
to qualified/unqualified types.

To circumvent this issue we've introduced a new MISRA-compliant
nvgpu_memcpy() function.

This change switches all offending uses of memcpy() in mm/*
over to use nvgpu_memcpy() with appropriate casts applied.

JIRA NVGPU-849

Change-Id: I17be87475fde62e969b014d4d0fa455dae5d4373
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1941257
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-05 15:24:42 -08:00
Alex Waterman
44b4b036e2 gpu: nvgpu: unit: Delete redundant enabled init
Now that the enabled flags init is taken care of in the
nvgpu_posix_probe() function tests need only init the specific
flags they care about.

JIRA NVGPU-1323

Change-Id: I9255dddcd3aad34881668d283f2cc8332b06e7ce
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1941538
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-05 14:35:52 -08:00
Alex Waterman
7dee2d41b7 gpu: nvgpu: posix: Init enabled flags in nvgpu_posix_probe()
Also clean up the code a bit to be more MISRA friendly. Although
this isn't necessary it does help reduce false positives in the
various scans.

JIRA NVGPU-1323

Change-Id: I89a857ff69cc7669990bff942011ef1e11500327
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1941536
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Scott Long <scottl@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-05 14:35:49 -08:00
Philip Elcan
e369b055b3 gpu: nvgpu: fifo_gk20a: add casts for MISRA 10.3
This adds casts to eliminate MISRA 10.3 violations for implicit
assignments of values to different essential types. If values could
potentially not fit into the cast, they are checked before the cast
to ensure the value does not change. If possible, an error is
returned; otherwise, call BUG()/BUG_ON().

Change-Id: I14d0ef74bf3dfe62a8fb04ac4047f46c1bf9fcd4
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1930157
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-05 14:35:19 -08:00
Mahantesh Kumbar
646d9ee30a gpu: nvgpu: adding tu104 gsp h/w header
- ACR second stage ACR-ASB will be executing on GSP
so need gsp h/w header to support ACR-ASB

JIRA NVGPU-1160

Change-Id: I8ef699c012a27384fb2895ebdf84c99b1951f12c
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1941606
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-05 09:13:29 -08:00
Alex Waterman
e85368b4f3 gpu: nvgpu: unit: update .gitignore to hide .gcno/.gcda files
These files now get generated by the unit tests themselves, too, which
clutter the source directories foir the units. So hide them from git.

Change-Id: Id9e302581fa20979b14d5af09510023dd984d37f
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1941537
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Scott Long <scottl@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-04 21:25:42 -08:00
Alex Waterman
40b50c059a gpu: nvgpu: Set pd_cache to NULL after it's freed
Clear the pointer to the non-existent pd_cache after the
pd_cache is freed. This is good practice and makes it easier
to verify that this function has accomplished its intended
purpose in the unit tests.

JIRA NVGPU-1323

Change-Id: I1e1c20344a385bc96b293f2007485e7f4d99f947
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1941535
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Scott Long <scottl@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-04 21:25:38 -08:00
Vince Hsu
3a87a0c998 gpu: nvgpu: re-initialize fw pointer when failed to load fw
When ACR and PMU BL fail to boot, the firmware are releasd, but the
firmware pointers are not re-initialized. That causes later invalid
pointer usage. Fix that by setting them as NULL.

Bug 200462464

Change-Id: Iacdf4b3c7f7144a77f595c77e6f5a29d35505672
Signed-off-by: Vince Hsu <vinceh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1941671
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-03 09:19:17 -07:00
Vince Hsu
0bda191d7b gpu: nvgpu: fix deadlock when ACR boot fails
The tpc_pg_lock is not released properly when ACR fails to boot, so
the subsequent runtime PM resume operation will block. And it in
turn also causes shutdown block due to pending runtime PM operations.

Bug 200462464

Change-Id: Ia28ac11e8a7bbd826cf5f90ba8f90b29d2a55baa
Signed-off-by: Vince Hsu <vinceh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1941670
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mahantesh Kumbar <mkumbar@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>
2018-11-03 09:19:08 -07:00
Alex Waterman
8cbe97b8eb gpu: nvgpu: Align maps to 4K not PAGE_SIZE in vGPU map
We shouild not align a buffer size to page size blindly. The buffer
size may not actually be a multiple of the page size if the page
size is not 4K.

Bug 1977822

Change-Id: I84fddaf1c305b1ccbce01fbb16cdb0a4b5b6ddba
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1941557
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-03 09:19:04 -07:00
Nicolas Benech
bbde800b35 gpu: nvgpu: Fix LibC MISRA 17.7 in GPU specific
MISRA Rule-17.7 requires the return value of all functions to be used.
Fix is either to use the return value or change the function to return
void. This patch contains fix for all 17.7 violations instandard C functions
in GPU specific files.

JIRA NVGPU-1036

Change-Id: Iefadc38bdbea4f02de3c24b6ad1c71d6eb0af4bd
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1929903
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>
2018-11-03 09:18:06 -07:00
Scott Long
8ac6724c09 gpu: nvgpu: MISRA 21.15 fixes to clk code
MISRA Rule 21.15 prohibits use of memcpy() with incompatible ptrs
to qualified/unqualified types.

To circumvent this issue we've introduced a new MISRA-compliant
nvgpu_memcpy() function.

This change switches all offending uses of memcpy() in clk/*
and gp106/mclk* over to use nvgpu_memcpy() with appropriate
casts applied.

JIRA NVGPU-849

Change-Id: I21d3a8bed762adad64abf0b0bfc58d743a104cbb
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1939866
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-01 17:16:28 -07:00
Terje Bergstrom
810317fadc gpu: nvgpu: Move ctrl header files to include/nvgpu/pmuif
pmuif structures refer to the ctrl structures, so that means that ctrl
structures are part of the pmuif. Move the headers to the right place
and update all include statements to include from the right place.

JIRA NVGPU-596

Change-Id: I7be1a727be654d58eccd0e12d599979687dd0733
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1934022
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-01 17:16:03 -07:00
Nicolas Benech
6808ae94be gpu: nvgpu: Fix LibC MISRA 17.7 in volt
MISRA Rule-17.7 requires the return value of all functions to be used.
Fix is either to use the return value or change the function to return
void. This patch contains fix for all 17.7 violations instandard C functions
in volt.

JIRA NVGPU-1036

Change-Id: I68cb0de47721c21d31468a811d809d1538f9515a
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1929907
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-01 17:15:53 -07:00
Nicolas Benech
253466c5e9 gpu: nvgpu: Fix LibC MISRA 17.7 in power files
MISRA Rule-17.7 requires the return value of all functions to be used.
Fix is either to use the return value or change the function to return
void. This patch contains fix for all 17.7 violations instandard C functions
in power-related files.

JIRA NVGPU-1036

Change-Id: I6b9f2fa6f3cbf5f746a0e8499d3e8962d4781fe3
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1929905
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-misra-checker <svc-misra-checker@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>
2018-11-01 17:15:44 -07:00
Nicolas Benech
8580a6333c gpu: nvgpu: Fix LibC MISRA 17.7 in PMU
MISRA Rule-17.7 requires the return value of all functions to be used.
Fix is either to use the return value or change the function to return
void. This patch contains fix for all 17.7 violations instandard C functions
in PMU files.

JIRA NVGPU-1036

Change-Id: Ie189acf13007f79a1046e8723cdec5b878d4ccc4
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1929904
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
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>
2018-11-01 17:15:40 -07:00
Nicolas Benech
cb2a05dd92 gpu: nvgpu: Fix LibC MISRA 17.7 in common
MISRA Rule-17.7 requires the return value of all functions to be used.
Fix is either to use the return value or change the function to return
void. This patch contains fix for all 17.7 violations instandard C functions
in common code.

JIRA NVGPU-1036

Change-Id: Id6dea92df371e71b22b54cd7a521fc22812f9b69
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1929899
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-01 17:15:37 -07:00
Deepak Nibade
27b47c20bd gpu: nvgpu: remove unused h/w headers from GR files
Remove unused h/w header includes from gr_gk20a.c and gr_gv11b.c files

Jira NVGPU-1275

Change-Id: I5de337ff446d98314c8310345c30a953e1d16cc7
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1941122
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@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>
2018-11-01 12:05:43 -07:00
Nitin Kumbhar
1d960cfa84 gpu: nvgpu: add checks for acr ucode mem free
Trying to unmap and free acr ucode memory when it's not initialized
results in NULL pointer dereferencing. Fix this by checking for
validity of ucode memory.

[  132.347391] Unable to handle kernel NULL pointer dereference at
virtual address 00000000
...
[  132.423191] PC is at nvgpu_dma_unmap_free+0x28/0x44 [nvgpu]
[  132.428545] LR is at gm20b_remove_acr_support+0x48/0x64 [nvgpu]
...
[  132.535447] [<ffffff8000eb98f4>] nvgpu_dma_unmap_free+0x28/0x44 [nvgpu]
[  132.541836] [<ffffff8000efc470>] gm20b_remove_acr_support+0x48/0x64 [nvgpu]
[  132.548301] [<ffffff8000ea42f4>] gk20a_remove_support+0x58/0x104 [nvgpu]
[  132.554694] [<ffffff8000ed2790>] gk20a_free_cb+0x48/0x78 [nvgpu]
[  132.560299] [<ffffff8000ed3618>] gk20a_put+0x50/0x70 [nvgpu]
[  132.565628] [<ffffff8000ea744c>] nvgpu_pci_remove+0xcc/0x170 [nvgpu]
[  132.571251] [<ffffff8008499500>] pci_device_remove+0x3c/0x104
[  132.576597] [<ffffff80086939d8>] __device_release_driver+0x7c/0xfc
[  132.582194] [<ffffff8008693a7c>] device_release_driver+0x24/0x38
[  132.588052] [<ffffff8008691a5c>] unbind_store+0xd8/0xfc
[  132.593203] [<ffffff8008690e14>] drv_attr_store+0x20/0x30
[  132.598302] [<ffffff800829ecfc>] sysfs_kf_write+0x40/0x50
[  132.604068] [<ffffff800829e0b0>] kernfs_fop_write+0xb4/0x1d0
[  132.609411] [<ffffff8008216074>] __vfs_write+0x40/0x140
[  132.614571] [<ffffff8008216e50>] vfs_write+0xa8/0x1a0
[  132.619739] [<ffffff8008218328>] SyS_write+0x5c/0xc4
[  132.624967] [<ffffff8008082bc0>] el0_svc_naked+0x34/0x38
[  132.630134] ---[ end trace 3563988eb20f2c14 ]---

This situation occurs when gpu is not able to power on for some reason.

Bug 2412369

Change-Id: Ifc226ebd692b1ead56066dafeb5da4c23bc2ec48
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1939939
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Mahantesh Kumbar <mkumbar@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>
2018-11-01 12:05:35 -07:00
Sagar Kamble
aa43e7897e gpu: nvgpu: disable/clear PMU IRQs on power off
While tearing down PMU state during power off, nvgpu doesn't disable
the PMU interrupts. Disable them unconditionally.

Bug 200457485

Change-Id: Ia2462d879c1e7bbb4b5e8295ce211c38567c13e5
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1939025
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
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>
2018-10-31 19:35:11 -07:00
Amurthyreddy
a39c48e3e2 gpu: nvgpu: MISRA 14.4 err/ret/status as boolean
MISRA rule 14.4 doesn't allow the usage of integer types as booleans
in the controlling expression of an if statement or an iteration
statement.

Fix violations where the integer variables err, ret, status are used
as booleans in the controlling expression of if and loop statements.

JIRA NVGPU-1019

Change-Id: I9e18ffc961d485225732c34d3ca561e84d182d07
Signed-off-by: Amurthyreddy <amurthyreddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1921370
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-10-31 19:35:07 -07:00
Nicolas Benech
30aeb71693 gpu: nvgpu: Fix LibC MISRA 17.7 in therm
MISRA Rule-17.7 requires the return value of all functions to be used.
Fix is either to use the return value or change the function to return
void. This patch contains fix for all 17.7 violations instandard C functions
in therm.

JIRA NVGPU-1036

Change-Id: If6c8ef1f88c922f417e53fe446853587a65583e9
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1929906
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@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>
2018-10-31 15:25:34 -07:00
Nicolas Benech
f3f4f7030a gpu: nvgpu: Fix LibC MISRA 17.7 in clk
MISRA Rule-17.7 requires the return value of all functions to be used.
Fix is either to use the return value or change the function to return
void. This patch contains fix for all 17.7 violations instandard C functions
in clk files.

JIRA NVGPU-1036

Change-Id: Ie5979d44b2b02cb9899add031989042edb28df80
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1929902
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@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>
2018-10-31 15:25:30 -07:00
Nicolas Benech
4e41a0b199 gpu: nvgpu: Fix LibC MISRA 17.7 in os/posix
MISRA Rule-17.7 requires the return value of all functions to be used.
Fix is either to use the return value or change the function to return
void. This patch contains fix for all 17.7 violations instandard C functions
in OS/Posix interface.

JIRA NVGPU-1036

Change-Id: I2da417edc992f16de24cdff536c0538f1fde8b61
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1929901
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@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>
2018-10-31 15:25:27 -07:00
Nicolas Benech
b9e7ea65e1 gpu: nvgpu: Fix LibC MISRA 17.7 in os/linux
MISRA Rule-17.7 requires the return value of all functions to be used.
Fix is either to use the return value or change the function to return
void. This patch contains fix for all 17.7 violations instandard C functions
in OS/Linux interface.

JIRA NVGPU-1036

Change-Id: I39b20f1d0e1a1da56d452f2c3d5ee049666cefe8
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1929900
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-misra-checker <svc-misra-checker@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>
2018-10-31 15:25:23 -07:00
Deepak Nibade
e059f3cb12 gpu: nvgpu: add separate unit for netlist
All the netlist parsing code is currently under GR unit, but netlist
ucode parsing does not really have any logical dependency to GR

Hence separate out a new unit common/netlist/ that parses the netlist
image and stores/exposes its content through netlist_vars structure

Structure nvgpu_netlist_vars is added to structure gk20a

Move netlist parsing code to common/netlist/netlist.c and chip
specific files to common/netlist/netlist_<chip>.c
Move simulation netlist parsing to common/netlist/netlist_sim.c

Rename g.ops.gr_ctx HAL to g.ops.netlist

Rename all the exported structures to be in the form of nvgpu_*
Rename all exported functions to be in the form of nvgpu_netlist_*()

Add netlist initialization to GPU boot path, and add deinitialization
to GPU remove path

Jira NVGPU-1317

Change-Id: I9af86e3b3230a89db5260cc8ed96ff5f72938c9a
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1936454
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-10-31 09:00:49 -07:00
Deepak Nibade
ac1a2f0897 gpu: nvgpu: use HAL to read fecs_ctx_state_store_major_rev_id()
In gk20a/gr_ctx_gk20a.c we right now directly read the GR register
gr_fecs_ctx_state_store_major_rev_id_r() which adds the dependency
to GR h/w header

Add a new HAL g.ops.gr.get_fecs_ctx_state_store_major_rev_id() to
read this register and use this instead
Also remove h/w header from gr_ctx_gk20a.c

Jira NVGPU-1317

Change-Id: Iab64fbfacff4d7ce4f3b61ca90b00ddc77e29551
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1936453
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-10-31 09:00:40 -07:00
Mahantesh Kumbar
52a901755c gpu: nvgpu: tu10x temperature read support
-Set flag NVGPU_SUPPORT_GET_TEMPERATURE to true
 to enable temperature read support for tu10x

Bug 200462084

Change-Id: If7098d22cb379b6d9dfdebb324cc6a82ac072551
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1936216
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-10-31 05:12:01 -07:00
Mahantesh Kumbar
646304e800 gpu: nvgpu: volt policy support for single rail
-Modifed volt policy construct to support of
 type SINGLE_RAIL in volt_volt_policy_construct()
-Modified volt_get_volt_policy_table() to fetch
 single rail data from bios table to construct
 SINGLE_RAIL volt policy.
-Added volt_construct_volt_policy_single_rail() to construct 
single rail volt policy boardobj needed for tu10x & PS3.5
 
JIRA NVGPU-1156

Change-Id: I495e005e46ee08a7851a317869bb5bc3f5f9a97e
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1921473
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-10-30 23:06:22 -07:00
Mahantesh Kumbar
db85228748 gpu: nvgpu: boardobj volt device IPC_VMIN support
-Add support for volt device OPERATION_TYPE_IPC_VMIN
 support
-Added defines required for ipc vmin operation support
-Modified volt_get_voltage_device_table_1x_psv()
 to add check to support IPC_VMIN & assign pwm source
 based on operation type.

JIRA NVGPU-1156

Change-Id: Ia168669ea6b5896916747fccde8c6a52c271c4e3
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1921395
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-10-30 23:06:13 -07:00
Deepak
b91228e506 gpu: nvgpu: vgpu: Get channel reference
- In vGPU code path, function vgpu_channel_abort_cleanup() does not
  obtain channel reference before using the channel structure
  (channel_gk20a)
- vgpu_channel_abort_cleanup() is called by vgpu_intr_thread() which
  runs commands obtained from interrupt queue from RM server.
- If there is a scenario where gk20a_channel_release() function runs
  before guest receives notification from RM server to abort channel
  cleanup, channel gets freed before vgpu_channel_abort_cleanup() runs.
- However, because vgpu_channel_abort_cleanup() does not take explicit
  reference to the channel, it ends up accessing structures
  (such as ch->g) which are set to NULL and thus we end up in a crash.
- This patch explicitly takes reference of channel before
  vgpu_channel_abort_cleanup() is called.
- If gk20a_channel_release() runs before vgpu_channel_abort_cleanup()
  and ends up freeing channel, we dont get reference to freed
  channel in vgpu_channel_abort_cleanup() and thus we return from
  function rather than continuing with freed channel as was the case
  previously.

Bug 200453473
JIRA EVLR-3411

Change-Id: I311043b2231336616b28246531cf8a0dc151b0cd
Signed-off-by: Deepak Bhosale <dbhosale@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1932028
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Aparna Das <aparnad@nvidia.com>
Reviewed-by: Nirav Patel <nipatel@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-10-30 17:58:28 -07:00
Scott Long
5c74b5a209 gpu: nvgpu: MISRA 21.15 fixes to acr code
MISRA Rule 21.15 prohibits use of memcpy() with incompatible ptrs
to qualified/unqualified types.

To circumvent this issue we've introduced a new MISRA-compliant
nvgpu_memcpy() function.

This change switches all offending uses of memcpy() in acr code
over to use nvgpu_memcpy() with appropriate casts applied.

JIRA NVGPU-849

Change-Id: Ib7bac9353cf69c402f8925927c84d4ae7ecbe49d
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1939422
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-misra-checker <svc-misra-checker@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>
2018-10-30 16:11:44 -07:00
Scott Long
68a042c8d4 gpu: nvgpu: MISRA 21.15 fixes to pmu_perf code
MISRA Rule 21.15 prohibits use of memcpy() with incompatible ptrs
to qualified/unqualified types.

To circumvent this issue we've introduced a new MISRA-compliant
nvgpu_memcpy() function.

This change switches all offending uses of memcpy() in pmu_perf/*.c
code over to use nvgpu_memcpy() with appropriate casts applied.

JIRA NVGPU-849

Change-Id: Iac5e0b1d460f094e950dd4e34e9ccf6a5b0a9edc
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1939421
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-misra-checker <svc-misra-checker@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>
2018-10-30 16:11:40 -07:00