Commit Graph

9734 Commits

Author SHA1 Message Date
Richard Zhao
7af53dab3d nvgpu: add -Wshadow compile flag to posix build
hvrtos/hypervisor added default cflags -Wshadow which is required by
AUTOSAR M3-4-1. The patch adds the flag to posix build to make sure the
code pass build on hvrtos.

Jira GVSCI-9976

Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Change-Id: If43281689a2aea95e4a768f59014f787f2e9ee23
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2728216
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-06-16 17:58:37 -07:00
prsethi
9890a185e0 gpu: nvpgu: update ZBC table values for ga10b+
- Patch updates the ZBC table values as per the POR values for safety
build.
- Fix the color table default values initialization for standard build
which was being done in floating point format for CROP while it should
be in FB format. As per the documentation "CROP ZBC table should be
programmed exactly the way the L2 table is programmed".

Bug 3585766

Change-Id: I47d11b6a230189ee0c818f850d36b93c0aea0e54
Signed-off-by: prsethi <prsethi@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2724935
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Shashank Singh <shashsingh@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-06-16 15:52:42 -07:00
Sagar Kadamati
fdba1eef10 gpu: nvgpu: add FLCG support for PERFMON
Add FLCG register programming for PERFMON

Jira NVGPU-7228

Change-Id: Ia1b3b2976c65c44f718789bcfbef4cad7e0718b3
Signed-off-by: Sagar Kadamati <skadamati@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2712095
Tested-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-by: Antony Clince Alex <aalex@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-06-15 04:25:56 -07:00
Jinesh Parakh
8ed2431646 gpu: nvgpu: add interface to read error state for all SMs
This patch defines the IOCTL NVGPU_TSG_IOCTL_READ_ALL_SM_ERROR_STATES
to read the error states for all the SMs.
The corresponding input parameter is num_sm (number of SM error states to be read) and output is a list of error states for all the SMs.

Bug 200468220

Signed-off-by: Jinesh Parakh <jparakh@nvidia.com>
Change-Id: Iaf926b72d900a6c8f978fa034c20d76e482eb13f
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2717313
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Sami Kiminki <skiminki@nvidia.com>
Reviewed-by: Sandarbh Jain <sanjain@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-06-14 07:59:20 -07:00
Laxman Dewangan
646a48ea5a nvgpu: Get rid of NV_BUILD_KERNEL_OPTIONS for identify stable kernel
There are some configs which are set for the stable kernel and
it is identified from the NV_BUILD_KERNEL_OPTIONS.

The stable kernel build nvgpu as out-of-tree module and
pass the environment config CONFIG_TEGRA_OOT_MODULE during
build.

Hence, it is not required to use the NV_BUILD_KERNEL_OPTIONS to
identify the kstable build. It uses CONFIG_TEGRA_OOT_MODULE for
setting the configs for build as module.

Bug 3652905

Change-Id: I6570760e91ca98a4c83d7691fad517b2c772e629
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2720729
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-06-13 18:45:23 -07:00
Sagar Kamble
e80d74b810 gpu: nvgpu: validate return of nvgpu_tsg_get_sm_error_state
nvgpu_tsg_get_sm_error_state already checks the sm_id and
tsg->sm_error_state. No need to check these before calling
nvgpu_tsg_get_sm_error_state.

CID 484927
CID 299106
Bug 3512546

Change-Id: I02a05d8686cf7027cfc271f470198e7985dc4e16
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2722470
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-06-13 10:58:31 -07:00
Manish Bhardwaj
d177cae3fe nvgpu: remove support of nvgpu driver
Using this patch we are removing support of nvgpu
driver for chain-c kernel. Since this driver is not
needed in chain-c kernel.

Bug 3655762

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: I7c3328438d5d17686476c924b8b0dfacd34f9ce0
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2717262
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Amlan Kundu <akundu@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-06-07 12:24:44 -07:00
Jinesh Parakh
4e25206c7a gpu: nvgpu: Fix snprintf CERT-C issue
Fix the following CERT-C Violation:
grmgr_ga100.c : CERT ERR33-C

