Commit Graph

5129 Commits

Author SHA1 Message Date
Philip Elcan
df79ddfd86 gpu: nvgpu: pmu: drop timeout for pmu_write_cmd
The timeout parameter was always specified as ~0, so just use max
timeout and stop passing the parameter.

JIRA NVGPU-1008

Change-Id: I971e9ccd6bd2c8dd682facda3ce1314fc9653371
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1966340
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-12-06 16:03:52 -08:00
Philip Elcan
f6a2b839cf gpu: nvgpu: make PMU_CMD_FLAGS* U8 values
These macros are for setting the 8 bit ctrl_flags member of the
pmu_hdr struct. Making these macros U8 fixes MISRA 10.3 violations for
implicit assignment of different types.

JIRA NVGPU-1008

Change-Id: I325c845b01aa044d08458b51409b04ef29699335
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1966339
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-12-06 16:03:49 -08:00
Philip Elcan
8fcdd9c287 gpu: nvgpu: pmu_pg: fix MISRA 10.3 violations
MISRA 10.3 prohibits implicit assignment of objects to a narrower or
different essential type. This fixes 10.3 violations in pmu_pg.c

JIRA NVGPU-1008

Change-Id: Id5c79d5d9e823993199d6529f9d77667c2f3318a
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1966338
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-12-06 16:03:45 -08:00
Vinod G
4e971e63b5 gpu: nvgpu: Disable NVGPU_PMU_PSTATE flag
Disable NVGPU_PMU_STATE flag for dGpu VDK,
as pmu is not supported.

JIRA NVGPU-1564

Change-Id: I31e5cbf8f7deef6f34665fc87817462b0f1046a0
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1965528
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-06 11:25:47 -08:00
Abdul Salam
f7febd1c7a gpu: nvgpu: Fix Misra 15.7 Violations.
Misra rule 15.7 requires if..else if statement to end with else.
The else should have either one side effect or a comment.
Added nvgpu_log_info to print debug info.

JIRA NVGPU-1484

Change-Id: I7432ee03337e71d59d37dcffb0fb0ce9718163e0
Signed-off-by: Abdul Salam <absalam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1965207
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: Adeel Raza <araza@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-06 11:25:38 -08:00
Vinod G
581847c804 gpu: nvgpu: Disable compression support for vdk
TU104 VDK compression support isnot complete,
disable the hal that support the compression
initialization.

JIRA NVGPU-1564

Change-Id: Ia4fbf21a379d6e5c4008e576c42d2e2d4adb5495
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1964689
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-06 11:25:35 -08:00
Debarshi Dutta
9abe9fe062 gpu: nvgpu: replace input param chid with pointer to channel
preempt_channel needs to use the channel to pass it to other
public functions, get access to a tsg etc. This qualifies it to take a
pointer to a channel as an input parameter instead of a chid.

Increment the channel ref counter using the function
gk20a_channel_from_id in functions where we get the chid from the h/w
registers directly. Once the prempt_channel function call is done,
use a gk20a_channel_put on the referenced channel.

Jira NVGPU-1461

Change-Id: I6c87c8104cfcb418d468c8c590087fd4aeabf4bd
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1963200
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-05 21:55:10 -08:00
Debarshi Dutta
99acb8011a gpu: nvgpu: replace input param chid with pointer to channel
gk20a_fifo_recover_channel takes a reference to the channel via its
chid before passing the channel pointer to other public functions such
as gk20a_channel_abort and gk20a_fifo_error_ch. This qualifies the
gk20a_fifo_recover_channel to take a pointer to a channel instead of
only chid.

Jira NVGPU-1461

Change-Id: I338a12a05e5ccee785a202fea7848db5201a3a39
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1963199
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-05 21:55:00 -08:00
Konsta Holtta
ebc641fbc2 gpu: nvgpu: isolate fifo_sched_disable_runlist_m
Fifo scheduling APIs require the HW reg mask accessor
fifo_sched_disable_runlist_m() to be used even from high-level logic.
Restructure the APIs to take in an explicit bitmap of runlist IDs and
translate the bitmap to units of fifo_sched_disable_runlist_m() (which
happens to be an identical bitmap) only just before accessing hardware.

