Commit Graph

5250 Commits

Author SHA1 Message Date
Seema Khowala
2c379cad0f gpu: nvgpu: add handling for ctxsw_intr0
ctxsw_intr0 is triggered by ucode even if it
is not enabled by driver. Add handling
for processing ctxsw_intr0. fecs mailbox(6)
is used to report fecs/gpccs misc error codes.
Also dump falcon stats for unhandled fecs intr.

Bug 2361571
Bug 200472922

Change-Id: Iefb3c0d46ad1d08db07fd3c08cff91a77835908c
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1966984
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-07 14:53:53 -08:00
Nicolas Benech
48648cfc58 gpu: nvgpu: unit: Argument to run single unit
Specify a unit to run from the command line, especially useful
as the number of units is increasing. The argument behaves as
a wildcard. All units that contain the argument in the name will
be executed.

JIRA NVGPU-1246

Change-Id: Ia650929751a0acd83fc034fbeb0fd7df8d39e48d
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1967082
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
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-12-07 13:54:27 -08:00
Adeel Raza
9d92695e97 gpu: nvgpu: bios: change bit to bios_bit
MISRA Rule 5.7 Definition: A tag name shall be a unique identifier.

Rule 5.7 violations can occur if a variable has the same name as a
struct. bios.c defines a "struct bit". "bit" is a very common name for
variables which causes a name conflict with "struct bit". Therefore,
change "struct bit" to "struct bios_bit" to resolve rule 5.7 violations.

Jira NVGPU-845

Change-Id: I02f2fa6cf1701c7de2e365635b18ecee0f8296fa
Signed-off-by: Adeel Raza <araza@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1965693
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: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-07 13:54:23 -08:00
Vinod G
f9490bd065 gpu: nvgpu: dGpu VDK support
Set acr sw_init to NULL, not supported in
dGpu VDK.
Set NVGPU_GR_USE_DMA_FOR_FW_BOOTSTRAP to
false.

JIRA NVGPU-1564

Change-Id: Ic1dbbefc1fb5cff0a74737b54271287a08bef5d8
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1966356
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Seshendra Gadagottu <sgadagottu@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-07 12:15:39 -08:00
Vinod G
794f6837d6 gpu: nvgpu: Add hal for bios_init in TU104
Add hal function for bios_init in TU104.
dGpu vdk doesnot have bios support.

JIRA NVGPU-1564

Change-Id: I172de6eeeaf63e9b26ae697405baa936096fe447
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1965595
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: Seshendra Gadagottu <sgadagottu@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-07 12:15:35 -08:00
Alex Waterman
fc939e5fb6 gpu: nvgpu: Add IOCTL flag + plumbing for unified VAs
Add a flag that let's userspace enable the unified VM functionality
on a selective bassis. This feature is working for all cases except
a single MODS trace. This will allow test coverage to be selectively
added in certain userspace tests as well to help prevent this feature
from bit rotting (as it has historically done).

Also update the unit test for the page table management in the GMMU
to reflect this new flag. It's been set to false since the target
platform for safety is currently not using unified address spaces.

Bug 200438879

Change-Id: Ibe005472910d1668e8372754be8dd792773f9d8c
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1951864
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@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-12-07 12:15:11 -08:00
tkudav
b361c38bca gpu: nvgpu: Fix MISRA 15.7 violation in priv_ring
MISRA 15.7 does not allow empty terminating "else" statement.
Add INFO level print in the else condition to conform to
MISRA 15.7.

JIRA NVGPU-1490

Change-Id: If4da58f874cf84ccce20e01075e05a1d1ade37fc
Signed-off-by: tkudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1967591
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>
Reviewed-by: Deepak Nibade <dnibade@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-07 11:05:15 -08:00
Alex Waterman
ba85fc999b gpu: nvgpu: Move pd_cache declarations to new header
The pd_cache header declarations were oriignally 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 allowed 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: Ib9e9e5a54544de403bfcd8e11c30de05721ddbcc
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1966352
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-07 11:05:11 -08:00
Scott Long
5bdffee1a8 gpu: nvgpu: MISRA 10.3 fixes to gr
MISRA Rule 10.3 states that the value of an expression shall not
be assigned to an object with a narrower essential type or of a
different esseential type category.

For example, assigning an unsigned 32bit value (u32) to a signed
32bit value (int) is not permitted.

This patch modifies the gr_gk20a_init_golden_ctx_image() and
gk20a_init_sw_bundle() routines to use an int (instead of u32)
for return status handling making them consistent with the other
gr routines used in this part of the gr object allocation path.

JIRA NVGPU-647