CID 222881

Bug 3512546

Signed-off-by: Jinesh Parakh <jparakh@nvidia.com>
Change-Id: I50cc7dd14c2f5d07feb559e6776dfabca0e24ddc
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2725128
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-06-06 14:15:14 -07:00
Jinesh Parakh
dd1a2fde91 gpu: nvgpu: Fix CERT-C Violations
Fix the following CERT-C Violations:
sync_sema_dma.c : CERT ERR33-C
sync_sema_dma.c : CERT EXP34-C

CID 350599
CID 368398
CID 392851
CID 464018
CID 465039
CID 467205
CID 468342

Bug 3512546

Signed-off-by: Jinesh Parakh <jparakh@nvidia.com>
Change-Id: Ibc6276d57550a3d2dd477decf82a7ac4b2ac3535
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2724762
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-06-06 14:15:09 -07:00
Jinesh Parakh
79301054ac gpu: nvgpu: Fix snprintf and sscanf issues
Fix the following CERT-C Violations:
sysfs.c : CERT ERR33-C

CID 354798
CID 360001
CID 386362
CID 425216
CID 432873
CID 477983

Bug 3512546

Signed-off-by: Jinesh Parakh <jparakh@nvidia.com>
Change-Id: I4a8e45ecc7444e26ba71c237f2b30bdfcd4ce0dc
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2724221
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-06-06 14:14:40 -07:00
Sagar Kamble
88a3a3d8d8 gpu: nvgpu: assert the log type
In __nvgpu_really_print_log: Guarantee that log type is valid before
referring to the string from log_types.

CID 393604

Change-Id: I22d5e68647ee36712157d988061191636cba4e4b
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2722480
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-06-06 05:55:26 -07:00
Dinesh T
e30ddf2771 gpu: nvgpu: use __alloc_fd to allocate vidmem fds ignoring process fd limit
vidmem buffers are using fd as buffer handles and we need to allocate more
than 1024 fds. tegra_alloc_fd was exported by TEGRA_MC driver that allowed
allocating more than 1024 fds, however that function is to be removed from
that driver.

Hence use now kernel exported function __alloc_fd directly from nvgpu.

This is currently to be used only for dgpu on downstream kernel 5.10.

Bug 3535321

Change-Id: I10cfc41a6439f07309cda9eb2f22746f3fbac996
Signed-off-by: Dinesh T <dt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2702794
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Tested-by: Sagar Kamble <skamble@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-06-04 14:07:18 -07:00
Martin Radev
a5d29a9c45 gpu: nvgpu: List MIG configs in a parsable way
This patch creates a sysfs node which is easier to parse than
the existing mig_mode_config_list node. This new node outputs
in the following format:
active: -1
num_configs: 2
num_instances: 2
id:000000000001 gr:000000000000 gpc:0003
id:000000000002 gr:000000000004 gpc:0003
num_instances: 3
id:000000000001 gr:000000000000 gpc:0003
id:000000000005 gr:000000000004 gpc:0002
id:000000000013 gr:000000000006 gpc:0001

Bug 200740852

Change-Id: I8a3d4425ccb88dd4e58bbe1908e0f7cc577ff191
Signed-off-by: Martin Radev <mradev@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2704349
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-06-04 14:05:57 -07:00
Debarshi Dutta
1bf9309f17 gpu: nvgpu: update dma_mask based on H/W compatibility
To be able to access the full physical memory range, gpu's dma_mask
needs to be set to the max value of H/W compatible range.

For example. In order to support from 2GB to 66 GB, GV11B's dma_mask
needs to be atleast 37 bits. Set GV11B's dma_mask to 38 bit
and T23X's dma_mask to 39 bit. These values are supported by H/W