Jira NVGPU-1309

Change-Id: I5d6ce5b719ef467172c07c8d7589d83942365025
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1960225
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-05 21:54:51 -08:00
Vinod G
8762f41760 gpu: nvgpu: Changes for TU104 Vdk support
Add hal for tu104 is_pmu_supported function.
No pmu support for dGpu simulation.

JIRA NVGPU-1564

Change-Id: I9e0c6d089cebb0fb824dadbfd89108e843abdeab
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1964499
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-05 18:13:53 -08:00
Vinod G
a747e3a3ba gpu: nvgpu: RTV cb support for gfxp
Add new buffer support for graphics
preemption in Turing.
Add new hal for allocate and commit
rtv circular buffer for gfxp.
Add new hal for free gr_ctx for TU104.

JIRA NVGPUT-98

Change-Id: I4396fd50288db55da5f924fefa96a2e3d170094b
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1944975
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-05 17:03:53 -08:00
Alex Waterman
27f3cd5290 Revert "gpu: nvgpu: Move pd_cache declarations to new header"
This reverts commit 15603b9fd5.

Causes a build break in the PD cache unit test. Not sure how this
passed GVS - must have been a race or something? Unclear.

Change-Id: Ia484a801d098d69441326fa1dd40a1c86e2e23ce
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1966335
2018-12-05 13:24:03 -08:00
Alex Waterman
15603b9fd5 gpu: nvgpu: Move pd_cache declarations to new header
The pd_cache header declarations were originally part of the
gmmu.h header. This is not good from a unit isolation perspective
so this patch moves all the pd_cache specifics over to a new
header file: <nvgpu/pd_cache.h>.

Also a couple of static inlines that were possible when the code
was part of gmmu.h were turned into real, first class functions.
This allows the pd_cache.h header to not include the gmmu.h
header file.

Also fix an issue in the nvgpu_pd_write() function where the data
was being passed as a size_t for some reason. This has now been
changed to a u32.

JIRA NVGPU-1444

Change-Id: Iead9a0d998396d2289ffcb3b48765d770400397b
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1965271
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-05 12:24:52 -08:00
Abdul Salam
f110d6b2f1 gpu: nvgpu: xve: fix misc MISRA 16.3 violations
MISRA rule 16.3 states all switch clause to have break
Fixing the missing break statement for default case
This also makes the switch statement well-formed covering 16.1
Added new line before switch statement to improve readability

JIRA NVGPU-1505

Change-Id: I853ff4167c57e553980bf53390a0e921cc103e46
Signed-off-by: Abdul Salam <absalam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1961843
Reviewed-by: svc-misra-checker <svc-misra-checker@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-12-05 12:24:36 -08:00
Alex Waterman
4688c596e2 gpu: nvgpu: unit: Add pd_cache unit test for VC C1
Add a unit test that executes the verification criteria C1.

JIRA NVGPU-1323

Change-Id: I7a14076c4084e54c38f514590eb8ccd9a5f9327b
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1949209
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-05 12:24:32 -08:00
Srirangan Madhavan
f756732979 gpu: nvgpu: Fix MISRA 15.6 violation
MISRA rule 15.6 makes it mandatory to add braces for
all if-else blocks, including those with single statements.
Correcting one such violation in log.h

Change-Id: I82375d76303a424cf39a2757e3a96bca069039df
Signed-off-by: Srirangan Madhavan <smadhavan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1965017
Reviewed-by: Mahati Domalapally <mdomalapally@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-05 11:14:38 -08:00
Sai Nikhil
1c3e533d98 gpu: nvgpu: tu104: fix MISRA Rule 10.4 Violations
MISRA Rule 10.4 only allows the usage of arithmetic operations on
operands of the same essential type category.

Adding "U" at the end of the integer literals to have same type of
operands when an arithmetic operation is performed.

This fixes violations where an arithmetic operation is performed on
signed and unsigned int types.

JIRA NVGPU-992

Change-Id: I3b725e60f1908a4b3a308736d02600f86929cdd3
Signed-off-by: Sai Nikhil <snikhil@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1958306
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
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>
2018-12-05 07:44:24 -08:00
Sagar Kamble
4e4e76fd33 gpu: nvgpu: fix MISRA 5.6 violation
Fix following MISRA 5.6 violation.