Change-Id: I53c47d9a169bd0d4cdbce107bd4ad8e7978ae01d
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1965735
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: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-07 11:05:02 -08:00
Terje Bergstrom
60e31ff091 gpu: nvgpu: Remove mm_gk20a.h dep from pd_cache
pd_cache.c includes mm_gk20a.h. It does not seem to need it, so
drop the include.

Change-Id: Ifd95009f2b8bddf15e904b94c202dd9be322da6c
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1964676
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-07 11:04:58 -08:00
Scott Long
06dadf216e gpu: nvgpu: MISRA 11.8 fix to gk20a_from_pmu()
MISRA Rule 11.8 states that a cast shall not remove any const or
volatile qualification from the type pointed to by a pointer.

The linux kernel's container_of() macro contains such a violation as
it generates a pointer to a caller-specified (and so possibly non-const
qualified) type by casting an internally declared const pointer.

The gk20a_from_pmu() uses the container_of() macro to convert
from a struct nvgpu_pmu pointer to a struct gk20a pointer.

The struct nvgpu_pmu has a back pointer to struct gk20a already
however and so this change modifies gk20a_from_gpu() to just
return this back pointer rather than use container_of().

JIRA NVGPU-862

Change-Id: If0e2481c1cf104c2fa6b89334e20e75705bf9c44
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1955540
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@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-12-07 11:04:50 -08:00
tkudav
d6d10592b3 gpu: nvgpu: Fix MISRA 16.x violations in BIOS code
All the 16.x MISRA rules are relevant to switch statement
formatting and hence addressed in single patch

As per MISRA 16.1, all switch statements should be well formatted.

16.3 fixes:
Add unconditional break statements to all the switch-clauses
to adhere to MISRA rule 16.3. Also do not allow fall-through
(even the intentional ones) from one switch-clause to next one.

16.4 fixes:
Make sure all "default" clauses in the switch statements are
non-empty.

16.6 fixes:
Fix all switch statement formatting to fix MISRA 16.6 violations
which requires all the switch clauses to be conforming.

JIRA NVGPU-1496
JIRA NVGPU-1533
JIRA NVGPU-1550
JIRA NVGPU-1558

Change-Id: I7f373e99491eb860ca7c9edfeb43a32ad0b07baa
Signed-off-by: tkudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1961694
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Adeel Raza <araza@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-07 02:24:46 -08:00
Sagar Kamble
d2692fb5ac gpu: nvgpu: update falcon queue init api
With falcon as a independent unit, make falcon queue initialization
parameter based and accordingly update get_pmu_init_msg_pmu_queue_params_*.

JIRA NVGPU-1459

Change-Id: I8b9d356603b4b99a91a86ab514eb399c02268d7f
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1961633
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-07 02:24:43 -08:00
Philip Elcan
1e2e30b35d gpu: nvgpu: pmu_ipc: fix MISRA 10.3 violations
This fixes a number of MISRA 10.3 violations for implicit assignment to
different a essential type or size in pmu_ipc.c.

JIRA NVGPU-1008

Change-Id: I59ec8b82a1d1759207710b2bdab080e14b9d5c18
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1966341
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-12-06 16:03:56 -08:00
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
Alex Waterman
4be0c8ac20 gpu: nvgpu: unit: Add requirement unit test type
Add a type of unit test that satisfies requirement verification
criteria. This new unit test type allows the source code to link
to verification criteria.

JIRA NVGPU-1323

Change-Id: I5b9e5142f614b369aa805886ad6ca1283bd222ca
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1949208
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:29 -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
Nicolas Benech
904cd50026 gpu: nvgpu: unit: script to automate gcov
A new script, gcov.sh, can check and install missing dependencies,
run unit tests, run gcov and present the results in the browser.

JIRA NVGPU-1246

Change-Id: Ic225ac5d397efd539d14a358671a3c20460c277e
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1954049
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 10:25:28 -08:00
Nicolas Benech
0659ff2985 gpu: nvgpu: unit: fix typo in install script
A typo could cause the find/exec command to fail in the
install_unit.sh script.

JIRA NVGPU-1246

Change-Id: I0dd33954945f88d96c8704d863ac26a241af7b94
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1954030
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-12-04 10:25:24 -08:00
Nicolas Benech
37653c7e77 gpu: nvgpu: unit: fix missing list test on target
Add the "list" unit test to the target makefile as it was
missing and only being compiled/run on host.

JIRA NVGPU-1246

Change-Id: I02d93a70b259f6f3c04a296fdaecfc8413324c03
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1964556
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-03 20:16:13 -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