Commit Graph

6265 Commits

Author SHA1 Message Date
Deepak Nibade
6326f67702 gpu: nvgpu: fix MISRA 17.7 violation in gr.setup unit
Below MISRA 17.7 violation is reported in common.gr.setup unit

nvgpu/drivers/gpu/nvgpu/common/gr/gr_setup.c:289:
misra_c_2012_rule_17_7: The return value of a non-void function
"gk20a_enable_channel_tsg" is unused.

Fix this by checking return value of "gk20a_enable_channel_tsg"

Jira NVGPU-3407

Change-Id: I12b69bc67f59ec6a8a28aaf5801e065938e5da6c
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2114362
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-08 15:26:12 -07:00
Deepak Nibade
c629b633af gpu: nvgpu: fix MISRA 17.7 violation in gr.fs_state unit
Below MISRA 17.7 violation is reported in common.gr.fs_state unit

nvgpu/drivers/gpu/nvgpu/common/gr/fs_state.c:121:
misra_c_2012_rule_17_7: The return value of a non-void function
"*g->ops.gr.init.rop_mapping" is unused

This hal need not return any error hence convert return type to void

map_tiles are always allocated before calling this hal hence no need
to check if they are allocated in this hal

Jira NVGPU-3407

Change-Id: Ic78946fcc7b4780208c416c444d33aea2db20bfc
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2114361
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-08 15:26:03 -07:00
Vinod G
31c8f09241 gpu: nvgpu: gr.intr MISRA fixes for Rule 16.x
Fix MISRA Rule 16.x violations in gr.intr unit
All statements to be well-formed with terminating break statement for
every switch-clause.

Jira NVGPU-3395

Change-Id: Iad3a29628f44dfe64cfe916b5a8007a679c2fdc7
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2114160
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-08 14:16:04 -07:00
Mahantesh Kumbar
efe34ec6d7 gpu: nvgpu: PMU init update
Modified PMU subunits init sequence as they required during PMU RTOS
initialize stage, function nvgpu_pmu_early_init() allocates space for
all its subunit & its default values for further usage during runtime,
and function nvgpu_pmu_init() performs setup for sub units & starts
PMU-RTOS boot.

Deinit of all sub units allocated space will handled as part of
remove_support stage & also, during init stage upon failure of
init/setup sequence.

JIRA NVGPU-1972

Change-Id: I3ead9f9bb9e9c1178a02fc99eeec276660477325
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2110154
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-08 07:45:01 -07:00
Divya Singhatwaria
5ec94e4a98 gpu: nvgpu: Use sw ops for PMU PG unit
Some functions are not accessing hardware directly
but are being called using HAL ops: For example

g->ops.pmu.pmu_elpg_statistics,
g->ops.pmu.pmu_pg_init_param,
g->ops.pmu.pmu_pg_supported_engines_list,
g->ops.pmu.pmu_pg_engines_feature_list,
g->ops.pmu.pmu_is_lpwr_feature_supported,
g->ops.pmu.pmu_lpwr_enable_pg,
g->ops.pmu.pmu_lpwr_disable_pg,
g->ops.pmu.pmu_pg_param_post_init,
g->ops.pmu.save_zbc

Change the function access by using sw ops, like:
Create new functions:

int nvgpu_pmu_elpg_statistics(struct gk20a *g, u32 pg_engine_id,
		struct pmu_pg_stats_data *pg_stat_data);
void nvgpu_pmu_save_zbc(struct gk20a *g, u32 entries);
bool nvgpu_pmu_is_lpwr_feature_supported(struct gk20a *g,
			u32 feature_id);

JIRA NVGPU-3209

Change-Id: I6db9b43c7c4a5054720a72487302b740b091044d
Signed-off-by: Divya Singhatwaria <dsinghatwari@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2110963
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-08 03:25:23 -07:00
Vinod G
8e86bcfdfe gpu: nvgpu: gr/intr MISRA Fix for Rule 21.2
Fix MISRA Rule 21.2 violations in hal/gr/intr unit
A reserved identifier or macro name shall not be used

Jira NVGPU-3393

Change-Id: Ib43ab15bfe8e54b2848d0fc8ae7cb5424ddf48ff
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2114039
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-08 00:06:09 -07:00
Vedashree Vidwans
b4590adae4 gpu: nvgpu: fix MISRA 11.2 and 16.x in nvgpu_mem
MISRA Rule 11.2 doesn't allow conversion to or from an incomplete type
pointer, as it may result incorrect point alignment and may further lead
to undefined behavior.

