Commit Graph

498 Commits

Author SHA1 Message Date
Ketan Patil
ebf51c43ae video: tegra: nvmap: Add more checks to avoid races
Add more checks in nvmap code so as to avoid any possible races.
- Update is_nvmap_id_ro and is_nvmap_dmabuf_fd_ro functions so that they
return error value during error conditions and also update their callers
to handle those error values.
- Move all trace statements from end of the function to before handle
refcount or dup count is decremented, this make sure we are not
dereferencing any freed handle/reference/dambuf.
- Increment ref's dup count wherever we feel data race is possible, and
decrement it accordingly towards end of function.

Bug 4253911

Change-Id: I50fc7cc98ebbf3c50025bc2f9ca32882138fb272
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2972602
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-06 11:58:16 -07:00
Ketan Patil
ee71e72f4e video: tegra: nvmap: Do not decrement handle's refcount
Do not decrement handle's refcount until allocation function is
completed. If there is a data race between nvmap_ioctl_alloc and
nvmap_ioctl_free, the dma-buf/handle can get freed before last access
to dmabuf in nvmap_ioctl_alloc.

Bug 4253472

Change-Id: Idbcee278df645389f85ad03d48fa7baa76a7213d
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2969182
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2971778
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-01 19:51:11 -07:00
Jian-Min Liu
719d3fa024 nvidia-oot: use TEGRA_SYSTEM_TYPE_ACK as ack macro
Use config TEGRA_SYSTEM_TYPE_ACK to control kernel builds only
base on the system type which also aliged to Makefile use.

Bug 4223187

Change-Id: I276208d180d1b3459eccb80d8fdb818f4507d3df
Signed-off-by: Jian-Min Liu <jianminl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2966713
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-24 23:32:04 -07:00
Akshata Bhat
2279d375da dla: kmd: Follow-up update for single DLA boards
+ Updates the DLA0 enumeration logic (added by Gerrit 2945452)
and limits it to single instance boards only

+ On boards with 2 DLAs, the above logic caused DLA0 to be initialized
with DLA1 config and vice-versa.

Reason: DLA instances can be probed/initialized in any order. The first
DLA to call nvdla_probe() was enumerated as DLA0. But the DLA init was
done in accordance with the actual HW instance ID, resulting in device
node mismatch.

Bug 4233463

Signed-off-by: Akshata Bhat <akshatab@nvidia.com>
Change-Id: Ic054ebdae4aec95fdc50dc068cf1a6f6ecf928bf
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2958902
Reviewed-by: Arvind M <am@nvidia.com>
Reviewed-by: Mitch Harwell <mharwell@nvidia.com>
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-18 11:02:40 -07:00
Saravanan Ponnuswamy
67366636bb nvidia-oot: MISRA violation fixes
This patch fixes the following violations:

CERT STR31-C - 3 violations

Signed-off-by: Saravanan P <saravananp@nvidia.com>
Change-Id: Ic1fa2b18e855a5eb6e28d09fd6f436151ed2a880
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2931426
(cherry picked from commit 4c29b05e2734b197b9ffcdd2a0d7e1e8cc788451)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2943561
Reviewed-by: Shu Zhong <shuz@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-18 10:50:42 -07:00
Anubhav rai
b66b703f0e camera: vi: Fix VI clk scaling for gangmode
gangmode uses single VI channel to stream simultaneously
from 2 CSI bricks. The VI clk should be scaled accordingly
to accommodate this bandwidth

bug 3814565

Signed-off-by: Anubhav rai <arai@nvidia.com>
Change-Id: I6912f1aeb878e53e63e3a04c7132219f030973d1
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2791338
(cherry picked from commit 7a95f84f1eb4f60a8e9740876db53b23c95f865e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2866932
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Ankur Pawar <ankurp@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-17 20:05:03 -07:00
Ketan Patil
1c2599bcba video: tegra: nvmap: Update carveout name
Compression carveout is not correct carveout name as it will be used
by gpu even for non-compression usecases. Hence rename it to gpu
carveout.

Bug 3956637

Change-Id: I802b91d58d9ca120e34655c21f56c0da8c8cf677
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2955536
Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com>
2023-08-16 18:47:35 -07:00
Sagar Tyagi
a65561e6b4 p3898: Bridge driver for MAX96751
Implemented the bridge driver
for MAX96751 HDMI serializer.
In initial version following
features were added.

1) Bring serializer into functional state
2) Drive the RCLKOUT
3) Power management operations

