Commit Graph

9734 Commits

Author SHA1 Message Date
Sagar Kamble
b8d8d621b9 gpu: nvgpu: allow re-registering TSG events
With TSG shared across devices/processes, it is necessary to allow all
clients to registers for the events.

Bug 3677982

Change-Id: I3cde10665e481fcc58759066e4b70de1ff792e79
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2784666
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: Richard Zhao <rizhao@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-05 20:07:19 -07:00
Austin Tajiri
3761c468ad gpu: nvgpu: add channel.get_vmid gops
Add a channel.get_vmid gops so that we can pass the proper VMID to
gr.fecs_trace.bind_channel in virtualized environments.

Jira GVSCI-14708

Change-Id: Ifc4e6aafa33fa7274bdeb000e8c0fd1a7fc849c7
Signed-off-by: Austin Tajiri <atajiri@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2780108
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@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 <buildbot_gerritrpt@nvidia.com>
2022-10-05 20:03:53 -07:00
vivekku
5bb56723be gpu: nvgpu: gsp: Create functions to pass nvs data to gsp firmware
Changes:
- created functions to populate gsp interface data from nvs and runlist
structures.
- Handled both user domains and shadow domains.
- Provided support for four engines from two.

NVGPU-8531

Signed-off-by: vivekku <vivekku@nvidia.com>
Change-Id: I1d9ec9ded8a9b47a5b2a00c44dacbab22e3b04b1
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2743596
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: Mahantesh Kumbar <mkumbar@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-05 06:18:18 -07:00
vivekku
12b539aa69 gpu: nvgpu: gsp: create nvgpu gsp control fifo interface
Changes:
- control fifo file and its build support is done
- Interface to containing control fifo info to be passed to gsp created
- command and function to send fifo info to GSP

NVGPU-8686
NVGPU-8688
NVGPU-8692

Change-Id: I96c59b621ca299f0f4b71e16bd15cad03e719192
Signed-off-by: vivekku <vivekku@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2756560
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Ramesh Mylavarapu <rmylavarapu@nvidia.com>
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
2022-09-29 19:37:51 -07:00
ht
125cc72c39 gpu: nvgpu: Fix devg_nvgpu_igpu process crash-2.
As part of the negative test case we replace the ACR binaries with
corrupted one(by editing the binary in hex editor). The expectaion
is that the process should log the error and exit properly but instead
the process crashed.
The root cause was because NVGPU driver was trying to pause the thread
using nvgpu_nvs_worker_pause but the but NVS isn't initialized at that
point. NVS is initialized after acr init.

Mitigated this failure by adding a checking condition in
nvgpu_nvs_worker_pause.

Bug 3670576

Change-Id: Ibfe66b253be034e7ca2c3ed298dc28d27e1d6de9
Signed-off-by: ht <ht@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2782937
Reviewed-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Prateek Sethi <prsethi@nvidia.com>
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 <buildbot_gerritrpt@nvidia.com>
2022-09-29 15:06:46 -07:00
Sagar Kamble
b48892ea33 gpu: nvgpu: update l2 sector promotion logic
L2 sector promotion setup in cfg2_vidmem and cfg3_sysmem registers was
verified by comparing full register values after writing. However that
fails as some of the bits like VIDMEM_SP2_256B_PROMOTE_ON_SECT0 in cfg2
and SYSMEM_PROMOTE_ENABLE, FETCH_PARTIAL_CATOM_32B in cfg3 are set
on setting promotion.

Just compare the promotions bits for L1 and T1 in the cfg registers.

Bug 3634348

Change-Id: I53c0a0a7bbe776a000a386524759d7277a015054
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2779619
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: Dinesh T <dt@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-09-28 22:48:31 -07:00
vivekku
4315132e7d gpu: nvgpu: nvs: fixed nvgpu buffer alloc null ptr
Changes
- initialized g inside sched which was throwing null pointer issue.

JIRA NVGPU-8692

Change-Id: I3a278ecb87ce2c4933297e04ab68a7183f40c67b
Signed-off-by: vivekku <vivekku@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2767830
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-28 22:44:58 -07:00
Debarshi Dutta
fb8bfb90c3 gpu: nvgpu: allow custom header include
stdint.h is not included as part of the kernel build file
for linux resulting in build failures when using this header
as it is.

