Commit Graph

9942 Commits

Author SHA1 Message Date
Austin Tajiri
0e6c8bb521 gpu: nvgpu: set gpc_mask via HAL when possible
Update gr_config_set_gpc_mask() to always set gpc_mask via the HAL when
possible and not just when CONFIG_NVGPU_DGPU is set. In GA10B, logical
GPC ID does not necessarily equal physical GPC ID.

Jira GVSCI-14589

Change-Id: I8785b6a8a7c21a9d4401137aed5135f150697e88
Signed-off-by: Austin Tajiri <atajiri@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2823541
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-09 15:13:26 -08:00
Rajesh Devaraj
3b2b225c73 gpu: nvgpu: update pmu_early_init
Move the setting of power features related enable flags to separate
static function. Invoke this function when PMU is not supported.

JIRA NVGPU-9283

Change-Id: I429504c09d40c2cb115fce7550555f06b1e384ed
Signed-off-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2817658
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Ramalingam C <ramalingamc@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-07 01:51:30 -08:00
Dinesh T
373398a46b gpu: nvgpu: Add os specific call to initialize the channels
Add OS specific function to return the number of syncpoints
available to the GPU. This is required for making the
syncpoints as configurable.

Linux: The default number of syncpoints is 512.

Bug 3644504

Change-Id: Iddbc38cb25480876d6d8f39f039218a1b2b22605
Signed-off-by: Dinesh T <dt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2820152
Reviewed-by: Alex Waterman <alexw@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: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-06 04:47:24 -08:00
Debarshi Dutta
8e60795b9c gpu: nvgpu: Add correct nomenclature for NVS ioctls
Its preferable to use the following naming convention
NVGPU_<group>_IOCTL_<function>.

The IOCTL interfaces are updated accordingly.

Also, all KMD based defines as part of the UAPI need
to be prefixed by NVGPU.

Jira NVGPU-8619

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: I2210336536cbcc0415885f3f92a2f7fa982fa39c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2814484
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-12-06 04:40:05 -08:00
Shashank Singh
eb60e7f1f1 gpu: nvgpu: fix memory leak in pd cache
Fix memory leak in case dma allocation fails in function
nvgpu_pd_cache_alloc_direct_lock(). This one got introduced by the patch
https://git-master.nvidia.com/r/c/linux-nvgpu/+/2735657.

Bug 3461002

Change-Id: Ia8c6138179cc9bb2adc53bff32dd81fb2b6ee54a
Signed-off-by: Shashank Singh <shashsingh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2821684
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
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: Sagar Kamble <skamble@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-12-05 20:48:24 -08:00
prsethi
bd134326f8 gpu: nvgpu: reset the nvs user mask before resetting the queue
user->active_used_queues mask should be unset before the queue->mask
gets reset as part of queue->free calls otherwise user will be
considered as active and will avoid the proper cleanup.

Bug 3884011

Change-Id: I7a9d620a5dae057df2eb41fced8c801e14639e61
Signed-off-by: prsethi <prsethi@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2818962
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-12-05 20:41:14 -08:00
Rajesh Devaraj
469ad373b4 gpu: nvgpu: update clk arbiter init
Initialize clk arbiter only when NVGPU_CLK_ARB_ENABLED flag is set.

JIRA NVGPU-9283

Change-Id: I69dcfab349af7293ce3b3edb588a30a101a36e94
Signed-off-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2814780
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: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-02 08:06:10 -08:00
Divya
b4b98aba02 gpu: nvgpu: reorder elpg and elpg_ms flags check
- In rmmod path, gr struct is freed first and then
  info_mem_destroy is called which calls elpg_ms
  protected call. This in turn waits for gr init
  where gr struct is accessed. This could lead to
  NULL access.
- move elpg and elpg_ms flag check before checking
  pg initialized and gr wait conditions to avoid
  the NULL access issue.

Bug 3848290

Change-Id: I088d89d7876405cc7abedb777884b442726e992f
Signed-off-by: Divya <dsinghatwari@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2811131
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: Mahantesh Kumbar <mkumbar@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-01 11:03:05 -08:00
rmylavarapu
54c2b7a546 gpu: nvgpu: gsp sched: send device info to the gsp fw
Change
- It is hard coded to send number of devices info to the gsp depending
  on the chip. This CL will auto check the number of devices and send
  to the gsp fw according to the chip.
  
NVGPU-8531