MISRA Rule 16.x requires all switch statements to be well-formed with
terminating break statement for every switch-clause.

This patch fixes 11.2 and 16.x violations in common.mm.nvgpu_mem.

Jira NVGPU-3339

Change-Id: I002393cc64d44826e6954d1bf6af71bd569e862f
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2113096
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>
2019-05-07 21:38:53 -07:00
Philip Elcan
b96ac290c8 gpu: nvgpu: mm: fix MISRA 17.2 violation
MISRA Rule 17.2 prohibits recursion. Update the function
nvgpu_locate_pte() to remove recursion.

JIRA NVGPU-3340

Change-Id: I027887f45f334a5f9819cf2e620693f10ab4fa0b
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2110597
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 21:38:22 -07:00
Philip Elcan
4222052a53 gpu: nvgpu: gmmu: fix MISRA 16.x violations in gmmu.h
MISRA rules 16.x enforce specific switch statement formats including
always having a break. Fix MISRA 16.x violations in gmmu.h.

JIRA NVGPU-3340

Change-Id: Ic03878265e84a571c128c59ba5eee6c83a725a67
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2110596
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 21:38:12 -07:00
Philip Elcan
93cfec16a9 gpu: nvgpu: mm: fix MISRA 21.2 in page_table
MISRA rule 21.2 prohibits using __name for functions and identifiers.
Fix MISRA 21.2 violations in nvgpu.common.mm.gmmu.page_table.

JIRA NVGPU-3340

Change-Id: I8963ce4df96e4e9cf286135d87bfab7703d4f5bd
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2110595
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 21:38:02 -07:00
Seema Khowala
3d64bc19df gpu: nvgpu: channel MISRA fix for Rule 17.7
Check return value of nvgpu_timeout_init and spit
error message. Also return to the calling function
upon timeout init error in few cases.

JIRA NVGPU-3383

Change-Id: I97fcc7343051842a74d9bf379c372b7094c8de86
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2113157
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Thomas Fleury <tfleury@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>
2019-05-07 20:28:21 -07:00
Seema Khowala
0acc79be87 gpu: nvgpu: preempt MISRA fix for Rule 1.1
Add missing newline at the end of the file.

JIRA NVGPU-3383

Change-Id: I2430a8da322acfd7900bb604d9b3abd0133a2869
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2113119
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Thomas Fleury <tfleury@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>
2019-05-07 20:28:01 -07:00
Seema Khowala
c9686156c1 gpu: nvgpu: preempt MISRA fix for Rule 17.7
Check return value of nvgpu_pmu_lock_rlease and
spit error message.
Check return value of nvgpu_timeout_init and spit
error message. Also return to the calling function
upon timeout init error.

JIRA NVGPU-3383

Change-Id: I91636255d1f16fab4b2ab934df67149f5efca7fe
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2113107
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Nicolas Benech <nbenech@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 20:27:52 -07:00
ajesh
1639db51b2 gpu: nvgpu: fix MISRA violation in os_sched unit
MISRA rule 21.2 forbids the usage of identifier names which start with
an underscore.  Fix violation of MISRA rule 21.2 in os_sched unit.

Jira NVGPU-3139

Change-Id: Ic64a2590bb180b7ae9481daca5f7720dc2dc8719
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2112747
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dinesh T <dt@nvidia.com>
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 14:37:20 -07:00
Divya Singhatwaria
c19d7e3911 gpu: nvgpu: Use sw ops for Perfmon
Some functions are not accessing hardware directly
but are being called using HAL ops: For example

.pmu_init_perfmon = nvgpu_pmu_init_perfmon_rpc,
.pmu_perfmon_start_sampling = nvgpu_pmu_perfmon_start_sampling_rpc,
.pmu_perfmon_stop_sampling = nvgpu_pmu_perfmon_stop_sampling_rpc,
.pmu_perfmon_get_samples_rpc = nvgpu_pmu_perfmon_get_samples_rpc,

These were being called by:
g->ops.pmu.pmu_init_perfmon,
g->ops.pmu.pmu_perfmon_start_sampling,
g->ops.pmu.pmu_perfmon_stop_sampling,
g->ops.pmu.pmu_perfmon_get_samples_rpc