Bug 3656729

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: Icfff3c36a8c9cf074a254fa773c42e18020ae5de
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2723640
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Brad Griffis <bgriffis@nvidia.com>
2022-06-04 08:29:56 -07:00
Jinesh Parakh
b8b90f85ee gpu: nvgpu: Fix CERT-C Violations
Fix the following CERT-C Violations:
gsp_runlist.c : CERT EXP34-C
channel_sync_syncpt.c : CERT ERR33-C
grmgr_ga100.c : CERT ERR33-C
grmgr_ga10b.c : CERT ERR33-C
debug.c : CERT ERR33-C
debug_fecs_trace.c : CERT EXP34-C
ioctl.c : CERT ERR33-C

CID 495110
CID 141061
CID 222881
CID 222890
CID 450994
CID 366644
CID 466529

Bug 3512546

Signed-off-by: Jinesh Parakh <jparakh@nvidia.com>
Change-Id: I318a27a6fcb8ea8f6d5d6c1f65d940c48d6f8dfc
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2723008
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-06-03 12:05:26 -07:00
Divya
dcec7f184e gpu: nvgpu: disable elpg earlier in recovery path
When MMU fault happens, if the id_type = 1, that means
fault happened in TSG. So in that path we set the error
notifier and let userspace know about faulty channel.
During this, we check if debugger is attached or not by
reading gr_gpc0_tpc0_sm0_dbgr_control0_r() register.
During this time ELPG is enabled and this read causes
IDLE SNAP error for ELPG.

To resolve this, move CG/PG disable function call
early in fifo recover code path. This ensures that
ELPG is disabled early before any read happens for any
GR register.

Bug 3660592

Change-Id: Ie5d01b7ccf00167b58f260e9142aa5deb2a08be4
Signed-off-by: Divya <dsinghatwari@nvidia.com>
(cherry picked from commit f09e429f2d142c20529bedc05acf193805e1bb25)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2720655
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-06-01 06:41:57 -07:00
Jinesh Parakh
cb78bca971 gpu: nvgpu: Fix Out-of-bounds access defect
Fix following Coverity Defect:
priv_ring_ga10b_fusa.c : Out-of-bounds access

CID 10062315

Bug 3460991

Signed-off-by: Jinesh Parakh <jparakh@nvidia.com>
Change-Id: I76e4122132ad13cc53d24816c59586695d6f80a4
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2708565
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-05-31 11:07:30 -07:00
Rajesh Devaraj
019bee2174 gpu: nvgpu: add additional registers to allowlist
To add GL/VK support for shader debugging via the SM trap handler
functionality, a write operation to the following PRI registers need to
be allowed in all chips (ga10b, gv11b, gm20b, gp10b):

- NV_PGRAPH_PRI_GPCS_MMU_DEBUG_CTRL
- NV_PGRAPH_PRI_GPCS_TPCS_SM_SCH_MACRO_SCHED
- NV_PGRAPH_PRI_GPCS_TPCS_SMS_DBGR_CONTROL0
- NV_PGRAPH_PRI_GPCS_TPCS_SMS_HWW_WARP_ESR_REPORT_MASK
- NV_PGRAPH_PRI_GPCS_TPCS_SMS_HWW_GLOBAL_ESR_REPORT_MASK

In this patch, we are adding the above registers into allowlist, if they
were absent. Note that these registers included only in non-safety using
CONFIG_NVGPU_SET_FALCON_ACCESS_MAP flag.

Bug 3642131

Change-Id: I5f62731944b6b3e059afa80a491c3cf5c3656f60
Signed-off-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2715799
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Christopher Lentini <clentini@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Christopher Lentini <clentini@nvidia.com>
2022-05-31 05:55:17 -07:00
Jinesh Parakh
658f83ca48 gpu: nvgpu: Fix Explicit null dereference
Fix the following Coverity Defect:
pwrpolicy.c : Explicit null dereference

CID 10059138

Bug 3460991

Signed-off-by: Jinesh Parakh <jparakh@nvidia.com>
Change-Id: Ie572e0608d0b07d5023e7cca878d16087cfc284f
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2717978
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Ramesh Mylavarapu <rmylavarapu@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-30 12:49:04 -07:00
prsethi
697215afd3 gpu: nvpgu: configure static ZBC table
Patch defines a ZBC static table and configure it at sw layer. Later
existing API read this sw configuration and program it to hw.