Bug 4069908

Change-Id: Ifbfe5fed3eba5b35303a5072d7eb5935884f1a0f
Signed-off-by: Sagar Tyagi <satyagi@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2905398
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Shu Zhong <shuz@nvidia.com>
2023-08-16 06:38:07 -07:00
Jian-Min Liu
f36fdd5baf Revert "Ensure virtualization macro are defined with ACK"
This reverts commit 9a53ca82d0.

The CONFIG_TEGRA_VIRTUALIZATION defined in the top-level Makefile
can be effective in the ACK build after refined make cmd.

Bug 4187941
Bug 4223187

Signed-off-by: Jian-Min Liu <jianminl@nvidia.com>
Change-Id: Ide57f77b6d82770d9a1eeeb91c25e0b34d5911f0
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2954801
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-08-14 01:55:07 -07:00
Bruce Xu
db10888783 nvidia-oot: set/clear vm_flags via function
In new kernel, need to update vm_flags via kernel
provided function. Otherwise below error is met:
./include/linux/mm_types.h:476:20: note: non-static data member
'vm_flags' declared const here
                const vm_flags_t vm_flags;
                ~~~~~~~~~~~~~~~~~^~~~~~~~
1 error generated.

Bug 4196760

Change-Id: I03455af7ce3623d0d8a0f0cd56d569ef3c7af9ea
Signed-off-by: Bruce Xu <brucex@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2938942
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-11 05:19:43 -07:00
Sahil Mukund Patki
61af983ca4 tsec: fix coverity defect
Issue:
Unchecked return value for clk_prepare_enable function.

Fix:
Add check for return value of clk_prepare_enable function and take
proper action in case of error.

CID 10162292

Bug 3952896

Change-Id: I2f3a75d028fbed2f855b72d2efc9a30844b8c336
Signed-off-by: Sahil Mukund Patki <spatki@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2950809
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-08 20:56:29 -07:00
Johnny Liu
c983eec625 drivers: pva: skip vpu load reading when suspended
WHen PVA is already suspended, there is no need to resume the device
through nvhost_module_busy and send mailbox request to PVA for VPU load
reading. It avoids switching CV power domain on and off.

Bug 4168798

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Ib9ec4d4ded2b96ee8f76267e190087612d1e0468
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2946818
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Ninad Malwade <nmalwade@nvidia.com>
Reviewed-by: Omar Nemri <onemri@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-08 06:47:35 -07:00
Ketan Patil
edf9d114e1 video: tegra: nvmap: Don't perform repetitive ioremap
__ioremap function called during cache maint takes more time in case of
multiple processes compared to single process. This is impacting camera
tests when multiple cameras are used. For carveouts, nvmap performs page
by page ioremap and then cache maint on it. Optimize this with following
steps:
- During first cache_maint of the buffer, perform ioremap on entire
buffer and save the kernel V.A.
- Next time, when cache_maint is called on the same buffer, we will
reuse the saved kernel V.A.

Bug 3922175

Change-Id: Iecb372365409de1951bcc8e6f3d8e8e867bb2a80
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2948759
Reviewed-by: Barton Xu (SW-TEGRA) <bartonx@nvidia.com>
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-07 05:01:37 -07:00
Akshata
410b23ffce dla: kmd: Update logic for single DLA boards
+ Added logic to enumerate single instance DLA as
DLA0 for Linux builds

Bug 4165116

Change-Id: If01bfa98a9bcef02270056d786e4574785a46850
Signed-off-by: Akshata <akshatab@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2945452
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: Arvind M <am@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-03 20:27:56 -07:00
omar
058bb1ad7f drivers: pva: add checks on block height
Block height has valid values > 0 and < 6. Add checks to validate
values to be legal.

Additionally, a value of 0xff indicates channel has no block linear
transfer descriptors.  0xff to be converted to 0.

Bug 4185281