Change-Id: I8890c194121d9164962c2a4ca341244e69bf7f38
Signed-off-by: rmylavarapu <rmylavarapu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2790015
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-12-01 11:00:50 -08:00
Rajesh Devaraj
303f30e11e gpu: nvgpu: update emulate sysfs node
For emulate sysfs node, perform create/remove operations only
when NVGPU_SUPPORT_EMULATE_MODE is enabled.

JIRA NVGPU-9283

Change-Id: I5f7a713fb51554f013cd27d10c807e556f3ded56
Signed-off-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2817895
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-30 19:50:05 -08:00
Sagar Kamble
8c84f8836a gpu: nvgpu: set MIT license for nvsched sources
Change NV license for nvsched sources and Makefile.doxygen to MIT
license as those can be distributed with other linux sources but
they are also used in qnx.

Bug 3871403

Change-Id: Iefc957b4afdf4c3c2ff19df144caac9790490114
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2814847
(cherry picked from commit 406e5392b7)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2818121
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: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-30 10:44:27 -08:00
Debarshi Dutta
3f2e287235 gpu: nvgpu: add missing necessary callbacks for DMA_BUF export
DMA_BUF export needs some of the callbacks to be non-NULL
such as map_dma_buf, unmap_dma_buf and release callbacks.

Absence of gives gives a Warning and returns a failure.

Jira NVGPU-8619

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: Iea109cbfe06c1b2eb8741c727b52fcfd0ffece8e
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2815108
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: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Prateek Sethi <prsethi@nvidia.com>
2022-11-30 10:43:35 -08:00
Ramalingam C
093974e397 gpu: nvgpu: ga10b: use a hal instead of a macro
Use the g->ops.grmgr.get_allowed_swizzid_size() hal instead of
smcarb_allowed_swizzid__size1_v(). This helps to avoid the duplication
of another hal when the macro changes for new chips.

JIRA: NVGPU-9078

Change-Id: I2dfb927172c30e945c2c20da7dd64f7f17bc71ae
Signed-off-by: Ramalingam C <ramalingamc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2814618
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: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-30 10:43:16 -08:00
Sagar Kamble
8a54f6d840 gpu: nvgpu: set MIT license for unit test Makefiles
Change NV license for unit test Makefiles to MIT license as those
can be distributed like unit test sources.

Bug 3871403

Change-Id: I2a835ea39eb24a2e4fcb3aaff100690a54cbaf22
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2813958
(cherry picked from commit 577bcd8d9d)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2818122
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-30 06:27:47 -08:00
Debarshi Dutta
2d38294912 gpu: nvgpu: add Doxygen documentation for Control-Fifo
Add Doxygen for Control-FIFO APIs. Add null checks where
necessary.

Jira NVGPU-8619

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: I75f92108c73a521e45299b8870e106916954e7a8
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2805551
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Prateek Sethi <prsethi@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
Tested-by: Prateek Sethi <prsethi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-29 04:06:53 -08:00
Rajesh Devaraj
9143860355 gpu: nvgpu: add null check
As part of supporting GPU minimal boot, some of the HALs are assigned
with NULL. Before dereferencing such HALs, check for NULL.

Further, this patch reorganizes needs_init API to first check whether a
function pointer is NULL, to enable quick turnaround to the caller of this API.

JIRA NVGPU-9283

Change-Id: I768d1cddef8766948c99892c59f6ebe6f31be9d8
Signed-off-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2814225
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-24 11:23:38 -08:00
Shashank Singh
7abaeda619 gpu: nvgpu: add API to query page table memhandles
Add API to query all memhandles used for pde and pte.
- Some direct pde/pte allocation should also add entry to the pd-cache
full list.
- Add OS API for querying MemServ handle from nvgpu_mem.
- Traverse through all pd-cache partial and full lists to get memhandles
for all pde/pte buffers.

Jira NVGPU-8284

Change-Id: I8e7adf1be1409264d24e17501eb7c32a81950728
Signed-off-by: Shashank Singh <shashsingh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2735657
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-24 11:19:10 -08:00
Debarshi Dutta
63e8de5106 gpu: nvgpu: Remove NVGPU_SUPPORT_NVS_CTRL_FIFO
Now that we are planning to enable CTRL_FIFO support with NVS,
there is no need for a separate enabled flag for the same.

CTRL_FIFO support is instead determined by the presence of
NVGPU_SUPPORT_NVS enable flag alone.