kernel/nvgpu/drivers/gpu/nvgpu/common/pmu/acr_gm20b.c:50:
  Type: Coding standard violation (MISRA C-2012 Rule 5.6)
kernel/nvgpu/drivers/gpu/nvgpu/common/pmu/acr_gm20b.c:50:
  1. identifier_reuse: Identifier "get_ucode_details" is
     already used to represent a typedef.
kernel/nvgpu/drivers/gpu/nvgpu/common/pmu/acr_gm20b.c:50:
  2. typedef_declaration: Declaring a typedef with identifier
     "get_ucode_details" in remote file "acr_gp106.c".

JIRA NVGPU-1459

Change-Id: Ic5848f251d3be955f20cabcb26a17021b08ae37f
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1964439
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: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-04 22:44:46 -08:00
Sagar Kamble
ac3cb4cc53 gpu: nvgpu: consolidate FALCON_ID macros
Same Falcon IDs were defined in acr_lsfm.h with additional
defines. Update definitions in falcon.h and remove from
acr_lsfm.h.

JIRA NVGPU-1459

Change-Id: Id08c7f7a16c36087984a4418ddf7f4921084971a
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1964438
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: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-04 22:44:43 -08:00
Debarshi Dutta
bcfce1af62 gpu: nvgpu: fixed misra-c 16.6 violation
The switch statement "switch (interleave_level)" has no conforming
switch clauses as none of the clauses end with unconditional break
statement.

The above switch statement is now fixed in accordance to misra-c
standards.

Jira NVGPU-1555

Change-Id: Id2ea98826b5fff51f42eed83a597d8e0e273ebde
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1962545
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-04 22:44:31 -08:00
Nicolas Benech
f80d2a01f4 gpu: nvgpu: clean MISRA 17.7 in pd_cache.c
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 fixes for all 17.7 violations in pd_cache.c

JIRA NVGPU-677.

Change-Id: Idd5534ce82107071a1d47250f87e6a1046989433
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1964639
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-12-04 16:14:46 -08:00
Philip Elcan
15d98a7238 gpu: nvgpu: unit: add unit test for nvgpu_sgt
This provides a unit test for testing the mm/nvgpu_sgt unit, which
provides APIs for handling scatter-gather tables.

JIRA NVGPU-1443

Change-Id: I6f4eaf665b9a263d24435681233371da7e719570
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1962783
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-12-03 13:05:21 -08:00
Philip Elcan
991066aad7 gpu: nvgpu: posix: allow sgt iommuability config
This allows unit tests to control whether sgt's are viewed as IOMMU'able
or not.

JIRA NVGPU-1443

Change-Id: Ib0d17993fe05ecc9130c1d5bfd528795a5359ce5
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1962782
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@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-12-03 13:05:17 -08:00
Sagar Kamble
0f952a1a85 gpu: nvgpu: use FALCON_MAILBOX_0 macro
One of the mailbox 0 read and write hardcoded mailbox number.
Use the macro instead.

JIRA NVGPU-1459

Change-Id: Ic350c91c2100d09187c69724945dae920c9712c5
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1961635
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-03 00:13:23 -08:00
Sagar Kamble
d13059701f gpu: nvgpu: add falcon queue field getters
To eliminate direct accesses to falcon queue members id, index and size
introduce getters falcon_queue_get_id|index|size.

JIRA NVGPU-1459

Change-Id: Ic01e36bde0bad522087f49e5c70ac875f58ca10f
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1958400
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
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>
2018-12-03 00:13:19 -08:00
Sagar Kamble
8ebf2f0f26 gpu: nvgpu: access falcon data via public api
With falcon as a independent unit, convert all direct accesses to falcon
base structure members to use exported interfaces.

JIRA NVGPU-1459

Change-Id: I868dc0cd1d35c87c9ad49c91094e4fb56e705401
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1956023
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-03 00:13:15 -08:00
Sagar Kamble
67d7039a3d gpu: nvgpu: remove unused falcon declarations
Some of the falcon declarations are unused. Delete them.
Localise other exported functions that are not being used publicly.
Also fix MISRA 10.3 and 10.4 violation in falcon.c.