This is applicable only for ga10b safety build and for other chips/
configuration it will be supported in the legacy way.

Bug 3585766

Change-Id: I00d79162c0b096616e3f555da965e82e47c014d1
Signed-off-by: prsethi <prsethi@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2713821
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-05-29 10:56:58 -07:00
atanand
5c3d78dfb0 gpu: nvgpu: add IP audited FBPROUTER/GPCROUTER base and extents and NV_PLTCG_LTCS base
Added IP audited FBPRouter and GPCRouter Pri Register Ranges
and LTC Broadcast base addr

IP audit bug number: 3616021
Bug: 3442801

Change-Id: I52adc3bbb6b573377a9012db4b50bef51ef31e8a
Signed-off-by: atanand <atanand@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2714144
Reviewed-by: Antony Clince Alex <aalex@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-28 09:00:03 -07:00
atanand
2ebc0bdf98 gpu: nvgpu: add broadcast to unicast expansion
Add broadcast to unicast expansion for NV_PLTCG_LTCS_MISC_LTC_PM and
PMM*_[GPC|FBP]SROUTER broadcast registers for non-resident regops.

Bug: 3442801

Change-Id: I88dcf00f4f6e910f0342d3968970070e0248a786
Signed-off-by: atanand <atanand@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2704951
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-05-28 08:59:44 -07:00
Krishna Reddy
961925be02 Revert "gpu: nvgpu: correct usage for gk20a_busy_noresume"
This reverts commit c1ea9e3955.

Reason for revert: ap_vulkan, ap_opengles, ap_mods tests failures
Bug 3661058
Bug 3661080 
Bug 3659004 

Change-Id: I929b5675a4fb0ddc8cbf3eeefc982b4ba04ddc59
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2718996
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
2022-05-27 14:49:26 -07:00
Antony Clince Alex
a80c445a5d gpu: nvgpu: ga10b: update runlist.write_state
Update HAL function runlist.write_state to skip in-active
runlists in fifo.runlists. It is possible for one or more
engines to be floorswept in which case their associated
runlist will be in-active, example, if host supports
3 runlists(0, 1, 2) each serving 3 engines(0, 1, 2), and
engine-1 is floorswept, then runlist-1 becomes in-active and
the entry fifo->runlists[1] will be set to NULL.

Bug  3650588

Change-Id: Iaf9d75e310903c47b842e84dcfa2209d9fe7da96
Signed-off-by: Antony Clince Alex <aalex@nvidia.com>
(cherry picked from commit e29a2019cf8f4796737c670f98164f7783448d49)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2717075
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-27 14:46:18 -07:00
Laxman Dewangan
152b4a0379 gpu: nvgpu: Add OOT kernel build support
Add OOT kernel support same as kstable for building nvgpu
as module.

Bug 3642168

Change-Id: I7353275a6c5e487773b716e23610b22e2dc5780d
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2710918
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-27 14:41:14 -07:00
Jinesh Parakh
7d50efb6bc gpu: nvgpu: Uninitialized pointer read
Fix the following Coverity Defect:
vm_remap.c : Uninitialized pointer read

CID 10127932

Bug 3460991

Signed-off-by: Jinesh Parakh <jparakh@nvidia.com>
Change-Id: I2de290882aec6a859c5280998e11fb75f3395302
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2708539
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-27 14:40:45 -07:00
Jinesh Parakh
bb73cf9597 gpu: nvgpu: Fixed out-of-bounds Coverity Defects
Fix following Coverity Defects:
clk_mon_tu104.c : Out-of-bounds read and Out-of-bounds access

CID 10061400
CID 10061401

Bug 3460991

Changed the datatype of domain_mask from u32 to unsigned long
to solve the out-of-bounds defect.