For non-auto platforms, Control-Fifo can be disabled by restricting
access to /dev/nvsched_ctrl_fifo.

Jira NVGPU-8619

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: I9dbec60e5668f38e1460c43800584e88b16a2550
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2814435
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-24 00:47:37 -08:00
Debarshi Dutta
e583e4a6dc gpu: nvgpu: add adequate checks for control-fifo node.
Add additional checks to prevent users without both READ/WRITE
permissions from opening the control-fifo device node.

Jira NVGPU-8619

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: Ie0be0f578c154b45547d5d150ddabaa5936bda80
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2813816
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: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Prateek Sethi <prsethi@nvidia.com>
2022-11-24 00:45:47 -08:00
Sagar Kadamati
48ef56104d nvgpu: add nvgpu checker config
* Add config details needed to enable checkers for safety build

Jira NVGPU-8885

Change-Id: I02862d95589336077c742f6bd06721b11c2754cc
Signed-off-by: Sagar Kadamati <skadamati@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2807391
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-24 00:40:14 -08:00
Debarshi Dutta
a8bdb67b2e gpu: nvgpu: add doxygen comments for NVS
Add doxygen comments for Domain Management APIs
of NVS.

Added NULL handling where required.

Jira NVGPU-8619

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: I23f45b95c070c8249bb83a336239b2b2d1a852a4
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2805043
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-24 00:39:21 -08:00
Debarshi Dutta
5d2dfc88a3 gpu: nvgpu: Replace CONFIG_NVS_KMD_BACKEND
Use CONFIG_KMD_SCHEDULING_WORKER_THREAD instead of
CONFIG_NVS_KMD_BACKEND to remove confusion about the CPU based
KMD scheduling worker thread.

The KMD based scheduling worker thread caters to both Manual Mode
CPU based scheduler as well as Automatic Round Robin CPU based
scheduler.

For the traditional submit path, add correct handling of the
CONFIG_NVS_PRESENT. CPU based worker thread should be part of
CONFIG_NVS_PRESENT. Eventually, when DCONFIG_KMD_SCHEDULING_WORKER_THREAD
is removed, the application must switch to GSP.

Jira NVGPU-8619

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: I0886ef3b2e0124b6fe22c2bf0bf7d1fa98039d00
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2810217
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-23 08:07:24 -08:00
Tejal Kudav
9865db4e46 gpu: nvgpu: Enumerate priv ring before intr enable
Mon subelement needs to access GPC TPC configuration registers
to figure out GPC/TPC count post floor sweeping. These registers
are needed as part of intr handling.
Move priv ring init ahead in RM boot to make sure priv ring
enumeration is done before any unit enables it's interrupts.
This ensures that priv ring is enumerated before any interrupt
handler is run to access GPC/TPC count.

JIRA NVGPU-6528

Change-Id: I8aa6ac182e6dd60a79fa76af6813ea70102316f4
Signed-off-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2809442
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-23 08:06:17 -08:00
vivekku
a687c78077 gpu: nvgpu: exit PMU functions if PMU state is OFF
Add a condition to exit PMU functions if PMU FW state is
Set to OFF as these functions could be called from main
GPU thread or pg task thread but PMU sub-unit is exited
as part of power off sequence.

Bug 3812500

Change-Id: I8e8de411e1cb2b0ffe1991814ce8209113490272
Signed-off-by: vivekku <vivekku@nvidia.com>
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2789329
(cherry picked from commit 71253495bf994c1e17ea18146451b50e4e64bba5)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2789518
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-by: Divya Singhatwaria <dsinghatwari@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Tested-by: Divya Singhatwaria <dsinghatwari@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-22 21:56:51 -08:00
Divya
3e6d61b177 gpu: nvgpu: wake up gr wait wq in rmmod path
- The pmu_pg_task thread remains alive in the background
  during railgate and rail-ungate.
- During rail-ungate, the PG task thread starts again and
  executes PG-related tasks.
- It comes in pmu_pg_init_powergating() and waits for GR
  initialization. Here it waits for gr to be initialized.
- In parallel, the main GPU thread works on rmmod (from
  gpu_module_reload test).
- By this time, the main gpu thread has started rmmod and
  gr->initialized can be set to false, thus causing an uninterruptible
  wait for pmu_pg_task thread.
- To solve this, wake gr wait wq in rmmod path when
  NVGPU_DRIVER_IS_DYING and NVGPU_KERNEL_IS_DYING flgas are set.