Change the function access by using sw ops, like:
Create new functions:
int nvgpu_pmu_perfmon_init(struct gk20a *g,
	struct nvgpu_pmu *pmu, struct nvgpu_pmu_perfmon *perfmon);
int nvgpu_pmu_start_sampling_perfmon(struct gk20a *g,
	struct nvgpu_pmu *pmu, struct nvgpu_pmu_perfmon *perfmon);
int nvgpu_pmu_stop_sampling_perfmon(struct gk20a *g,
	struct nvgpu_pmu *pmu, struct nvgpu_pmu_perfmon *perfmon);
int nvgpu_pmu_get_samples_rpc_perfmon(struct gk20a *g,
	struct nvgpu_pmu *pmu, struct nvgpu_pmu_perfmon *perfmon);

and based on hardware chip call the chip specific
perfmon sw init function: nvgpu_gv11b_perfmon_sw_init() and
nvgpu_gv100_perfmon_sw_init() and assign the sw ops for perfmon

JIRA NVGPU-3210

Change-Id: I2470863f87a7969e3c0454fa48761499b08d445c
Signed-off-by: Divya Singhatwaria <dsinghatwari@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2109899
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 13:37:24 -07:00
Vinod G
1cd29cc075 gpu: nvgpu: Fix MISRA Rule 15.7 errors in gr/intr unit
Fix MISRA violations for Rule 15.7 in gr/intr unit
misra_violation: No non-empty terminating "else" statement.

Jira NVGPU-3227

Change-Id: I369aa2997dc3f45f6ff3946a2febfc0a95a47d34
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2113223
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 12:43:53 -07:00
Vinod G
3ef3d129ee gpu: nvgpu: gr/init MISRA fix for Rule 17.7
Fix add for a MISRA violation Rule 17.7
The return value of a non-void function is unused.

Jira NVGPU-3227

Change-Id: Ia904340f2849066fb2a59571c1404c4a4a79ff4a
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2113175
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 12:43:26 -07:00
Nicolas Benech
c78741f460 gpu: nvgpu: unit: rbtree unit test
Adds a unit test module for interface.rbtree. This module covers
all the APIs of rbtree, 90% of statements and 81% of branches.

JIRA NVGPU-3247

Change-Id: I6799bafdbfad16ba7eb5691d01fdce8c023e3a5e
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111529
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 12:42:13 -07:00
Vaibhav Kachore
8edf86ef18 gpu: nvgpu: Enabling/disabling FECS trace support
- To enable FECS trace support, nvgpu should set the MSB
of the read pointer (MAILBOX1).
- The ucode will check if the feature is enabled/disabled
before writing a record into the circular buffer. If the
feature is disabled, it will not write the record.
- If the feature is enabled and the buffer is not allocated,
HW will throw a page fault error.

Bug 2459186

Change-Id: I71daf6fdb1bb67974f6e51e091f868cb08d3b0bf
Signed-off-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111028
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 12:36:31 -07:00
Vedashree Vidwans
e9e9ae9b92 gpu: nvgpu: fix MISRA rule 14.2 for loops
MISRA Rule 14.2 requires for loop to be well-formed. A well-formed for
loop has below requirements:
1. first clause can be empty or should assign value to a single loop
counter
2. second clause should exist and use loop counter or loop control flag.
It should not use any variable modified in the loop body.
3. third cluase should only update loop counter and should not use
objects modified in the loop body.

This modifies for loops to process single loop counter. The patch moves
additional initializations before for loop, conditions at loop start
and variable updates at the end of for loop.

Jira NVGPU-855

Change-Id: I93ccf1ac0677ff355364a718d2d953467f1d9d95
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2108188
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 11:37:29 -07:00
Vinod G
4b1d58e3f9 gpu: nvgpu: update for gr_priv header cleanup
To avoid gr_priv inclusion outside gr unit for deferencing the
gr struct for gr->config pointer, add new call
nvgpu_gr_get_config_ptr which returns gr->config pointer.

Jira NVGPU-3218

Change-Id: Ibe6827f75c7621b72490f100c3a77baf02db2dd0
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111737
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 10:40:26 -07:00
Seema Khowala
3df5e43f53 gpu: nvgpu: change init_pbdma_map to void function
Fix MISRA Rule 17.7. Change init_pbdma_map fn pointer
to return void.

JIRA NVGPU-3383