JIRA NVGPU-1459

Change-Id: I86318b4fc149450a2eade52973dfcf7aba8f2eca
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1956022
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
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>
2018-12-03 00:13:12 -08:00
Philip Elcan
e41ed1218e gpu: nvgpu: nix useless nvgpu_pmu_cmd_post param
The function nvgpu_pmu_cmd_post() included a timeout parameter, but all
callers were just passing the max value, so it was useless. This change
removes that parameter from that function. The same was true for
therm_pmu_cmd_post() that calls nvgpu_pmu_cmd_post(), so do the same to
it.

JIRA NVGPU-1008

Change-Id: I634ac40104ebd7cce36013a585dcb818aefd546a
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1962178
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-11-30 16:34:41 -08:00
Philip Elcan
3b5bb8a415 gpu: nvgpu: acr: add casts for MISRA 10.3
This adds casts for cases where the ACR code was violating MISRA Rule
10.3. These are cases where assignments are made to objects of different
size or essential types. In cases where the source could overflow the
case, an assert is included.

JIRA NVGPU-1008

Change-Id: Iea2ce500326e8c482663111a36c5b428825bfd04
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1959638
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-30 16:34:38 -08:00
Philip Elcan
64eb490488 gpu: nvgpu: acr: add missing return check
gp106_prepare_ucode_blob() wasn't checking the return value for
lsfm_discover_and_add_sub_wprs() in one case. This checks that return
and exists if there is an error.

JIRA NVGPU-1008

Change-Id: I9767879b75488ecda359dc1c103fc32278727b74
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1962177
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-11-30 16:34:29 -08:00
Philip Elcan
378b9189c2 gpu: nvgpu: acr: fix misc MISRA 10.3 violations
MISRA 10.3 prohibits implicit assignment of objects to a narrower or
different essential type. This fixes a few miscellaneous violations in
the ACR code.

JIRA NVGPU-1008

Change-Id: I256c84283584f971574da239f4c2e7b09495300a
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1959637
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-30 16:34:25 -08:00
Philip Elcan
27eb393cc8 gpu: nvgpu: acr: cast sizeof assignment to u32's
MISRA 10.3 prohibits implicit assignment of objects to a narrower or
different essential type. This change addresses cases in the ACR code
where the u64 result of sizeof() is being assigned to a u32.

JIRA NVGPU-1008

Change-Id: Id4ccb0ef6c0fd9872c4e8cb7ede736e9ae326c6c
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1959636
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-30 16:34:16 -08:00
Alex Waterman
7d9d835631 gpu: nvgpu: Unified VA space for vGPUs
Enable unified address spaces for all vGPU configurations.

Bug 200105199

Change-Id: Ic175214dafccaba5850c1e1995ff0b5280a4ad09
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1955625
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-30 15:24:20 -08:00
Seema Khowala
ba0d76189e gpu: nvgpu: address alloc_blob_space physically
Add NVGPU_DMA_PHYSICALLY_ADDRESSED flag for blob_space.

Bug 2422486

Change-Id: I44347430ee03b473875d8e49500a08c40ef9194f
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1962057
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
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-30 14:13:47 -08:00
Konsta Holtta
94d4a42d10 gpu: nvgpu: add runlist_busy_engines HAL
Split out the code to check which engines on a particular runlist are
busy from gk20a_fifo_runlist_reset_engines() and make it a HAL op.
Resetting engines is common across chips but status is read from
registers.

Jira NVGPU-1309

Change-Id: I7a63a2942a9e210481822eaf85795fc17dad0dc5
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1961822
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-30 11:54:27 -08:00
Debarshi Dutta
c965ef8dc2 gpu: nvgpu: error handling for invalid ioctl call
NVGPU_GPU_IOCTL_GET_EVENT_FD should return -EINVAL when invoked in any
chips which donot have NVGPU_SUPPORT_DEVICE_EVENTS enabled. This is
resulting in an use-after-free error in UBSAN from syzkaller fuzzing
in the nvgpu driver.

Also, as an addon remove the flag clk_arb_events_supported as the
device events check can be made using the flag
NVGPU_SUPPORT_DEVICE_EVENTS.

Bug 200463292