Bug 3806514

Change-Id: Id78d92f30b75aba1aee22398cc86a3acebd50ef6
Signed-off-by: Divya <dsinghatwari@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2798003
(cherry picked from commit d9345065bcb6d9ff497c127fa4cd52077f4ecfa4)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2807245
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: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-21 04:19:18 -08:00
Kishan
ea9aebb358 nvgpu:cic: API to handle fatal error interrupt
Any corrected or uncorrected error reported by gpu hw
will be seen by nvgpu-mon. nvgpu-mon will raise a devctl call
to notify nvgpu-rm if its a fatal error interrupt.
nvgpu_cic_mon_handle_fatal_intr is the corresponding handler which will
walk through the entire tree structure of interrupts for all the subunits
and enter quiesce state.

Change-Id: I3c00c61a7f2c52ae1920f84ee7dfb65cba6b683d
Signed-off-by: Kishan <kpalankar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2801693
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-17 19:34:43 -08:00
Rajesh Devaraj
69adc6c91d gpu: nvgpu: add null check for mssnvlink hals
Add NULL check for mssnvlink related HALs.

JIRA NVGPU-9263

Change-Id: I418191c11aabdb614255220d4e26120e9301a2d2
Signed-off-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2806101
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: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-17 11:26:58 -08:00
Divya
f6aedfc36b gpu: nvgpu: adjust the max idle filter for AELPG
- When we enable AELPG, we send maximum idle threshold value
  as one of the parameters.
- This was set to 70 msec whereas the ELPG IDLE threshold
  was set to 15 msec.
- Thus, when AELPG is enabled, the threshold is getting modified
  to a much higher value. So sometimes ELPG is not getting engaged
  and this is leading to timeout in ELPG MODS 101 test on GVS.

Bug 3737783

Change-Id: Iac94f053e19cea5898b962c3d02369d556b8518f
Signed-off-by: Divya <dsinghatwari@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2786749
(cherry picked from commit 5010eaffda2ecaf6c9cc5f0fed68498cb2947071)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2809154
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-17 07:21:27 -08:00
Debarshi Dutta
53aa8b7244 gpu: nvgpu: disable multi-domain RR scheduling for NVS
Disable multi-domain RR scheduling for NVS code for auto platforms
and keep it enabled only for L4T.

Bug 3839407

Change-Id: I7c7977f83f72756a9c5e8f9a9f22dde2c7766fb9
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2802937
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-17 07:16:03 -08:00
rmylavarapu
e432d2a41c gpu: nvgpu: gsp: fix update runlist info cmd
Current runlist update command uses domain info present in runlist
structure which would be changing depending upon the active domain, this
would cause issue while sending runlist info to the gsp fw. This Cl will
fix the issue by passing the domain parameters to the update runlist
function for sending it to the gsp fw.

NVGPU-8531

Change-Id: Id57b446b55c6e50833376767d672d873a1a9207e
Signed-off-by: rmylavarapu <rmylavarapu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2803045
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-11-17 02:05:43 -08:00
rmylavarapu
c8429c5de9 gpu: nvgpu: gsp sched: get device id from runlist pri base
Get the device id from runlist pri base instead of reading from
runlist structure which could be failing if the device node not
present inside the runlist struct.
This Change will call the get device id hal to get it from rlend_id
and runlist pri base.

NVGPU-8531

Change-Id: Ia81189a6c2281ed09ee52eb461f0cd87164c5fc4
Signed-off-by: rmylavarapu <rmylavarapu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2791605
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-17 02:04:28 -08:00
Sagar Kamble
2b69b9b264 gpu: nvgpu: return 40 bit addr from nvgpu_mem_userspace_get_addr
For some of the unit tests cpu va for malloc'd buffers was going above
4gb and assert about 4gb is hit. HW supports 40 bit physical address.
Hence return 40 bit address instead of 32 bit address.

Bug 3862385

Change-Id: Ia8cc71d7e7356f2de8d0a4ba1e17f2a2cef0fe10
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2805596
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-14 20:59:06 -08:00
Sagar Kamble
ae5488c495 gpu: nvgpu: add multi process tsg sharing char for linux
Add the characteristic flag NVGPU_SUPPORT_MULTI_PROCESS_TSG_SHARING
for Linux.

Bug 3677982
JIRA NVGPU-8681