Change-Id: Id76522c22a9c85ccafff8bd7f9a93cab139f56d5
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2113212
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 09:46:27 -07:00
Seema Khowala
045d210bb8 gpu: nvgpu: delete fifo_gk20a.h
JIRA NVGPU-2012

Change-Id: Iea5d40ef481629ee0340319b221cbd64be6f11a9
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2113206
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Debarshi Dutta <ddutta@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 03:07:25 -07:00
Abdul Salam
576ada1c55 gpu: nvgpu: Move the boardobj from common to pmu.
Move the boardobj from common to pmu.
This boardobj belongs to pmu unit so keeping inside pmu.

Jira NVGPU-3215

Change-Id: I7ffe1f16bda71f2c0243476324c171b58d585dee
Signed-off-by: Abdul Salam <absalam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2110247
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ramesh Mylavarapu <rmylavarapu@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 03:06:20 -07:00
Abdul Salam
bba7a89be4 gpu: nvgpu: Move therm_pmu from gk20a to nvgpu_pmu
The aim is to have single pmu structure inside gk20a, that is nvgpu_pmu
struct and all the global structures of all units in PMU should be 
included in nvgpu_pmu struct.

Jira NVGPU-3216

Change-Id: Idc8c6c73514049809cfbde4ca6c1ad75688a5b80
Signed-off-by: Abdul Salam <absalam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2112732
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 02:02:54 -07:00
Nitin Kumbhar
981e46a793 gpu: nvgpu: global_ctx: fix misra rule 1.1 error
Fix typedef of global_ctx_mem_destroy_fn function pointer

Error: MISRA C-2012 Rule 1.1:
nvgpu/drivers/gpu/nvgpu/include/nvgpu/gr/global_ctx.h:35:
misra_violation: typedef name has already been declared (with same type)

NVGPU-3224

Change-Id: Ic54d40f6d308ce407973c49602fbb86264776f44
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2112704
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 02:02:38 -07:00
Nitin Kumbhar
53873f5daf gpu: nvgpu: ctx: fix misra rule 16.1 error
Fix misra errors from nvgpu_gr_ctx_prepare_hwpm_mode()

Error: MISRA C-2012 Rule 16.1:
nvgpu/drivers/gpu/nvgpu/common/gr/ctx.c:815:
missing_break: This switch clause does not end with
 an unconditional break statement.
nvgpu/drivers/gpu/nvgpu/common/gr/ctx.c:785:
misra_violation: The switch statement is not well formed.

NVGPU-3224

Change-Id: Ica7029fd84f443b8ce3d51a5c5f32bb6a6172040
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2112703
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 02:02:23 -07:00
Mahantesh Kumbar
d19be32f91 gpu: nvgpu: PMU debug init update
Moved allocation/free of debug buffer required for PMU RTOS
debug messages dump to PMU debug unit & will be called as
part of sw_setup/deinit stage of PMU.

JIRA NVGPU-1972

Change-Id: I4ac5f8d464548e7771fcd2a17998ff4028ea928b
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2110153
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ramesh Mylavarapu <rmylavarapu@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 01:59:36 -07:00
Mahantesh Kumbar
63ea167052 gpu: nvgpu: PMU mutex init update
Allocate space at runtime for PMU mutex, this helps to reduce the size
of nvgpu_pmu struct when LS_PMU support is not required.

Allocation happens at pmu early init stage & will deinit at remove_support
stage.

JIRA NVGPU-1972

Change-Id: I25411877fc2fa9da5e09c9e8d84d87cafd43f06d
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2110105
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ramesh Mylavarapu <rmylavarapu@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-07 01:59:26 -07:00
Mahantesh Kumbar
fa9050d28b gpu: nvgpu: PMU sequences init update
Allocate space at runtime for PMU sequences, this helps to reduce the size
of nvgpu_pmu struct when LS_PMU support is not required.

Allocation happens at pmu early init stage & will deinit at remove_support
stage.

And also removed some unused seq functions as part of CL

JIRA NVGPU-1972

Change-Id: Ib1ba983b476ddf937b08ef96e130ece2645b314c
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2110104
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>
2019-05-07 01:59:16 -07:00
Thomas Fleury
44f6c10947 gpu: nvgpu: submit MISRA fixes for Rule 5.7
Renamed local variable
- sync_fence -> flag_sync_fence

As "sync_fence" is already used to represent a type.