Modified this interface to remove the restriction for using
<stdint.h>. Custom build environments can include their own correct
header for type definitions

Jira NVGPU-8619

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: Ida7c327a5ac4a5c7a0ed18f792a58a17dcbc36b2
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2767310
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-09-28 12:41:07 -07:00
Divya
44587840e2 gpu: nvgpu: Update the error code for tpc_pg_mask
- nvpmodel service used to expect a return value of -ENODEV from the
  underlying tpc_pg_mask_store() when the golden image size was
  initialized.
- With the current implementation, the return value is -EINVAL due to
  which write for new tpc_pg_mask was not successful.
- Update the return value to -EBUSY for the case where golden image
  is already initialized.

Bug 3765637

Change-Id: I5a1a38cce035ea245db5d72c9f5db210d3bb95f1
Signed-off-by: Divya <dsinghatwari@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2778855
(cherry picked from commit 1274f25dda)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2780005
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: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: Yi-Wei Wang <yiweiw@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Yi-Wei Wang <yiweiw@nvidia.com>
2022-09-28 12:40:37 -07:00
Debarshi Dutta
667867a199 gpu: nvgpu: Resolve failed cond init.
Following changes are added to fix the issue.

1) Threads having higher priority e.g. RT may preempt
threads with sched-normal priority. As a consequence, higher priority
threads might not still see initialization of data in another thread
resulting in failures such as accessing a condition value before initialization.

Any initialization in the parent thread must be accompanied by a barrier
to make it visible in other thread. Added appropriate barriers to prevent
reordering of the initialization in the thread construction path.

2) There is a race condition between nvgpu_cond_signal() and
nvgpu_cond_destroy() in the asynchronous submit code and corresponding
worker thread's process_item callback for NVS. This may lead to
data corruption and resulting in the above errors as well. Fixed
that by adding a refcount based mechanism for ownership sharing
of the struct nvgpu_nvs_worker_item between the two threads.

Bug 3778235

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: Ie9b9ba57bc1dcbb8780801be79863adc39690f72
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2771535
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Prateek Sethi <prsethi@nvidia.com>
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-09-27 23:25:55 -07:00
Divya
038005986e gpu: nvgpu: ga10b: enable AELPG
Enable AELPG supoort for ga10b

JIRA NVGPU-7182

Change-Id: Ifcd9930cd4382b55fbcaecefa62c916649dc21a7
Signed-off-by: Divya <dsinghatwari@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2732015
(cherry picked from commit 64efb1067e1fd258397bf4ae0eeb164a0282b322)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2734634
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>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-09-26 15:59:13 -07:00
Mahantesh Kumbar
8c36750fd8 gpu: nvgpu: cleanup the seq for railgate seq
- Perfmon cmds are non-blocking calls and response
  may/may-not come during railgate sequence for the
  perfmon command sent as part of nvgpu_pmu_destroy call.
- if response is missed then payload allocated will not be
  freed and allocation info will be present as part seq data
  structure.
- This will be carried forward for multiple railgate/
  rail-ungate sequence and that will cause the memleak
  when new allocation request is made for same seq-id.
- Cleanup the sequence data struct as part of nvgpu_pmu_destroy
  call by freeing the memory if cb_params is not NULL.

Bug 3747586
Bug 3722721

Change-Id: I1a0f192197769acec12993ae575277e38c9ca9ca
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2763054
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Divya Singhatwaria <dsinghatwari@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Divya Singhatwaria <dsinghatwari@nvidia.com>
2022-09-21 01:08:54 -07:00
Dinesh T
dabf933944 gpu: nvgpu: Decrease the channel to 128
As the number of supported syncpoints is 128 in SAFETY config,
this is decreasing the number of channels supported in
SAFETY to 128.

Bug 3644504

Change-Id: If62f0c5489e4ad83abbc0e5b9ed9d698ea97967f
Signed-off-by: Dinesh T <dt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2773429
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-14 23:32:55 -07:00
prsethi
9fc3010344 gpu:nvgpu: Remove BUSY_IDLE_SUPPORT config flag
gk20a_busy ref count is needed to track if there no one has taken ref
and processing something to avoid any ongoing activity during suspend.
Patch enables the ref count support by removing the config flag.