Change-Id: I774c1aa57f91704a28cfb18912eba4f5afe3b9b8
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2792083
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-10 11:50:04 -08:00
Sagar Kamble
ce26e92de6 gpu: nvgpu: open TSG with the share token
Implement OPEN_TSG ioctl with share tokens.

Bug 3677982
JIRA NVGPU-8681

Change-Id: If44aef863c932163df769acef5b3586f97aaecd3
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2792082
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>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-10 11:49:59 -08:00
Sagar Kamble
96f675595c gpu: nvgpu: implement get and revoke share token ioctls
Add share token list to gk20a_ctrl_priv. Implement GET_SHARE_TOKEN
and REVOKE_SHARE_TOKEN ioctls. Revoke tokens while closing the
TSG for all active devices.

Bug 3677982
JIRA NVGPU-8681

Change-Id: I74455c21d881d5a0d381729fd695239722599980
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2792081
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: Scott Long <scottl@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-10 11:49:54 -08:00
Sami Kiminki
31a4701931 gpu: nvgpu: UAPI specification for TSG sharing
Add below ioctls for TSG share token management:
1. NVGPU_TSG_IOCTL_GET_SHARE_TOKEN
2. NVGPU_TSG_IOCTL_REVOKE_SHARE_TOKEN

Update the ioctl NVGPU_GPU_IOCTL_OPEN_TSG to consider
the creation of TSG with share token.

Bug 3677982
JIRA NVGPU-8681

Change-Id: I436217061bc0e9f6424ea793cf7efbc3368d0817
Signed-off-by: Sami Kiminki <skiminki@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2792078
Tested-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-10 11:49:49 -08:00
Sagar Kamble
675edd5053 gpu: nvgpu: maintain authorized devices in TSG
When the TSG is successfully created first time or is opened with share
token, the device instance id associated with the CTRL fd will be added
to the TSG private data structure as authorized device instance ids.

This is used for a security check when creating a TSG share token with
nvgpu_tsg_get_share_token.

Bug 3677982
JIRA NVGPU-8681

Change-Id: I67bb0514e1272dab15023cd3828a6a51e9a4c928
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2792080
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: Scott Long <scottl@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-10 11:49:44 -08:00
Sagar Kamble
6e2b592ab9 gpu: nvgpu: add ctrl device instance ID
In order to share the TSG across different devices securely, device
instance IDs are to be exchanged for endpoint identification. Add
device instance ID field to gk20a_ctrl_priv which is generated
from gk20a level device instance id value.

Share this ID to userspace via gpu characteristics.

Bug 3677982
JIRA NVGPU-8681

Change-Id: I79d92a81c02272c52e24f5b12c452c8993137037
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2792079
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-10 11:49:39 -08:00
Tejal Kudav
41c874a2d9 gpu: nvgpu: Fix error injection HAL init
Currently, the registeration with error injection utility is done
only for GA10b using HAL. But HALs are not initialized during the
probe stage when we try to register the error injection utility.
So, the callback registration does not happen HAL is set to NULL.
Move the callback registration from probe to poweron stage when HAL
is initialized.
Update the nvgpu_cic_mon_init_lut() API name as it is no longer
doing only LUT initialization.

Bug 3828050

Change-Id: Ide718029e9317124749b4a51c423ae70dc8227c8
Signed-off-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2790269
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-08 13:11:58 -08:00
Kishan
f29ed3a474 gpu: nvgpu: Makefile changes to enable IPC between nvgpu-mon and rm.
CONFIG_NVGPU_MON_PRESENT is being enabled only for safety debug
& release build.

Change-Id: I5c58ea52a5a844483236927366e74faf800423b3
Signed-off-by: Kishan <kpalankar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2775941
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: Tejal Kudav <tkudav@nvidia.com>
2022-11-04 20:49:39 -07:00
Sagar Kamble
d1b28712b6 gpu: nvgpu: implement VEID alloc/free
Implement the ioctls NVGPU_TSG_IOCTL_CREATE_SUBCONTEXT and
NVGPU_TSG_IOCTL_DELETE_SUBCONTEXT. These will allocate and
free the VEID numbers.

Address space association with the VEIDs is verified to
ensure that channels association with VEIDs and address
space remains consistent.

Bug 3677982
JIRA NVGPU-8681

Change-Id: I2d913baf61a6bdeec412c58270c0024b80ca15c6
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2766765
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-01 00:05:18 -07:00
Sami Kiminki
9233886943 gpu: nvgpu: UAPI specification for VEID alloc/free
nvgpu will be allocating and freeing the subcontext VEIDs for
sharing the TSG across processes.