Change-Id: I0ed0217704daa9e401b57a268a30b9f798928e4a
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1956070
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Konsta Holtta <kholtta@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-30 11:54:17 -08:00
Debarshi Dutta
e19cea7ab3 gpu: nvgpu: replace input parameter tsgid with pointer to struct tsg_gk20a
The function gk20a_fifo_recover_tsg has to pass a valid struct tsg to
other functions from within. This qualifies it to have a pointer to
struct tsg_gk20a as an input parameter.

Tsg specific parts of the gk20a_fifo_preempt_timeout_rc are now moved
into another function gk20a_fifo_preempt_timeout_rc_tsg
that takes a tsg as an input and passes it to gk20a_fifo_recover_tsg.
The pointer to a tsg is also used to enumerate channels from within.

The function gk20a_fifo_preempt_timeout_rc now contains only channel
specific code.

Jira NVGPU-1461

Change-Id: Ice0a9921567841fb5586a7e4e010c442ca6cf172
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1961675
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-30 08:16:09 -08:00
Sai Nikhil
6be2dc76e0 gpu: nvgpu: MISRA 10.3 conversion to/from char
s8 is defined as signed char. The char values can not be assigned
directly to s8 variables, as MISRA considers signed char as an
essentially signed integer type. So assign the s8 variables with integer
literals instead of chars.

JIRA NVGPU-1010

Change-Id: I5f10fb2360d3327615e19afa12d585a414fd9ff8
Signed-off-by: Sai Nikhil <snikhil@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1959098
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
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-30 08:15:09 -08:00
Debarshi Dutta
1e78d47f15 gpu: nvgpu: replace input parameter tsgid with pointer to struct tsg_gk20a
gv11b_fifo_preempt_tsg needs to access the runlist_id of the tsg as
well as pass the tsg pointer to other public functions such as
gk20a_fifo_disable_tsg_sched. This qualifies the preempt_tsg to use a
pointer to a struct tsg_gk20a instead of just using the tsgid.

Jira NVGPU-1461

Change-Id: I01fbd2370b5746c2a597a0351e0301b0f7d25175
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1959068
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-30 08:15:06 -08:00
Debarshi Dutta
e5bebd880f gpu: nvgpu: replace tsgid input variable with pointer to a struct tsg_gk20a
replace tsgid with a pointer to a struct tsg_gk20a in the function
gk20a_fifo_tsg_abort(). gk20a_fifo_tsg_abort needs to enumerate through
all the channels within the tsg as well as pass the tsg pointer to
other functions, qualifying the need to use a pointer instead as an
input parameter.

Jira NVGPU-1461

Change-Id: I59cec05d5d778f733d0c3e9ffadf46e74e249080
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1956567
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-30 08:14:48 -08:00
Vaikundanathan S
ede1d184cf gpu: nvgpu: Export prog domains mask.
Export Prog domains mask to PMU

JIRA NVGPU-1151

Change-Id: I765435a21729ad10ac6002b6f5dc1f6cc714d4a8
Signed-off-by: Vaikundanathan S <vaikuns@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1962395
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: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-30 02:34:41 -08:00
Philip Elcan
b531d6d44d gpu: nvgpu: fix MISRA 10.3 errors in pd_cache
MISRA Rule 10.3 prohibits assigning objects to different or narrower
types. This change resolves all of the 10.3 violations in the pd_cache
unit.

JIRA NVGPU-1008

Change-Id: I5b547e0e208caea2e4204708c3a50d98919409f8
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1962046
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@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-29 18:55:08 -08:00
Scott Long
2a3fa45dd3 gpu: nvgpu: revert vfe_var param name change
Revert the param name change to devinit_get_vfe_var_table() from
previous change to vfe_var.c.

It was already fixed (in a different manner) by an earlier
Rule 8.3-related change.

JIRA NVGPU-849

Change-Id: I8435699b6999949ebae421a34e54487cfe777974
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1959752
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@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-29 16:34:41 -08:00
Anup Mahindre
ae57a78c73 gpu: nvgpu: Return size of ring buffer from NVGPU_CTXSW_IOCTL_RING_SETUP
NVGPU_CTXSW_IOCTL_RING_SETUP is used to setup a ring buffer of custom
size for FECS tracing. It uses size field from its arguments to setup a
user-mapped ring buffer for holding FECS Trace entries.