Jira NVGPU-8506

Change-Id: Ic9389ad42be34e2357858ea79adf05f30e85efbf
Signed-off-by: prsethi <prsethi@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2769479
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Deepak Goyal <dgoyal@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-09-14 23:28:12 -07:00
Debarshi Dutta
50f95f789c gpu: nvgpu: improvements to NVS code
Fix the bug in NVS worker initialization code. Ensure main thread
waits for NVS worker to start.

Jira NVGPU-8619

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: I2a719bad691099881f3ac4468d32f9e81ece3800
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2773376
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
2022-09-14 09:40:16 -07:00
mkumbar
71065d8613 gpu: nvgpu: FW load flag update
-Move FW load flag settings before chips specific SW init in
 ACR unit init. This helps to alter the flag later based on
 the chip requirment if required.

Bug 3765772

Change-Id: I4639d85c0d4ffce06a172acef42891011125b322
Signed-off-by: mkumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2773059
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: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-by: Mayur Poojary <mpoojary@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-09-14 09:39:00 -07:00
atanand
f43897c940 gpu: nvgpu: GA10X_NEXT pulling GR1 out of reset
This patch is to enable GR1 before resetting GR0
which is not visible to the driver.

Bug 3690950

Change-Id: I8a1907349f5a4354c6b7f95f9904b52738f51f00
Signed-off-by: atanand <atanand@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2758161
(cherry picked from commit 48d925cacf373a97dbdb031a109b83be3bfe2972)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2765635
Reviewed-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-09-08 21:05:01 -07:00
Sagar Kamble
cfc663a65d gpu: nvgpu: add unit test to check class, veid and pbdma for channels
Add unit test to validate the class, veid and pbdma assignment of the
channels.

Bug 3677982

Change-Id: I35fda0a35fec2939209d0e4380b0628f65ea774e
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2772062
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-09-08 21:00:41 -07:00
Sagar Kamble
f1896e0a64 gpu: nvgpu: acquire tsg ctx_init_lock when changing ctx state
GR context associated with channel is updated in various driver paths.
Sequence to do the same is disable the TSG, preempt the TSG, update
the GR context or instance block and then enable the TSG.
These operations and runlist updates for channel have to be done under
TSG specific ctx_init_lock to avoid the race.

suspend_contexts and resume_contexts needs special handling which is
not covered in this patch.

Bug 3677982

Change-Id: I837257fe9d9ef3eb6f69f5d7e0707e0bb6d4ea72
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2720222
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-09-08 21:00:36 -07:00
Sagar Kamble
ef99d9f010 gpu: nvgpu: implement scg, pbdma and cilp rules
Only certain combination of channels of GFX/Compute object classes can
be assigned to particular pbdma and/or VEID. CILP can be enabled only
in certain configs. Implement checks for the configurations verified
during alloc_obj_ctx and/or setting preemption mode.

Bug 3677982

Change-Id: Ie7026cbb240819c1727b3736ed34044d7138d3cd
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2719995
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-09-08 21:00:30 -07:00
Sagar Kamble
06410ba862 gpu: nvgpu: add unit test to check subctx programming in inst blocks
Add unit test to validate the subcontext programming in the channel
instance blocks on creating and closing the channels.

Bug 3677982

Change-Id: I82cdc7d2f341381b2a143f300238f6390cfe3114
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2771035
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-09-08 21:00:25 -07:00
Sagar Kamble
693305c0fd gpu: nvgpu: subcontext add/remove support
Subcontext PDBs and valid mask in the instance blocks of the channels
in various subcontexts has to be updated when new subcontext is
created or a subcontext is removed.

Replayable fault state is cached in the channel structure. Replayable
fault state for subcontext is set based on first channel's bind
parameter. It was earlier programmed in function channel_setup_ramfc.

init_inst_block_core is updated to setup TSG level pdb map and mask.

Added new hal gv11b_channel_bind to enable the subcontext on channel
bind.

Bug 3677982