Also, renamed for consistency:
- fence_wait -> flag_fence_wait
- fence_get -> flag_fence_get

Jira NVGPU-3384

Change-Id: Ib40d068f0ebda985303a85a385f4123955d3b4c9
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111613
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-06 17:55:42 -07:00
Thomas Fleury
47b7820cb6 gpu: nvgpu: submit MISRA fixes for Rule 17.7
Check return value of gk20a_channel_add_job, and clean up
in case of failure.

Jira NVGPU-3384

Change-Id: Ic818d8bcf97fef6360aedd7a2a0a5a7f6f69150f
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111612
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-06 17:55:28 -07:00
Thomas Fleury
9f5ca49a07 gpu: nvgpu: submit MISRA fixes for Rule 15.7
Refactored if / else statements in nvgpu_submit_channel_gpfifo
to avoid "else if" with no terminating "else" statement.

Jira NVGPU-3384

Change-Id: If553901f418455d77c372fd1d7113553a21096e1
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111611
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-06 17:55:13 -07:00
Thomas Fleury
8b32821634 gpu: nvgpu: submit MISRA fixes for Rule 14.3
(!c->deterministic) ||
(nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE) && !c->deterministic)

is equivalent to

(!c->deterministic)

Remove second condition in nvgpu_submit_channel_gpfifo

Jira NVGPU-3384

Change-Id: Icf3e460d4fe9d310d94a21895832bbfae595df28
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111610
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-06 17:54:59 -07:00
Alex Waterman
6de260dcfb gpu: nvgpu: Fixups for comment is new MM HAL code
This fixes a few nits and issues in the comments of the MMU fault
and MM HAL headers.

JIRA NVGPU-2042

Change-Id: Ic4c5bf4bcc3c347e11f98a7cd746a7238919dc1e
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2113065
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
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>
2019-05-06 16:46:37 -07:00
Peng Liu
cc70f89bb4 Revert "gpu: nvgpu: cache gpu clk rate"
This reverts commit e9a6d179a4 ("gpu: nvgpu: cache gpu clk rate")

 - Real clock rate doesn't always equal clock rate requested by caller
 - call of clk_set_rate() and update of cached_rate are not atomic
 - Real root cause for Bug 2051688 is in bpmp and gboost design


Bug 2538692

Change-Id: I9248e0c69e2271ed2d0070587db59afa6f8160f2
Signed-off-by: Peng Liu <pengliu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2109708
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-06 16:46:00 -07:00
Thomas Fleury
1374fba039 gpu: nvgpu: engines MISRA fixes for Rule 10.4
engine_id cannot be compared directly with NVGPU_ENGINE_GR.
Instead, retrieve engine_info from engine_id, and compare
engine_info->engine_enum with NVGPU_ENGINE_GR

Jira NVGPU-3385

Change-Id: I45a2baaefc2d35521d12ba530b151c6ab7719b68
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111650
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-06 15:35:07 -07:00
Thomas Fleury
6fe4c09c68 gpu: nvgpu: engines MISRA fixes for Rule 10.3
Use BIT32 for shift operation on u32 act_eng_id.

Jira NVGPU-3385

Change-Id: I92f55bceafb87ba385786360f8df95f128b92351
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2113034
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-06 15:34:53 -07:00
Vedashree Vidwans
778f6b2874 gpu: nvgpu: fix MISRA 21.3 mm nvgpu allocator
MISRA rule 21.3 forbids from using calloc, malloc, realloc and free
identifiers for function or macro names. This patch renames nvgpu
allocator free operator to free_alloc to follow rule 21.3.

Jira NVGPU-3336

Change-Id: Ie9f48d567255a3e1dca70632fbe3d36b45023f3f
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111365
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>
2019-05-06 15:34:38 -07:00
Thomas Fleury
2b165deba1 gpu: nvgpu: engines MISRA fixes for Rule 1.1
Add missing newline at end of file.

Jira NVGPU-3386

Change-Id: Id62f99c1e9517932627949a65fe0b9e4fe802c49
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2113038
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-06 14:24:50 -07:00
Seshendra Gadagottu
4e9534c243 gpu: nvgpu: add helper function for fecs dmem data
Added helper function gm20b_gr_falcon_update_fecs_dmem_data
programming fecs dmem data. With using this helper function,
avoid repeating same code twice.

JIRA NVGPU-3226