The value from this field is rounded up to nearest page-size boundary.
This rounded up value is supposed to be returned by the IOCTL (as per
description of the field in nvgpu.h).
That is currently not the case and the IOCTL just returns the same value
as that was passed.

This change fixes this issue by returning updated value.

Bug 200469520

Change-Id: I477aefaede9a4cdba921026466db3fb8fbfd0712
Signed-off-by: Anup Mahindre <amahindre@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1955337
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@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-11-29 10:15:05 -08:00
Sai Nikhil
4e9e199380 gpu: nvgpu: gv11b: fix MISRA Rule 10.4 Violations
MISRA Rule 10.4 only allows the usage of arithmetic operations on
operands of the same essential type category.

Adding "U" at the end of the integer literals to have same type of
operands when an arithmetic operation is performed.

This fixes violations where an arithmetic operation is performed on
signed and unsigned int types.

JIRA NVGPU-992

Change-Id: I4f2d2b960b705690d5d23d2945816fd8f3f8fb75
Signed-off-by: Sai Nikhil <snikhil@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1831885
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
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-29 09:05:02 -08:00
Mahantesh Kumbar
3cbe32c3a4 gpu: nvgpu: set therm limits for tu10x
-Get therm min/max supported temperature value for tu10x
-min/max supported temperature values are inherited from gp106
 as tu10x values remains same as gp106.

JIRA NVGPU-1150

Change-Id: I358feb8641f518cd5d0878a51b4a11943a9b83b3
Reviewed-on: https://git-master.nvidia.com/r/1929921
Signed-off-by: Vaikundanathan S <vaikuns@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1957830
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
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>
2018-11-29 05:35:41 -08:00
tkudav
196126147e gpu: nvgpu: Update gv100PMU to match sprsurfce i/f
The GV100 supersurface interface file needs to be temporarily
adjusted to avoid Turing changes from breaking GV100 pstate
support.

Change-Id: Id7137d1f041faa5824c5e36ae492526d6713965b
Reviewed-on: https://git-master.nvidia.com/r/1932488
Signed-off-by: Vaikundanathan S <vaikuns@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1957852
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-29 05:35:37 -08:00
Mahantesh Kumbar
abe62f6fe0 gpu: nvgpu: tu10x PMU ucode update
-Updated PMU version number to sync with
 p4 cl #:25133717
-As LS falcon's bootstrap is taken care by SEC2 RTOS
so, removed ACRLIB from PMU ucode & disabled WPR
init from PMU by setting ops .init_wpr_region to NULL
-Adding dummy bytes to PMU supersurface member therm
data structure to match with tu10x ucode  supersurface
change sequence offset.
-PMU ucode update to enable ECC interrupt
-Enable ECC interrupt in Falcon interrupt source
-Enable routing of ECC interrupt to HOST.

JIRA NVGPU-1150

Change-Id: Ib49f9bf811dc2a01252461c16a44869e07412005
Reviewed-on: https://git-master.nvidia.com/r/1929895
Signed-off-by: Vaikundanathan S <vaikuns@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1957846
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-29 05:35:28 -08:00
Vaikundanathan S
a50aa08c0e gpu:nvgpu Add Clock Frequency domain
-Need to send clock frequency domain
 boardobj for PS3.5
-Need this to be sent before Clock
 fll boardobj is sent to PMU.

JIRA NVGPU-1264

Change-Id: I66188b196929cc4d9d6ac3744a193b7075aa0327
Signed-off-by: Vaikundanathan S <vaikuns@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1929787
Reviewed-on: https://git-master.nvidia.com/r/1950395
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-29 05:35:19 -08:00
Mahantesh Kumbar
281c150080 gpu: nvgpu: enable pstate support for tu10x
-Enable supported on tu10x

JIRA NVGPU-1150

Change-Id: Id32d5a966de3fbbfff5271bf2d5a127f0aa87b5f
Reviewed-on: https://git-master.nvidia.com/r/1929896
Signed-off-by: Vaikundanathan S <vaikuns@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1957829
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-11-29 05:35:10 -08:00