Change-Id: I58156c5b3ab6309b6a4b8e72b0e798d6a39c1bee
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2719994
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-09-08 21:00:20 -07:00
Sagar Kamble
269e853fc5 gpu: nvgpu: add unit test to check gr ctx buffer mappings for multi as
Add unit test to validate the gr ctx buffer mappings when subcontext
channels are created with multiple address spaces.

Bug 3677982

Change-Id: I369c2e7099bfb41d92d8e63ece27cc56fd2da420
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2771034
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-09-08 21:00:15 -07:00
Sagar Kamble
0c09610044 gpu: nvgpu: add unit test to check gr ctx buffer mappings
Add unit test to validate the gr ctx buffer mappings when subcontext
channels are created with shared VM.

Bug 3677982

Change-Id: Ieb2655a77ec50ab11e2c37476a202947fe59be87
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2771033
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-09-08 21:00:11 -07:00
Sagar Kamble
3c052be26c gpu: nvgpu: update patch_ctx data count during global ctx buffers commit
With multiple subcontexts support added, global context buffers can be
committed as and when VEID0 channel is allocated in the TSG. Earlier,
it was committed on creating first channel in the TSG.

To allow committing the global buffers for VEID0 channels created after
ASYNC VEID channels, patch buffer data count has to be updated hence
change the patch write begin and end calls to update the data count.

Bug 3677982

Change-Id: I8c4e61105384168f157a6983d0f6a0167eb39aab
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2757239
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-09-08 21:00:05 -07:00
Sagar Kamble
f55fd5dc8c gpu: nvgpu: multiple address spaces support for subcontexts
This patch introduces following relationships among various nvgpu
objects to support multiple address spaces with subcontexts.
IOCTLs setting the relationships are shown in the braces.

nvgpu_tsg             1<---->n nvgpu_tsg_subctx (TSG_BIND_CHANNEL_EX)
nvgpu_tsg             1<---->n nvgpu_gr_ctx_mappings (ALLOC_OBJ_CTX)

nvgpu_tsg_subctx      1<---->1 nvgpu_gr_subctx (ALLOC_OBJ_CTX)
nvgpu_tsg_subctx      1<---->n nvgpu_channel (TSG_BIND_CHANNEL_EX)

nvgpu_gr_ctx_mappings 1<---->n nvgpu_gr_subctx (ALLOC_OBJ_CTX)
nvgpu_gr_ctx_mappings 1<---->1 vm_gk20a (ALLOC_OBJ_CTX)

On unbinding the channel, objects are deleted according
to dependencies.

Without subcontexts, gr_ctx buffers mappings are maintained in the
struct nvgpu_gr_ctx. For subcontexts, they are maintained in the
struct nvgpu_gr_subctx.

Preemption buffer with index NVGPU_GR_CTX_PREEMPT_CTXSW and PM
buffer with index NVGPU_GR_CTX_PM_CTX are to be mapped in all
subcontexts when they are programmed from respective ioctls.

Global GR context buffers are to be programmed only for VEID0.
Based on the channel object class the state is patched in
the patch buffer in every ALLOC_OBJ_CTX call unlike
setting it for only first channel like before.

PM and preemptions buffers programming is protected under TSG
ctx_init_lock.

tsg->vm is now removed. VM reference for gr_ctx buffers mappings
is managed through gr_ctx or gr_subctx mappings object.

For vGPU, gr_subctx and mappings objects are created to reference
VMs for the gr_ctx lifetime.

The functions nvgpu_tsg_subctx_alloc_gr_subctx and nvgpu_tsg_-
subctx_setup_subctx_header sets up the subcontext struct header
for native driver.

The function nvgpu_tsg_subctx_alloc_gr_subctx is called from
vgpu to manage the gr ctx mapping references.

free_subctx is now done when unbinding channel considering
references to the subcontext by other channels. It will unmap
the buffers in native driver case. It will just release the
VM reference in vgpu case.

Note that TEGRA_VGPU_CMD_FREE_CTX_HEADER ioctl is not called
by vgpu any longer as it would be taken care by native driver.

Bug 3677982