Signed-off-by: Jinesh Parakh <jparakh@nvidia.com>
Change-Id: I1c43bd90053264ee4104ca8c3a33d9ea07f04045
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2708765
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-05-25 11:44:59 -07:00
Debarshi Dutta
c1ea9e3955 gpu: nvgpu: correct usage for gk20a_busy_noresume
Background: In case of a deferred suspend implemented by gk20a_idle,
the device waits for a delay before suspending and invoking
power gating callbacks. This helps minimize resume latency for any
resume calls(gk20a_busy) that occur before the delay.

Now, some APIs spread across the driver requires that if the device
is powered on, then they can proceed with register writes, but if its
powered off, then it must return. Examples of such APIs include
l2_flush, fb_flush and even nvs_thread. We have relied on
some hacks to ensure the device is kept powered on to prevent any such
delayed suspension to proceed. However, this still raced for some calls
like ioctl l2_flush, so gk20a_busy() was added (Refer to commit Id
dd341e7ecbaf65843cb8059f9d57a8be58952f63)

Upstream linux kernel has introduced the API pm_runtime_get_if_active
specifically to handle the corner case for locking the state during the
event of a deferred suspend.

According to the Linux kernel docs, invoking the API with
ign_usage_count parameter set to true, prevents an incoming suspend
if it has not already suspended.

With this, there is no longer a need to check whether
nvgpu_is_powered_off(). Changed the behavior of gk20a_busy_noresume()
to return bool. It returns true, iff it managed to prevent
an imminent suspend, else returns false. For cases where
PM runtime is disabled, the code follows the existing implementation.

Added missing gk20a_busy_noresume() calls to tlb_invalidate.

Also, moved gk20a_pm_deinit to after nvgpu_quiesce() in
the module removal path. This is done to prevent regs access
after registers are locked out at the end of nvgpu_quiesce. This
can happen as some free function calls post quiesce  might still
have l2_flush, fb_flush deep inside their stack, hence invoke
gk20a_pm_deinit to disable pm_runtime immediately after quiesce.

Kept the legacy implementation same for VGPU and
older kernels

Jira NVGPU-8487

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: I972f9afe577b670c44fc09e3177a5ce8a44ca338
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2715654
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-25 04:59:46 -07:00
Sagar Kamble
a0b0acad05 gpu: nvgpu: pass pmu rpc struct as char pointer
nvgpu_pmu_rpc_execute takes pmu rpc header address and dereferences
it at address past header based on rpc struct that the header is
part of.

This usage of pointer is not right and confuses CERT checker.
Instead, pass the rpc struct address as char pointer and use
as header or rpc struct as per need.

CID 17141
CID 154223
CID 17557
CID 154226
CID 153904
CID 153926
CID 153929
CID 153925
CID 153925
CID 225346
CID 225355
CID 225356
CID 225360
CID 225361
CID 225365
CID 225367
CID 296735
CID 330244
CID 17557
Bug 3512546

Change-Id: I93b154d4321e75c0d2b41f43d7c2b701682962a3
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2710224
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-24 04:43:35 -07:00
Tejal Kudav
69bb38f606 gpu: nvgpu: Make missing DT prop print conditional
Below print is misleading and seems like an error.
 [INFO]  Missing support-gpu-tools property, ret =-22

'support-gpu-tools' property was added to allow disabling debugger
features on prod boards. The debugger/profiler support will be
enabled by default, even if the property is missing.

Make the INFO print conditional, more informational and less
dramatic.

Bug 3539518

Change-Id: I5fc50df30be23e1fd1ecc06282a0d50f3ca7ac64
Signed-off-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2668464
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-05-24 04:41:42 -07:00
mkumbar
5339bd3466 gpu: nvgpu: Add extra delay for ACR commands in non-silicon platforms
Increase delay for non-silicon platforms between ACR commands and before
polling to skip incorrect reading of IRQSTAT register and generate false
PMU external interrupt.

Bug 3596273