Change-Id: I8a2ff03a4098a27eb0ad6a773abbb50a2cbc50a7
Signed-off-by: omar <onemri@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2944683
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-02 14:13:53 -07:00
Ketan Patil
6b88806712 video: tegra: nvmap: Do not recycle handle id immediately
xa_alloc can return the handle id which was freed recently. Instead,
once handle id is provided, next time start from next handle id. Once
max limit is reached then start from U32MAX / 2 again.

Bug 4171509

Change-Id: Ib5678136835e809632e4a2498b4dffe522e56c8d
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2942022
(cherry picked from commit 2927da12a16d69d2bc49d3a6e910abefefd77f5b)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2942016
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-02 14:05:09 -07:00
Jian-Min Liu
9a53ca82d0 Ensure virtualization macro are defined with ACK
The "subdir-ccflags-y += -DCONFIG_TEGRA_VIRTUALIZATION" defined in the
top-level Makefile seems to be ineffective in the ACK build, so it is
redefined in each local Makefile.

Bug 4187941

Change-Id: I47c515a20704736ea44881b65c59639bf8242760
Signed-off-by: Jian-Min Liu <jianminl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2942314
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-01 12:38:09 -07:00
omar nemri
8e837b02d4 drivers: pva: add buffer serial id for fences
in order to support unique identification of semaphores
while tracing across VMs, a unique identifier is added
during buffer pin and is emitted in traces.

Bug 4149342

Change-Id: I88e53be197f5354834795aab197e8de39535ac5c
Signed-off-by: omar nemri <onemri@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2938555
Reviewed-by: Nikita Chumakov <nchumakov@nvidia.com>
Reviewed-by: Oleg Sikorskiy <osikorskiy@nvidia.com>
Reviewed-by: Amruta Sai Anusha Bhamidipati <abhamidipati@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-21 12:09:54 -07:00
Akshata
e1ea98691b dla: kmd: Update resource utilization logic
+ Return 0% resource utilization when DLA
is turned off

Bug 4170503