Add interfaces for allocating and freeing the VEIDs.

Bug 3677982
JIRA NVGPU-8681

Change-Id: I48b00609147e2696404c3aad14dae9bb940d04d4
Signed-off-by: Sami Kiminki <skiminki@nvidia.com>
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2497716
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-01 00:05:12 -07:00
Rajesh Devaraj
7138e7e673 gpu: nvgpu: export function definitions across chips
To avoid duplication of same code across multiple chips, export the
following functions through the corresponding headers for the
consumption of other GPU enabling functions:

- ga10b_gr_intr_report_tpc_sm_rams_ecc_err
- gv11b_gr_intr_report_l1_tag_uncorrected_err
- gv11b_gr_intr_report_l1_tag_corrected_err
- gv11b_gr_intr_report_icache_uncorrected_err

JIRA NVGPU-9075

Change-Id: I927285b6e638479ac52cd5d214711e490e5f151e
Signed-off-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2798371
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: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-28 15:30:20 -07:00
prsethi
de0808ea5b gpu:nvgpu: fix below issue with ctrl nvs.
- Move queue lock at correct place.
- Free the allocated memory.

Jira NVGPU-8622

Change-Id: Ia996d80498e53fb21ddf1f1202abd6fb8e3f6168
Signed-off-by: prsethi <prsethi@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2791618
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-28 15:28:46 -07:00
Mikko Perttunen
5c8e511e48 gpu: nvgpu: linux/host1x: Execute fence callback in non-atomic context
Due to changes in the host1x driver, dma_fence callbacks will be
executed in interrupt context instead of workqueue context as
previously. To allow for that, this patch effectively moves the
workqueue step into nvgpu so that the in-nvgpu fence callback gets
executed in workqueue context.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I7bfa294aa3b4bea9888921b79175a8fc218d8e3f
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2785968
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-27 11:54:31 -07:00
Ramalingam C
e933a47bd8 gpu: nvgpu: Export func definitions across chips
Export below functions through the corresponding headers for the
consumption of other GPU enabling codes

gr_gv11b_pri_pmmgpc_addr
gr_gv11b_split_pmm_fbp_broadcast_address

JIRA NVGPU-9073

Change-Id: I8ebaa5329352c1c0d5bb5f787736cbe04a61b809
Signed-off-by: Ramalingam C <ramalingamc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2796095
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-26 12:09:31 -07:00
Ramalingam C
6c9ae09d93 gpu: nvgpu: Export func definions for future usage
Export below functions through the corresponding headers for the
consumption of other GPU enabling codes.
	gv11b_fb_copy_from_hw_fault_buf
	gv11b_mm_mmu_fault_handle_mmu_fault_refch
	gsp_get_emem_boundaries

Change-Id: If041d1983a6981f510d8dd622c95b1e80fa50e16
Signed-off-by: Ramalingam C <ramalingamc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2794239
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: V M S Seeta Rama Raju Mudundi <srajum@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-20 19:42:05 -07:00
Sagar Kamble
7ab770ae93 gpu: nvgpu: skip mapping global ctx buffer if already mapped
Global context buffers were mapped on every ALLOC_OBJ_CTX call.
If many channels are created sharing an address space they can
exhaust the VA space by mapping same global context buffers
again and again.

Skip mapping the global context buffer if it is already mapped
for an address space.

Bug 3802863
Bug 3796293

Change-Id: I3844c211b3350aa06cabd92c415a34a83034dd43
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2789584
(cherry picked from commit 0611ec30c6a61b7e1b07d516b74d6eddb3c6b37e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2789581
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-12 22:16:36 -07:00
Debarshi Dutta
7ab3b9937d gpu: nvgpu: plugin control-fifo ioctls
Enable control-fifo IOCTL operations for Linux

Jira NVGPU-8619

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: I112322d207f6e20e60e726c24f47c6f73035562c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2789850
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: Prateek Sethi <prsethi@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-12 06:00:37 -07:00
Debarshi Dutta
280b69e66d nvgpu: userspace: add unit test for nvs
Add a unit test to add verification for S/W parts of
NVGPU-KMD based scheduler

Jira NVGPU-8619

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: I266cb4167074dc5f7da647ce627e96188fc6bdcb
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2767591
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-10 14:08:03 -07:00