Change-Id: I0163cddbaa1919ac949467f65c74e06f85817aec
Signed-off-by: mkumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2699396
Reviewed-by: Divya Singhatwaria <dsinghatwari@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Tested-by: Divya Singhatwaria <dsinghatwari@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-20 10:36:04 -07:00
Richard Zhao
10f6b98f70 gpu:nvgpu: move gops_clk to non fusa
gops_clk is needed by CONFIG_NVGPU_NON_FUSA but not specific to
CONFIG_NVGPU_CLK_ARB or CONFIG_NVGPU_DGPU.

Jira GVSCI-9976

Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Change-Id: I6d8c6625badd6ef2f3a38b9ecc70e23da2fbc26b
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2714079
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Aparna Das <aparnad@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-20 00:11:02 -07:00
Dinesh T
6e4c3275bf gpu: nvgpu: Set max_ways_evict_cache to maximum
This is setting evict_max_ways for L2 cache to the maximum
supported value for safety.

In normal build L2 cache MAX_EVICT_LAST is configure via
KMD and RegOps. RegOps is enabled only on standard build
with CONFIG_DEBUGGER flag. This method we cant use it for
safety build. Safety we can make use of the patch buffer
to patch the register while creating the context.

JIRA NVGPU-8227

Change-Id: Iec5d73197239b9cad31c6b593ca2b87c224aad5e
Signed-off-by: Dinesh T <dt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2708702
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-05-18 22:57:54 -07:00
Richard Zhao
802aadf263 nvgpu: move nvgpu_falcon_copy_from/to_emem out of CONFIG_NVGPU_DGPU
nvgpu_falcon_copy_from/to_emem are also used by iGPU in
engine_emem_queue.

Jira GVSCI-9976

Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Change-Id: Ia36a38521807714eb5ad52b6e81c9f31ecc8fda6
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2708509
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-18 00:59:10 -07:00
Richard Zhao
7a39d8e9ce gpu: nvgpu: hal: remove .fb.mem_unlock for ga10b
.fb.mem_unlock is specific to dGPU.

Jira GVSCI-9976

Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Change-Id: Id1a52becaa5c2b0a00899c3bc92aa18058a1f97d
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2708394
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-05-18 00:59:05 -07:00
Richard Zhao
db4a1713cb gpu: nvgpu: gr: move .load_sw_bundle64() out of CONFIG_NVGPU_DGPU
.load_sw_bundle64 is also used by ga10b.

Jira GVSCI-9976

Change-Id: Ife46dd5bf40a9e143cf119a64dd0d2adcb1ae81c
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2708393
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-18 00:58:54 -07:00
Richard Zhao
d603838110 gpu: nvgpu: pmu: move lsfm_sw_gv100.h out of CONFIG_NVGPU_DGPU
ga10b needs to call nvgpu_gv100_lsfm_sw_init() too, so the header cannot
be protected by CONFIG_NVGPU_DGPU.

Jira GVSCI-9976

Change-Id: I3f6016c3d5f924492629134e528a24cc20544365
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2708392
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-18 00:58:48 -07:00
Sagar Kamble
b7d436fd0e gpu: nvgpu: consider null character for strncat
While forming string available length to strncat should consider null
character in last byte otherwise strncat can index the array out of
bounds.

CID 481139
CID 455841
Bug 3512546

Change-Id: I011be1deea40e276e681965deefb60fe8ab79479
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2710380
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-17 08:44:27 -07:00
Sagar Kamble
da884615d3 gpu: nvgpu: fix pmu_board_obj init in construct_pwr_policy
Fix below CERT violation:
In construct_pwr_policy: Do not dereference null pointers.

This was introduced in the below commit:

    commit 700bd83b41 ("gpu: nvgpu: Rename/clean boardobj unit")

CID 203372
Bug 3512546

Change-Id: I30a2ce13f9df343a1dc74fdd7427ccf65b228a3e
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2710234
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-17 08:44:18 -07:00
Sagar Kamble
e96740c59a gpu: nvgpu: change ecc error counters increment to wrapping type
Usage of nvgpu_safe_add_u32 to increment nvgpu maintained corrected
ecc error counters can lead to BUG due to overflow as corrected ecc
errors can keep coming in and system will continue to operate.