Change-Id: Iaeb6131dc482a750cae1d54b6931e3dd8c9192d0
Signed-off-by: Akshata Bhat <akshatab@nvidia.com>
(cherry picked from commit 4da14f6b3b80f49ca00c92322ad71d75c8bfd4cd)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2929821
Tested-by: Ninad Malwade <nmalwade@nvidia.com>
Reviewed-by: Ninad Malwade <nmalwade@nvidia.com>
Reviewed-by: Arvind M <am@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-16 04:35:47 -07:00
Jon Hunter
74b186dc9e drivers: pva: Fix compilation error
When building the PVA driver with GCC 13 the following error is
observed ...

 drivers/video/tegra/host/pva/pva.c:1366:13:
  error: the comparison will always evaluate as ‘true’ for the address
  of ‘clk_cap_kobj’ will never be NULL [-Werror=address]
 1366 |         if (&pdata->clk_cap_kobj) {
      |             ^

The 'clk_cap_kobj' member of 'nvhost_device_data' structure is not a
pointer to a structure but a structure and so the address of the
structure is always true. Fix this by testing if the address of the
'clk_cap_attrs' member which is a pointer to memory that is
allocated.

Bug 4190030

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: Iafe0da2a59f55420aa96ebc985c5352dfbed9c74
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2934461
Reviewed-by: Omar Nemri <onemri@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-12 19:09:08 -07:00
Jon Hunter
9b40e459a1 nvdla: kmd: Fix compilation error
When building the DLA KMD driver with GCC 13 the following error is
observed ...

 drivers/video/tegra/host/nvdla/nvdla.c: In function ‘nvdla_remove’:
 drivers/video/tegra/host/nvdla/nvdla.c:1229:13:
   error: the comparison will always evaluate as ‘true’ for the address of
   ‘clk_cap_kobj’ will never be NULL [-Werror=address]
 1229 |         if (&pdata->clk_cap_kobj) {
      |             ^

The 'clk_cap_kobj' member of 'nvhost_device_data' structure is not a
pointer to a structure but a structure and so the address of the
structure is always true. Fix this by testing if the address of the
'clk_cap_attrs' member which is a pointer to memory that is allocated.

Bug 4190030

Change-Id: I8200155b4c0becab51924bcb4357c30163f62666
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2934411
Tested-by: Ninad Malwade <nmalwade@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Ninad Malwade <nmalwade@nvidia.com>
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: Arvind M <am@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-12 19:09:03 -07:00
Jon Hunter
deffbf24ab virt: tegra: Ensure functions stubs are defined
When building the out-of-tree drivers with virtualization support
disabled, symbols for some of the virtualization functions are not found
...

 nvgpu: Unknown symbol tegra_hv_mempool_unreserve (err -2)
 nvgpu: Unknown symbol is_tegra_hypervisor_mode (err -2)
 nvgpu: Unknown symbol tegra_hv_mempool_reserve (err -2)
 nvhost_pva: Unknown symbol is_tegra_hypervisor_mode (err -2)
 mc_utils: Unknown symbol is_tegra_hypervisor_mode (err -2)
 mc_utils: Unknown symbol is_tegra_hypervisor_mode (err -2)

Update the hv-ivc.h header to ensure that these function stubs are
defined when virtualization support is disabled and only build the
hv-ivc driver if virtualization is enabled.

Finally, move populating the ccflags to the top-level Makefile and use
the subdir-ccflags directive to ensure the ccflags are passed to all
sub-directories.

Bug 4159372
Bug 4170085

Change-Id: I35edb91007524c3143dff7564f9ad545bd34e969
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2921199
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-07-05 14:34:15 -07:00
Ashish Mhetre
9207ceb10a video: tegra: nvmap: Add support for sgt caching
Deferred dmabuf unmapping is being removed from kernel.
So, add similar support to cache sgt in NvMap.
During map_dma_buf() call, NvMap will create a mapping and an sgt
corresponding to it. It will also cache this sgt.
When unmap_dma_buf() is called for same sgt, NvMap will not unmap
the mappings. It will simply return from there.
Next time when the mapping request comes for same dmabuf, it will
look for existing sgt in cache and return it. This significantly
reduces mapping overhead for same buffer when it's mapped and unmapped
multiple times.
Free the sgt and unmap only when corresponding buffer is freed. When
all references from a buffer are removed, dmabuf_release() will be
called where sgt will be freed.

Bug 4064339

Change-Id: I7ed767ecaaac7aa44e6576e701b28537b84986ec
Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2925224
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-03 21:14:42 -07:00
Jon Hunter
ad2857ccaa soc/tegra: Clean-up fuse-helper
The option CONFIG_TEGRA_FUSE_UPSTREAM is not needed any longer because
we always want to enable this for Linux v5.15. Therefore, remove this
option completely.

The function tegra_fuse_control_read() is not used anywhere and so we
can also remove this too.

Bug 3777983

Change-Id: I37888bc1f615f72b245c027e5c1a9251aca08af4
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2925233
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-03 15:08:36 -07:00
Akshata
25b08cb82d dla: kmd: Update fuse register read for K5.15
+ Enabled the logic to read the DLA Fuse registers
directly for K5.15
+ Required for setting up the correct DLA instance on
fused boards like TA983

Bug 4156086

Change-Id: I23addb28c54466979fd88a1b3c65960b10f946ca
Signed-off-by: Akshata Bhat <akshatab@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2929422
Reviewed-by: Maxim Grigoriev (SW-GPU) <maximg@nvidia.com>
Reviewed-by: Arvind M <am@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-01 13:42:26 -07:00
omar
fbcd05f070 drivers: pva: fix desc check with bl and hwseq
when hw sequencer is in use, BL format is supported and
block height log2 needs to be retrieved form channel.

*retrieve block height information while walking descriptor list.

Bug 4166395

Change-Id: Ie6f71c107b74eb01a547baf24ff621ac3446d522
Signed-off-by: omar <onemri@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2929277
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Lachlan Dowling <ldowling@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-30 18:02:05 -07:00
omar
2e1f1dca9e drivers: pva: fix coding style violations
fix various coding style errors and warnings

Bug 4096967

Change-Id: If31fb063a19df8a3329710899b349019508dcd15
Signed-off-by: omar <onemri@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2929265
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-30 18:02:00 -07:00
omar
3de8696710 drivers: pva: HW seq security checks
Add HW Sequencer security checks and fix block linear
addressing checks.

Bug 4124717
Bug 4096967

Change-Id: I5bf359eda678f1267127748353941606c527f691
Signed-off-by: omar <onemri@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2923245
Reviewed-by: Lachlan Dowling <ldowling@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-24 14:16:48 -07:00
Laxman Dewangan
44ece33f27 drivers: Remove Kconfigs
There is no need of the CONFIG_* for oot modules
and hence remove the Kconfig from modules
directory.

Bug 4078035

Change-Id: I78ca8b7f123fb92c410e8443c4056a67dcf280b5
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2923232
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-22 23:39:27 -07:00
Keyur Sheth
4c53e849c3 drivers: pva: specific error for VPU app auth
In case of VPU app authentication failure,
return a specific error code EACCES to
userspace.

Bug 4132218

Change-Id: I14fd39858c4d2aae5afe1246961a39c3a1df4bff
Signed-off-by: Keyur Sheth <ksheth@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2923768
Reviewed-by: Vivek Bangera <vbangera@nvidia.com>
Reviewed-by: Yogesh Solanke <ysolanke@nvidia.com>
Reviewed-by: Omar Nemri <onemri@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-22 11:24:05 -07:00
brucex
bf7d14249c nvidia-oot: enable hypervisor support for nvmap
hypervisor macro CONFIG_TEGRA_VIRTUALIZATION is not enabled
for OOT nvmap build.

Bug 4121631

Change-Id: I8a1fc94335da8ca7a22d549b0e1850dd308722b8
Signed-off-by: brucex <brucex@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2921005
Reviewed-by: Tuomas Kulve <tkulve@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-20 02:20:49 -07:00
omar
94b8c1c354 drivers: pva: add power management
add power management support for pva module.
* return busy if queues are not empty
* call nvhost PM APIs where no deviation is needed

Bug 4154352

Change-Id: Iab8b1653f4e0713f94129cd58f917927f1a50127
Signed-off-by: omar <onemri@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2920784
(cherry picked from commit 29b820b6c2eac9485aee281a64713e54db35d9bf)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2922565
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-19 17:39:04 -07:00
Matti Ryttylainen
f19d5372b4 camera: Switch VI/ISP events to ftrace
* Switch VI frame_begin and frame_end events to produce ftrace traces
instead of eventlib events.
* Switch ISP task_begin and task_end events to produce ftrace traces
instead of eventlib events.
* Add class IDs for VI/ISP
* Switch VI/ISP task_submit events to ftrace

Bug 4080214

Signed-off-by: Matti Ryttylainen <mryttylainen@nvidia.com>
Change-Id: I7776005bb89eaed168c65c62d8aa19c553559fdb
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2911804
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Reviewed-by: Jukka Kaartinen <jkaartinen@nvidia.com>
Reviewed-by: Oleg Sikorskiy <osikorskiy@nvidia.com>
Reviewed-by: Ajith Kumar <ajithk@nvidia.com>
Reviewed-by: Sudhir Vyas <svyas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-19 12:28:58 -07:00
Jon Hunter
c59b9a9a26 video: tegra: camera: Removed unused source file
The source file tegra_camera_dev_mfi.c is not used and so remove it from
the camera driver source tree.

Change-Id: I61c00d0d1debb76aad83e268fde43203ad87c1fb
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2913271
Reviewed-by: Matti Ryttylainen <mryttylainen@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-15 12:16:33 -07:00
Vedashree Vidwans
3ee67f0ee5 host1x: do not use CONFIG_TEGRA_SOC_HWPM
OOT kerel builds do not use Kconfig files to define required
config flags. Thus, CONFIG_TEGRA_SOC_HWPM is not defined for OOT
configs. Remove use of CONFIG_TEGRA_SOC_HWPM flag from PVA, DLA
and FLCN drivers.

For OOT builds, HWPM driver is always compiled independent of
CONFIG_TEGRA_SOC_HWPM flag. For safety builds where HWPM
functionality is not allowed, mock HWPM functions will be used.

Bug 4061775

Change-Id: I49d8df6d3293e9bde9e233561363872fc41742f4
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2920819
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Adeel Raza <araza@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-15 12:16:28 -07:00
Ankita Garg
ce92834cc3 pva: Disable pva in android
Disable pva module to avoid build error when using clang
to build Android Common Kernel (ACK).

Bug 3974840

Change-Id: Ia0b5cee850355e7bbe9b7175a32b5aaddfd2be38
Signed-off-by: Ankita Garg <ankitag@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2915981
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jian-Min Liu <jianminl@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jian-Min Liu <jianminl@nvidia.com>
2023-06-13 00:24:36 -07:00
Ketan Patil
01db38f08e video: tegra: nvmap: Add support for Serial Id feature
Add support for Serial Id feature which will be used by Nsight for
buffer tracking purpose. This feature expects a unique serial id per
buffer even if it is shared across multiple client processes.
Add following code:
- Create a new global counter field for serial id in nvmap device.
Initialize it to 0 when nvmap device is initialized.
- Introduce a new field for serial_id in nvmap_handle struct.
- When nvmap_handle is created, assign it's serial_id field with global
counter's value, and increment global counter.
- During NvRmMemQueryHandleParameters return this serial_id associated
with the handle.
- Do not decrement counter for serial_id even after freeing the handle.

Bug 4138373

Change-Id: Ic1fe22b082eefb352986f8fa44d4c38d186a366f
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2918510
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-06-10 19:46:37 -07:00
Jian-Min Liu
1fead62f11 nvmap: Explicitly import fs symbol for ACK
Android Common Kernel (ACK) places restrictions on the use of symbols
like close_fd, kernel_write, filp_open, etc, exported by the fs
subsystem. These symbols have to be explicitly imported using
MODULE_IMPORT_NS to avoid build errors. Eventually, synbol usage needs
to be deprecated.

Bug 3974840

Change-Id: Iea8518162c97062b205e80bf4b81c35c873b7729
Signed-off-by: Jian-Min Liu <jianminl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2915728
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2023-06-09 05:35:16 -07:00
omar nemri
4cff480dc1 drivers: pva: combine trace definitions
Currently there is an ftrace definition for pva
that is called nvhost_pva.  combine into tegra_pva
ftrace dfinition with include file nvpva_ftrace.h.

Bug 3829397

Change-Id: I0bffdfedad9d5010ef47ffe3f2639c1e162286b1
Signed-off-by: omar <onemri@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2914938
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-06 02:09:29 -07:00
Akshay Tigga
506ac0dcea Remove nvhost-vi5.o from ACK build
Including nvhost-vi5.o in ACK build gives
the following errors :
ERROR: modpost: "vi_channel_drv_fops_register" undefined!
ERROR: modpost: "tegra_vi_media_controller_cleanup" undefined!
ERROR: modpost: "vi_channel_drv_unregister" undefined!

Bug 3974840

Change-Id: I85050b229eab88e60a02d244c95b9dad0a5b6851
Signed-off-by: Bruce Xu <brucex@nvidia.com>
(cherry picked from commit eea31fd3f7b941c124f210278d878b42f6edf469)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2910056
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Ankita Garg <ankitag@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Ankita Garg <ankitag@nvidia.com>
2023-06-03 19:17:01 -07:00
Akshay Tigga
327bc17760 Remove nvhost-nvcsi-t194.o from ACK build
Including nvhost-nvcsi-t194.o in ACK build gives
the following errors :
ERROR: modpost: "tegra_csi_media_controller_remove" undefined!
ERROR: modpost: "tegra_csi_media_controller_init" undefined!
ERROR: modpost: "csi5_fops" undefined!

Bug 3974840

Change-Id: Iad263a8aa0cef443dd4629d52417e5d104baf9fa
Signed-off-by: Bruce Xu <brucex@nvidia.com>
(cherry picked from commit ef3dfca356c6d41ca6a9a590d0bec861aeb50b41)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2910055
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Ankita Garg <ankitag@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Ankita Garg <ankitag@nvidia.com>
2023-06-03 19:16:57 -07:00
Akshay Tigga
e965326be0 Remove nvhost-isp5.o in ACK build
Including nvhost-isp5.o in ACK build gives
these errors :
ERROR: modpost: "isp_channel_drv_register" undefined!
ERROR: modpost: "isp_channel_drv_init" undefined!
ERROR: modpost: "isp_channel_drv_exit" undefined!
ERROR: modpost: "isp_channel_drv_unregister" undefined!

Bug 3974840

Change-Id: Iadf8042e857e5083e19773ff1cc071382db75c9c
Signed-off-by: Bruce Xu <brucex@nvidia.com>
(cherry picked from commit d8dc0c2b04c86720e0de0db7c469cc19bce6a9c3)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2910054
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Ankita Garg <ankitag@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Ankita Garg <ankitag@nvidia.com>
2023-06-03 19:16:52 -07:00
omar
3fda4da5d8 drivers: pva: use ftrace instead of eventlib
deprecate use of eventlib and use ftrace instead
for reporting task statistics.

pass prog and stream ID to ftrace events.

Bug 4080222

Change-Id: Id304baba109cde5392f3f297a745c8084b07613a
Signed-off-by: omar <onemri@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2911268
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Nikita Chumakov <nchumakov@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-30 12:18:45 -07:00
Matti Ryttylainen
c9146a4fd9 camera: Enable deferred unmapping for vi/isp
Enable deferred dma buffer unmapping for vi/isp devices

Bug 4067905

Change-Id: I193f762d580d1e0477137f57195b2cb81d4b9d91
Signed-off-by: Matti Ryttylainen <mryttylainen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2910545
Tested-by: Ashish Mhetre <amhetre@nvidia.com>
Reviewed-by: Ashish Mhetre <amhetre@nvidia.com>
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: Kalle Jokiniemi <kjokiniemi@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-29 04:03:27 -07:00
omar
8a8d6ba182 drivers: pva: boot parameters to FW in mailboxes
Change FW boot to not program segment registers directly.
Instead the values are passed in mailboxes at boot time and
FW will progbram the registers.

In virtualized environments, KMD will not have access to these
registers.

Bug 3971973

Change-Id: Iea935cbb9fb7898d229935da7b6495a325f24356
Signed-off-by: omar <onemri@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2899228
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2908814
2023-05-24 08:49:31 -07:00
Jon Hunter
9a3174280f platform: tegra: Remove CVNAS driver
The CVNAS driver is not needed for Tegra234 and future devices. Remove
the CVNAS driver and support for CVNAS from DLA, NVMAP and PVA dirvers.

Bug 4037930

Change-Id: I5d1ae3c195485cb094f9b9b480f91d81fd04687c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2903848
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-05-23 20:56:08 -07:00
Ashish Mhetre
db78501061 video: tegra: nvmap: Adding NvMap config for deferred unmap
Add NvMap config for enabling/disabling deferred dma-buf unmapping.
Keep it disabled by default and enable it based on
CONFIG_DMABUF_DEFERRED_UNMAPPING.

Bug 4067905
Bug 4115589

Change-Id: Ib1ee63cdd61a346f2f9894bb3caf406ae5f159c5
Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2905251
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>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-22 06:37:37 -07:00
Akshata
2e59846460 nvdla: kmd: Add ftrace support
+ Replace eventlib with ftrace for Linux-OOT kernel
+ Added event logging for:
 * job_submit
 * job_prefence
 * job_postfence
 * job_timestamps

JIRA DLA-6820

Change-Id: I4d1ad1b535b2422257e9e1dce8d94ee317c65feb
Signed-off-by: Akshata Bhat <akshatab@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2906273
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: Arvind M <am@nvidia.com>
Reviewed-by: Ken Adams <kadams@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-20 07:31:01 -07:00
Laxman Dewangan
6496e807ed nvpva: Enable TEGRA_FUSE_UPSTREAM
For OOT module build, enable TEGRA_FUSE_UPSTREAM
default.

Bug 4116692

Change-Id: Ib0a8cd983983b0581050634265bf0771f578a2c3
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2904019
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-05-15 06:11:01 -07:00
Laxman Dewangan
83c26ab1fc nvdla: Enable TEGRA_FUSE_UPSTREAM
For OOT module build, enable TEGRA_FUSE_UPSTREAM
default.

Bug 4116692

Change-Id: Ia9a63519c240d874fbbeb126945ef28f79452421
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2904018
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: Arvind M <am@nvidia.com>
2023-05-15 06:10:52 -07:00