Change-Id: Ia439b251ff452a49f8514498832e24d04db86d2f
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2718760
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-09-08 20:59:59 -07:00
Sagar Kamble
9e13b61d4e gpu: nvgpu: remove SPDX license identifier from hal
Below change added SPDX license identifier as svcacv complained.
However, these files have MIT license. SPDX need to be added to
GPL licensed sources.

  commit 2b2beb7fb6 ("gpu: nvgpu: ga10b: restore the ptimer isr hal")

Remove the identifier from hal files.

Change-Id: Ic90c46721d06a43749e5a48f7077a837a96fb664
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2770085
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-09-07 12:30:16 -07:00
Sagar Kamble
b69c035520 gpu: nvgpu: init golden context image with nvgpu VEID0 channel
With subcontexts support added, nvgpu has to allocate VEID0 channel
itself to initialize the golden context image. Allocate the channel
and init the golden context image at the beginning of alloc_obj_ctx
call for first user channel.

It can't be initialized at the end of probe as tpc pg settings need
to be updated before golden context image is initialized.

Bug 3677982

Change-Id: Ia82f6ad6e088c2bc1578a6bd32b7c7a707a17224
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2756289
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 <buildbot_gerritrpt@nvidia.com>
2022-08-31 20:25:11 -07:00
Debarshi Dutta
78a356d017 gpu: nvgpu: fix pbdma coverity issue
fix coverity issue CID 101056037

Initialize the pbdma_status once by calling
g->ops.pbdma_status.read_pbdma_status_info() to
avoid reading non-initialized data.

Bug 3461002

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: Ib21a70ee4a8b421084f60f6075ac0924623386ab
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2766516
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: svcacv <svcacv@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-08-30 23:46:39 -07:00
Debarshi Dutta
143034daab gpu: nvgpu: modify wait_pending
The wait_pending HAL is now modified to simply
check the pending status of a given runlist.
The while loop is removed from this HAL.

A new function nvgpu_runlist_wait_pending_legacy() is
added that emulates the older wait_pending() HAL.

nvgpu_runlist_tick() is modified to accept a 64 bit
"preempt_grace_ns" value.

These changes prepare for upcoming control-fifo parser
changes.

Jira NVGPU-8619

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: If3f288eb6f2181743c53b657219b3b30d56d26bc
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2766100
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-08-30 23:45:43 -07:00
Debarshi Dutta
1e2817e022 gpu: nvgpu: poweron for manual mode scheduling
Manual mode scheduling is incompatible with Runtime PM,
Added busy() and idle() calls during open/close of
control-fifo nodes.

Also, added functions to handle for the extra ref during
SC7 suspend/resume.

Jira NVGPU-8619

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: Ic8003c90a4535c2db3aef8f8d78b9dc4a6590b1f
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2766058
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-08-30 23:45:32 -07:00
prsethi
e4d1a739da gpu: nvgpu: nvs: plug nvs with safety code
- Change enables CONFIG_NVS_PRESENT for safety build.
- Fixes misra vioations.
- Renames sched.h to nvs_sched.h to avoid the conflict with QNX system
sched.h file for the safety support.
- Disable test_channel_close, test_tsg_unbind_channel,
test_channel_enable_disable_tsg, test_gv11b_fifo_preempt_tsg,
test_tsg_unbind_channel_check_hw_state and test_rc_deinit unit tests.

Jira NVGPU-8619