Change-Id: I490cc6b5ed6a1df5bcd0590833c8f9b83661d538
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111750
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-06 14:24:42 -07:00
Seema Khowala
4c4f45e7eb gpu: nvgpu: mc: fix MISRA violations
Rule 8.6
Rule 16.4
Rule 10.3
Rule 10.7

JIRA NVGPU-3382

Change-Id: Ie5a8bfefaabd351428745fa95a90f1aac91b1b55
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111576
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-06 13:15:54 -07:00
Deepak Nibade
510b6cc8b2 gpu: nvgpu: fix MISRA 15.7 violation in gr.config unit
Below MISRA 15.7 violation is reported in common.gr.config unit

nvgpu/drivers/gpu/nvgpu/common/gr/gr_config.c:169:
misra_violation: No non-empty terminating "else" statement.

Fix this by adding terminating "else" statement

Jira NVGPU-3225

Change-Id: Iaec3d6595da8fca55dfad8a8ccbcbad2ba7b1fe1
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2110987
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-06 13:15:30 -07:00
Deepak Nibade
3b0062bbd9 gpu: nvgpu: fix MISRA 5.7 violations in gr.config unit
Below 5.7 violations are reported in common.gr.config unit :

nvgpu/drivers/gpu/nvgpu/common/gr/gr_config.c:628:
identifier_reuse: Identifier "sm_info" is already used to represent a type.

Fix them by renaming struct sm_info to struct nvgpu_sm_info

Jira NVGPU-3225

Change-Id: I26f70a4ed2a5a845e0dc9daeb8fb5474e35d42fb
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2110986
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-06 13:15:21 -07:00
ajesh
fe9f1e9e5c gpu: nvgpu: fix MISRA violations in timers unit
MISRA rule 21.2 forbids the usage of identifier names which start with
an underscore.  Fix the violations of MISRA rule 21.2 in timers unit.

Jira NVGPU-3139

Change-Id: I507d0f2a51e83ce24d642dcc81975aa513fa41eb
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2112599
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>
2019-05-06 12:07:16 -07:00
Vedashree Vidwans
38bc7e3b7e gpu: nvgpu: fix MISRA 2.2 no dead code
MISRA rule 2.2 doesn't allow unused functions and assignments in code.
The reason is presence of unused functions or variable assignments may
indicate error in program's logic. This patch removes an unused function
following rule 2.2.

Jira NVGPU-858

Change-Id: I80b4ae3486038de1a9b1c3afc3b4f17f18cc9efd
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111616
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-06 12:05:15 -07:00
ajesh
67b3cb8a54 gpu: nvgpu: fix MISRA violations in atomic unit
MISRA rule 21.2 forbids the usage of identifier names which start with
an underscore.  Fix the violations of MISRA rule 21.2 in atomic unit.

Jira NVGPU-3139

Change-Id: I4fbed30542bdd2a2444a5619b5bb2bb5c7736472
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111441
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-06 09:45:23 -07:00
rmylavarapu
eaf6aa07f9 gpu: nvgpu: Fix MISRA viaolation in clk_prog unit
Fixed following MISRA violations:
-MISRA C-2012 Rule 11.3
-MISRA C-2012 Rule 16.1

NVGPU-3223

Change-Id: I7587477e03bacc974e0243041347cb76d7ee7348
Signed-off-by: rmylavarapu <rmylavarapu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2108483
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-05-06 04:05:59 -07:00
rmylavarapu
5ed6909d07 gpu: nvgpu: Fix MISRA violations in clk_domain unit
Fixed following MISRA violations:
-MISRA C-2012 Rule 11.3
-MISRA C-2012 Rule 16.1

NVGPU-3222

Change-Id: I9dcb6c5c3fab6be0135919dfbcf273f7ee44949b
Signed-off-by: rmylavarapu <rmylavarapu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2107418
Reviewed-by: Deepak Nibade <dnibade@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>
2019-05-06 04:05:25 -07:00
Debarshi Dutta
17486ec1f6 gpu: nvgpu: rename tsg_gk20a and channel_gk20a structs
rename struct tsg_gk20a to struct nvgpu_tsg and rename struct
channel_gk20a to struct nvgpu_channel

Jira NVGPU-3248

Change-Id: I2a227347d249f9eea59223d82f09eae23dfc1306
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2112424
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>
2019-05-06 02:56:53 -07:00