In some configurations, uncorrected error counters can also
overflow and lead to BUG.

Increment these counters and their delta calculations to use
nvgpu_wrapping_add_u32.

JIRA NVGPU-7054

Change-Id: I85ddddfa46062744cccbe0756ad942787e72f01b
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2601152
(cherry picked from commit f016e59189d2bd66e23f17ccb638f6d384b82fbd)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2623638
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-05-17 08:41:07 -07:00
Sagar Kamble
d3b417ce2c gpu: nvgpu: address priv_ring unit code inspection gaps
1. Hardcoded constants are defined using #define are converted to
   const.
2. set_ppriv_timeout_settings HAL is not applicable from gm20b.
   Hence remove it completely.

JIRA NVGPU-6903

Change-Id: Ic096c5dc87aa45db0aa05482947cd032ae72bdd4
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2552581
(cherry picked from commit c5fb38a54208330f24754fed33d7242903dbac59)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2623635
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-05-17 08:40:46 -07:00
Debarshi Dutta
48cd58d332 gpu: nvgpu: add timeout error handling
Report a timeout error when fb_mmu_ctrl_r() register doesn't
correctly reflect the tlb invalidate status.

Jira NVGPU-7192

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2603267
(cherry picked from commit b16ed38d087667bc2bddaddde820648d6a931064)
Change-Id: I2360c8741b396b26079438a917770e0bb051c661
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2700042
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-13 01:00:40 -07:00
Debarshi Dutta
76cc8870e1 nvgpu: gpu: update default nvs domain implementation
In current form, the default domain acts like any schedulable
domain. TSGs are bound to it and it can be enumerated via the
public interfaces.

The new expectation for the default domain is meant to change
from the current form to a pseudo domain that cannot act like
an ordinary domain in other ways, i.e. it must not be reachable
by in particular the domain management API, it can't be removed,
does not show up in lists, and TSGs cannot be explicitly bound to
this domain. It won't participate in round-robin domain scheduling.
It is not really a domain, and acts like one only when activated in
the manual mode.

Following changes are made overall to support the above change in
definition.

1) Domain creation and attaching the domain to the scheduler are now
split into two separate functions. The new default domain (having ID
= UINT64_MAX) is created separately from a static function without
linking it with other domains in the scheduler.

2) struct nvgpu_nvs_scheduler explicitely stores the default domain
to support direct lookups.

3) TSGs are initially not bound to default domain/rl_domain.

Jira NVGPU-8165

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: I916d11f4eea5124d8d64176dc77f3806c6139695
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2697477
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-05-12 00:24:58 -07:00
Debarshi Dutta
26525cb1cf gpu: nvgpu: runlist changes for default domain implementation
In order to support the concept of the default domain, a new
rl domain is created that shadows all the other domains i.e.
all channels of all TSGs are replicated here. This is scheduled
by default during GPU boot.

1) The shadow rl_domain is constructed during poweron sequence via
nvgpu_runlist_alloc_shadow_rl_domain(). struct nvgpu_runlist
is appended to store this separately as 'shadow_rl_domain'.
This is scheduled in background as long as no other user created
rl domains exist.

2) 'shadow_rl_domain' is scheduled out once user created rl domain
exist. At this point, any updates in the user created rl domains
are synchronized with the 'shadow_rl_domain'. i.e. 'shadow_rl_domain'
is also reconstructed to contain active channels and tsgs from the rl
domain.

3) 'shadow_rl_domain' is scheduled back in when the last user created
rl domain is removed.

4) In future for manual mode, driver shall support explicitely
   switching to 'shadow_rl_domain'. Also, we will move to an
   implementation where 'shadow_rl_domain' is switched out only when
   other domains are actively scheduled.  These changes will be
   implemented later.