Change-Id: I7c983de2f4910fcb23687ec23368a060ce89c918
Signed-off-by: prsethi <prsethi@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2763579
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-08-29 17:31:03 -07:00
prsethi
427c7895ce gpu: nvgpu: nvs: plug nvs with common code
- Enabled CONFIG_NVS_PRESENT flag for QNX igpu
- Add common/nvs/* support for QNX

Jira NVGPU-8619

Change-Id: I309d009f072bb9aadb27585d634b0fbb2aab3c48
Signed-off-by: prsethi <prsethi@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2754547
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-by: Dinesh T <dt@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-08-29 17:30:52 -07:00
prsethi
440cf0c75e gpu: nvgpu: nvs: supporting changes to plug nvs with QNX
- Remove '()' from logging macro to fix compilation issue with QNX
- Add NSEC_PER_MSEC which is missing for QNX.

Jira NVGPU-8619

Change-Id: I0bc5c5a9c6979a0a78e29d26a40ca7927b25e5d0
Signed-off-by: prsethi <prsethi@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2754721
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-08-29 17:30:45 -07:00
Richard Zhao
dafbbebafc gpu: nvgpu: vgpu: add ERRBAR support to ga10b
- set the enable flag for ERRBAR
- set the HAL to ga10b_gr_set_sched_wait_for_errbar
- move ga10b_gr_set_sched_wait_for_errbar to call .exec_regops which
works in vgpu too.

Bug 3758132

Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Change-Id: Ie4821bf513da1253365386f08c71bb6e02d09b35
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2764030
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: svcacv <svcacv@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-08-27 19:08:08 -07:00
Divya
7bea894f0c gpu: nvgpu: add nvgpu_start_gpu_idle in nvgpu_remove path
- With ELPG + RG enabled, gpu_module_reload test fails.
- This happens because the test tries to unload nvgpu.ko
  module and then reload it. This all happens with RG enabled.
- During rmmod of nvgpu.ko module the code path taken is:
  nvgpu_remove() ->  nvgpu_quiesce() -> gk20a_pm_prepare_poweroff
  -> nvgpu_prepare_poweroff -> pmu_destroy
- In this code path, NVGPU_DRIVER_IS_DYING flag is not set.
- Thus, in pmu_pg_task thread (which keeps on running in parallel),
  commands are sent to the PMU and the driver keeps waiting for the
  ACK in nvgpu_pmu_wait_fw_ack_status().
- Add nvgpu_start_gpu_idle() in nvgpu_remove() path, before calling
  nvgpu_quiesce().
- This will set NVGPU_DRIVER_IS_DYING flag to true.
- nvgpu_can_busy() will return 0 when the driver is shutting down or
  getting removed.

Bug 3676200

Change-Id: Ic24f58c210e4b477e5d560b053b70c16308e16f1
Signed-off-by: Divya <dsinghatwari@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2762310
Reviewed-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
(cherry picked from commit 8f1792565e71b822a6e9cc50af4b43c1b48518e0)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2765300
Tested-by: Mahantesh Kumbar <mkumbar@nvidia.com>
2022-08-26 08:29:22 -07:00
ht
f46a3abfc6 gpu: nvgpu: Fix devg_nvgpu_igpu process crash.
As part of the negative test case we replace the ACR binaries with
corrupted one(by editing the binary in hex editor). The expectaion
was the process should log the error and exit properly but instead
the process crashed.

We have found the root cause and it was because we were trying to
flush a memory which was not allocated.

To mitigate this issue we added a checking condition to check if the
memory was allocated before flushing.

Bug 3670576

Change-Id: I6b510388fb913695210c791e2253c7514bb7a0a9
Signed-off-by: ht <ht@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2762276
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
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 <buildbot_gerritrpt@nvidia.com>
2022-08-26 08:26:53 -07:00
Divya
c07ac78d52 gpu: nvgpu: add correct value for base_period_ms
- Due to AELPG, threshold value gets changed as per
  GPU load. Thus ELPG does not get kicked in and
  "elpg_transitions" sysfs node does not increase. This
  causes ELPG test 101 in MODS to fail.
- Add correct value for base_period_ms parameter in
  ga10b_pmu_pg_pre_init()

Bug 3733077

Change-Id: I2d2d3d31379395b474f5d18355a2e16049c4a49a
Signed-off-by: Divya <dsinghatwari@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2750549
(cherry picked from commit 1ab707df38fa2802ef9e4a53a0975e14ec56c19b)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2762479
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-08-22 20:56:03 -07:00
atanand
4decbdcf73 nvgpu: fix coverity issue
Fixed null pointer dereference.
tsg pointer can be null when channel is not
bound to tsg.

CID 10157561

Bug 3461002

Change-Id: Icf1c19f1840effe0b1f2dc19766c60bf20c73cae
Signed-off-by: atanand <atanand@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2762161
Reviewed-by: V M S Seeta Rama Raju Mudundi <srajum@nvidia.com>
Reviewed-by: Prateek Sethi <prsethi@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-08-22 14:55:17 -07:00
mkumbar
d00a8fd09a gpu: nvgpu: Disable TSG before unbinding channel
Disable TSG before unbinding channel to fix the ap_systemsw
nvgpu_ctxsw_trace_twod test failure with AELPG power feature
enabled.

Bug 3695626

Change-Id: I55939b6b352da5f3f38b31440366a17d89ff7c20
Signed-off-by: mkumbar <mkumbar@nvidia.com>
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2740027
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: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-08-22 14:51:34 -07:00
Debarshi Dutta
42beb7f4db gpu: nvgpu: simplify the runlist update sequence
Following changes are added here to simplify the overall
sequence.

1) Remove deferred update for runlists. NVS worker thread
shall submit the updated runlist.

2) Moved Runlist mem swap inside update itself. Protect
the swap() and hw_submit() path with a spinlock. This
is temporary till GSP.

3) Enable Control-Fifo mode from nvgpu driver.

Jira NVGPU-8609

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: Icc52e5d8ccec9d3653c9bc1cf40400fc01a08fde
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2757406
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-08-20 23:33:45 -07:00
Debarshi Dutta
1d4b7b1c5d gpu: nvgpu: modify priority of NVS worker thread
In linux threaded interrupts run with a Realtime priority
of 50. This bumps up the priority of bottom-half handlers
over regular kernel/User threads even during process
context.

In the current implementation scheduler thread still
runs in normal kernel thread priority. In order to
allow a seamless scheduling experience, the worker
thread is now created with a Realtime priority of 1.
This allows for the Worker thread to work at a priority
lower than interrupt handlers but higher than the regular
kernel threads.

Linux kernel allows setting priority with the help of
sched_set_fifo() API. Only two modes are supported
i.e. sched_set_fifo() and sched_set_fifo_low().

For more reference, refer to this article
https://lwn.net/Articles/818388/.

Added an implementation of nvgpu_thread_create_priority()
for linux thread using the above two APIs.

Jira NVGPU-860

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: I0a5a611bf0e0a5b9bb51354c6ff0a99e42e76e2f
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2751736
Reviewed-by: Prateek Sethi <prsethi@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-08-20 23:33:34 -07:00
Debarshi Dutta
13699c4c15 gpu: nvgpu: ensure worker thread is disabled during rg
A previous commit ID 44b6bfbc1 added a hack to prevent
the worker thread from calling nvgpu_runlist_tick()
in post_process if the next domain matches the previous.

This could potentially still face issues with multi-domains
in future.

A better way is to synchronize the thread to suspend/resume
alongwith the device's common OS agnostic suspend/resume
operations. This shall emulate the GSP as well.
This shall also take care of the power constraints
i.e. the worker thread can be expected to always work
with the power enabled and thus we can get rid of the complex
gk20a_busy() lock here for good.

Implemented a state-machine based approach for suspending/
resuming the NVS worker thread from the existing callbacks.

Remove support for NVS worker thread creation for VGPU.
hw_submit method is currently set to NULL for VGPU. VGPU
instead submits its updates via the runlist.reload() method.

Jira NVGPU-8609

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: I51a20669e02bf6328dfe5baa122d5bfb75862ea2
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2750403
Reviewed-by: Prateek Sethi <prsethi@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-08-20 23:33:29 -07:00
Debarshi Dutta
21ab579341 gpu: nvgpu: don't skip setting same clk in arbiter
In the current setting, clock arbiter skips setting
the clock if its already set previously. The value
set by the arbiter is stored in
"struct nvgpu_clk_arb->actual" whenever the clock is
updated via the arbiter. However, DVFS might also
update the clock and the updates are not synchronized
with the arbiter. Hence, ensure that any clock
requests are always updated i.e. the requested rate is
set even if the previous rate remains the same.

In the devfreq scale() part, scale emc when clk_arb
is active and skip setting of clocks.

Bug 3666615

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: I32bf4dbf81b19fdd6fa0bdec3a6c9a9312b78eca
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2727787
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-08-19 21:28:46 -07:00
Prasun Kumar
4194c35e17 gpu: nvgpu: Err injection utility support
Update callback registration with error inject utility.
Add callback de-registration with error injection utility
when CIC_MON is removed.

Bug 3413214

Signed-off-by: Prasun Kumar <prasunk@nvidia.com>
Change-Id: Iab682cd522a96fd6af136485c4f3b73f81f723b8
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2755178
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-08-17 19:22:17 -07:00
Dinesh T
4e78d478c3 gpu: nvgpu: Add mutex lock to synchronise isr threads
This is adding a mutex lock to synchronise between
stall isr threads.
Orin(t234) has three interrupt lines and three ISR
threads to handle bottom half of the ISR. The threads
sharing same data between them without proper synchronization.
When multiple interrupts trigger simeltaneously, causing the
threads running in parallell like below traces

#0  nvgpu_cic_mon_intr_stall_isr (g=g@entry=0x5ed62a9318)
    at /home/dt/automotive-dev-main-20220802T015100095/kernel/nvgpu/drivers/gpu/nvgpu/common/cic/mon/mon_intr.c:158
#1  0x00000013758cae30 in nvgpu_intr_stall (arg=0x5ed62a9120)
    at /home/dt/automotive-dev-main-20220802T015100095/qnx/src/resmgrs/nvrm/nvgpu_rmos/os/intr.c:140
#2  0x00000013758ec090 in nvgpu_posix_thread_wrapper (data=<optimized out>)
    at /home/dt/automotive-dev-main-20220802T015100095/kernel/nvgpu/drivers/gpu/nvgpu/os/posix/thread.c:77
#3  0x0000001375b01000 in pthread_attr_setdetachstate ()
   from /home/dt/automotive-dev-main-20220802T015100095/out/embedded-qnx-t186ref-debug-none/target_rootfs/lib/libc.so.5
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

This is causing some race in shared data access and causing
multiple issues.

Bug 3647988

Change-Id: If40e581635b52cce288d8f4b00af6a040f7f9a6e
Signed-off-by: Dinesh T <dt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2755874
Reviewed-by: Tejal Kudav <tkudav@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: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-08-13 05:18:56 -07:00
Jon Hunter
59f7a9e318 gpu: nvgpu: Fix crash if tegra_bpmp_get() fails
The function tegra_bpmp_get() returns an error pointer on failure and
so if the call to tegra_bpmp_get() fails, because the device-tree
property is missing, then this is not detected and leads to a crash when
trying to dereference the pointer to the bpmp handle. Fix this by
correctly checking the return value from tegra_bpmp_get().

Bug 3752030

Change-Id: I944063ab7e116fc81769c9dbbfefe6b6dc4bf0f4
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2759251
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-08-12 15:51:55 -07:00
Jon Hunter
34f478fca6 gpu: nvgpu: Add host1x support for Tegra234
Add support for the upstream host1x driver in NVGPU for Tegra234.

Bug 3724727
Bug 3752030

Change-Id: I529b731ea3feb3c8c435e7433772af82004ea208
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2759207
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-08-12 15:51:50 -07:00
Dinesh T
68976fbd22 gpu: nvgpu: gv11b+: set live pes mask
This change is reading the live pes from the register
"gr_gpc0_gpm_pd_live_physical_pes_r" and set it to
"gr_gpc0_swdx_pes_mask_r".

Every PES needs at least a TPC to work. If any of the TPCs
are floorswept,the live PES mask is read from
"gr_gpc0_gpm_pd_live_physical_pes_r" and  the corresponding
active PES mask is updated in "gr_gpc0_swdx_pes_mask_r".

Bug 3677421

Change-Id: I899ac41c4a82beb3ce75c84ad57dcad262a49ba1
Signed-off-by: Dinesh T <dt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2736560
(cherry picked from commit 85f2ceb3db6eeef925b49553f445d8cc31ec39da)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2759135
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-08-12 11:05:35 -07:00
Debarshi Dutta
8cb147aa88 gpu: nvgpu: add a soft dependency on podgov module
The present implementation of podgov driver doesn't
export any symbols and as a result, the dependency
between NVGPU driver and podgov is not established
by depmod. Fix that by adding a soft dependency.

MODULE_SOFTDEP("pre: governor_pod_scaling");

This allows loading the podgov governor before
nvgpu driver.

Bug 3674235

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: Id1959639399042f488cdaa30372feb65d8f21aaa
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2740446
(cherry picked from commit e4b3499850)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2741188
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-08-12 11:01:32 -07:00