Jira NVGPU-8165

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: Ia6a07d6bfe90e7f6c9e04a867f58c01b9243c3b0
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2704702
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-12 00:24:46 -07:00
Sagar Kamble
c7d495ffd6 gpu: nvgpu: fix misra rule 3.1 violation
With http path for ECC hw ref manual specified with two forward slashes
within comment block rule 3.1 is violated.

We can specify the http path with single forward slash. Fix it.

Change-Id: I310869995e1d064b4216a3ed99ea57f78cf78d8d
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2614150
Reviewed-by: V M S Seeta Rama Raju Mudundi <srajum@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
(cherry picked from commit 0e1cb893d2637badece8d39f93f4025e92d8bd8e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2706558
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-11 04:18:17 -07:00
Sagar Kamble
d82400d2b8 gpu: nvgpu: fix MISRA Rule 5.1 violation
BVEC changes for nvgpu_rc_pbdma_fault and nvgpu_rc_mmu_fault
started reporting below MISRA issue.

kernel/nvgpu/drivers/gpu/nvgpu/common/fifo/tsg.c:321:
  1. misra_c_2012_rule_5_1_violation: Declaration with identifier
     "nvgpu_tsg_unbind_channel_check_hw_state", which is ambiguous.
kernel/nvgpu/drivers/gpu/nvgpu/common/fifo/tsg.c:349:
  2. other_declaration: The first 31 characters of identifiers
     "nvgpu_tsg_unbind_channel_check_ctx_reload" and
     "nvgpu_tsg_unbind_channel_check_hw_state" are identical.

Do below renames to fix the issue. Doing both for consistency.

s/nvgpu_tsg_unbind_channel_check_hw_state/nvgpu_tsg_unbind_channel_hw_state_check
s/nvgpu_tsg_unbind_channel_check_ctx_reload/nvgpu_tsg_unbind_channel_ctx_reload_check

JIRA NVGPU-6772

Change-Id: Ib92cabe11c486621351bf15ddb86e20d16d514c4
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2584152
(cherry picked from commit a619f259c6a4ffccb05550767212989af60c2a90)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2706551
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-11 04:18:12 -07:00
mkumbar
162d7ec32d gpu: nvgpu: falcon debug unit update
- Don't print error if debug display buffer is empty.

Bug 3623500
Bug 3418561

Change-Id: I066999fb0f7d41d491c3b01df2b976fcfa833ebf
Signed-off-by: mkumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2704967
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-11 04:16:18 -07:00
Shashank Singh
ba22f6263b gpu: nvgpu: move gv11b code under config flag
Move gv11b specific code under CONFIG_NVGPU_GV11B_SUPPORT so that gv11b
support can be removed for qnx later as it is no longer POR for qnx on
dev-main.

Jira NVGPU-8189

Change-Id: Idc17cfa22199f2b69a1bab0849cd2bd2e0fb6288
Signed-off-by: Shashank Singh <shashsingh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2693828
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-05-11 04:13:23 -07:00
Sagar Kamble
45c6aed68d gpu: nvgpu: fix CERT violations in nvgpu_dbg_gpu_access_gpu_va
Update nvgpu_dbg_gpu_access_gpu_va to:
1. Ensure that integer conversions do not result in lost or
   misinterpreted data.
2. Do not dereference null pointers.

CID 436748
CID 473585
CID 254272
CID 490303
Bug 3512546

Change-Id: I551484b671aa48175a8cea119885eac478c2731c
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2707019
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-07 23:24:44 -07:00
Sagar Kamble
9d6269ce7f gpu: nvgpu: assert gr dev is non-NULL
nvgpu_device_get can return NULL if supplied invalid ID or instance
ID. We expect GR device struct to be non-NULL there hence just
assert that it is indeed non-NULL in gr_reset_engine and
ga10b_grmgr_init_gr_manager.

CID 224133
CID 250232
Bug 3512546

Change-Id: Id09a1c436a8e49b921111b940d3d013bd66bff7a
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2707018
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-05-07 23:24:39 -07:00