Commit Graph

1805 Commits

Author SHA1 Message Date
Ketan Patil
6937db210f video: tegra: nvmap: Add CBC carveout support
- Add CBC carveout suport in nvmap.
- Chunk size for CBC is 2MB, hence each bit from bitmap for CBC carveout
indicate 2MB physically contiguous chunk.
- In case of allocation from CBC, first try to allocate the entire chunk
in physically contiguous manner, if it's not possible then allocate in
chunks of 2MB. All page pointers to these chunks will be stored in
nvmap_handle struct.
- Modify all other operations like vmap, kmap, mmap as per the above
restrictions.

Bug 3956637

Change-Id: I7c304b0127c8fef028e135a4662ab3ad3dc1d1f6
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2880662
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2885806
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-04-12 04:32:35 -07:00
Gerrit Code Review
7e15a9bb58 Merge "nvmap: Merge nvmap driver from kernel/nvidia to kernel/nvidia-oot" into dev-main 2023-04-12 04:32:30 -07:00
Gerrit Code Review
91a65bdf7d Merge "dp-serializer: Merge dp-serializer driver from kernel/nvidia to kernel/nvidia-oot" into dev-main 2023-04-11 11:17:29 -07:00
Ketan Patil
5aabb64157 video: tegra: nvmap: Resolve incorrect check
When NvRmMemHandleFromIVCId is called, it is expected that we mark the
bitmap from same position from where the buffer was allocated by the
producer VM. Update the check as per above expectation.

Bug 3990914

Change-Id: I1f7baa3f21f7b2baf28dda3808f8a45515d120da
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2867746
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Austin Tajiri <atajiri@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_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
678dc695bb video: tegra: nvmap: Fix data race for RO dma-buf
When one process is trying to duplicate RO handle while other process is
trying to free the same RO handle, then race can occur and second
process can decrement the dma-buf's refcount and it may reach to 0. The
first process can then call get_dma_buf on it, leading to NULL pointer
dereference and ultimately to kernel panic. Fix this by taking an extra
dma-buf refcount before duplicating the handle and then decrease it once
duplication is completed.

Bug 3991243

Change-Id: I99901ce19d8a5d23c5192cb10a17efd2ebaf9d3a
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2865519
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Jon Hunter
eb15c0f8cf video: tegra: nvmap: Fix build for Linux v6.3
Upstream Linux commit bc292ab00f6c ("(HEAD) mm: introduce vma->vm_flags
wrapper functions") breaking building the NVMAP driver because the
vm_flags variable is made a const and can no longer be set directly. Fix
the build for Linux v6.3 by using the helper functions for setting the
flags.

Bug 4014315

Change-Id: I52a323a995f5f9ffa8c3356a134c4cf2542e967f
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2867138
Reviewed-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
8a01798884 video: tegra: nvmap: Fix overflow condition
When the carveout size is changed to 2GB, mem->size << PAGE_SHIFT will
overflow the int limit and get wrapped to negative value. Hence
during freeing bitmap, one of the comparison condition is not meeting,
resulting into not freeing bitmap. Ultimately the entire bitmap get
consumed even though it is expected to have empty bits. Fix this by
typecasting the size to u64.

Bug 3962552

Change-Id: Ieaf93a3a91062d3f630921259aa9b3935853e91c
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2861614
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
fd4635f259 video: tegra: nvmap: Update contig flag check
NvRmMemQueryHandleParameters is returning contig flag as false for
handle allocated from generic carveout. Update the contig flag check:
If handle belongs to IOVMM heap then check if it has flag set for
contiguous memory allocation request. Otherwise, if handle belongs to
any carveout then all allocations are contiguous, hence set contig flag
to true.

Bug 3960596

Change-Id: Ic23395942cde2b16f590a44091acfee1b3e59cab
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2851758
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: Ashish Mhetre <amhetre@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
9fdb78226d video: tegra: nvmap: Fix data race for RO dma-buf
There is a potential data race for RO dma-buf in the following scenario:
------------------------------------------------------------------
Process 1            | Process 2            | Process 3           |
------------------------------------------------------------------|
AllocAttr handle H1  |                      |                     |
MemMap (H1)          |                      |                     |
AllocAttr(H2)        |                      |                     |
MemMap(H2)           |                      |                     |
id1 = GetSciIpcId(H1)|                      |                     |
id2 = GetSciIpcId(H2)|H3=HandleFromSciIpcId |                     |
id3 = GetSciIpcId(H1)| (id1, RO)            |H4=HandleFromSciIpcId|
MemUnmap(H2)         |QueryHandlePararms(H3)|(id2, RO)            |
MemUnmap(H1)         |MemMap(H3)            |QueryHandleParams(H4)|
HandleFree(H2)       |MemUnmap(H3)          |MemMap(H4)           |
HandleFree(H1)       |HandleFree(H3)        |H5=HandleFromSciIpcId|
                     |                      |(id3, RO)            |
                     |                      |QueryHandleParams(H5)|
                     |                      |MemMap(H5)           |
                     |                      |MemUnmap(H4)         |
                     |                      |MemUnmap(H5)         |
                     |                      |HandleFree(H4)       |
                     |                      |HandleFree(H5)       |
-------------------------------------------------------------------

The race is happening between the HandleFree(H3) in process 2 and
HandleFromSciIpcId(id3, RO) in process 3. Process 2 tries to free the
H3, and function nvmap_free_handle decrements the RO dma-buf's counter,
so that it reaches 0, but nvmap_dmabuf_release is not called immediately
because of which the process 3 get's false value for the following check
if (is_ro && h->dmabuf_ro == NULL)
It results in calling nvmap_duplicate_handle and then meanwhile function
nvmap_dmabuf_release is called and it makes h->dmabuf_ro to NULL. Hence
get_dma_buf fails with null pointer dereference error.

Fix this issue with following approach:
- Before using dmabuf_ro, take the handle->lock, then check if it is not
NULL.
- If not NULL, then call get_file_rcu on the file associated with RO
dma-buf and check return value.
- If return value is false, then dma-buf's ref counter is zero and it is
going away. So wait until dmabuf_ro is set to NULL; and then create a
new dma-buf for RO.
- Otherwise, use the existing RO dma-buf and decrement the refcount
taken with get_file_rcu.

Bug 3741751

Change-Id: I8987efebc476a794b240ca968b7915b4263ba664
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2850394
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ashish Mhetre
ae282d2c22 video: tegra: nvmap: Fix error pointer dereference
In nvmap_try_duplicate_by_ivmid(), the return pointer from
nvmap_duplicate_handle() is getting dereferenced without checking
whether the pointer is error or valid. This is causing kernel panic.
Fix this by checking if the return pointer is invalid then return error.

Bug 3766497

Change-Id: I010893c9ebda60e313c4f776044a123073399ef2
Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2846180
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Ketan Patil <ketanp@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_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
afb7cce70c video: tegra: nvmap: Fix kmemleak issues
While unloading the nvmap module, the memory allocated by following
functions should be freed, otherwise it results into kmemleak:
- nvmap_dma_init_coherent_memory
- dev_set_name

Bug 3860404

Change-Id: I7cd187c259ad2ceca0262154c0fb7fe8aedcfac8
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2844474
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-11 05:54:22 +00:00
Hans-Christian Noren Egtvedt
76d402ab77 tegra:nvmap: do not export symbol for init functions
We can not EXPORT_SYMBOL() on functions marked __init, since they will
not be available once the kernel has done running through init level.
Hence remove the EXPORT_SYMBOL() calls.

Bug 3806590

Change-Id: Ie9fd26fa7220a287b8467aaf6efe03af4427d052
Signed-off-by: Ken Chang <kenc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2782502
(cherry picked from commit ad100e16945b064086d44211adae522208ad5664)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2840504
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
a588f61b8e video: tegra: nvmap: Remove use of bitmap_allocate_region
NvMap is using bitmap_allocate_region while doing allocation from IVM
carveout. It expects size to be always power of 2, this is resulting
into memory shortage. Better way to handle this is to use the function
bitmap_find_next_zero_area which expects bitmap size rather than order.
Then use bitmap_set to set the allocated bits from the bitmap.
Similarly, while freeing the buffer, use bitmap_clear instead of
bitmap_release_region.

Bug 3923812

Change-Id: I91005d16f678405f341c4fc620509f56af538e1c
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2839848
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Ashish Mhetre <amhetre@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
e3a44ab6e8 video: tegra: nvmap: Fix kmemleak issue
get_task_struct increment the ref count over task struct, and it will be
decremented as part of put_task_struct. task_struct won't be freed
unless it's refcount becomes 0. Hence the missing put_task_struct in
nvmap code was resulting into kmemleak. Fix it by add this missing call.
Also, mutex_unlock was missing in one of the return path, add it.

Bug 3901618

Change-Id: I630eac19e628a549179a8ddaad86ad4d2c9b9a53
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2837383
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Ashish Mhetre <amhetre@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
85f7def3a6 nvmap: Don't free pages while freeing subhandle
This patch fixes the following issues:
- When the handle associated with the sub-buffer is freed, the call to
the nvmap_page_pool_fill_lots is made, which would free the pages when
the refcount on the pages is > 1, even though the main handle is not
freed, hence add a check for sub-handle.
- In cpu unmap code, list_for_each_entry is used for iterating over the
vma list and in the same loop list_del is aldo being called, this can
lead to undefined behavior, instead use list_for_each_entry_safe which
is safe against removal of list entry.
- Mutex of sub-handle is not initialized, fix it by initializing it.
- Set error value when handle creation failed.

Bug 3494980

Change-Id: I0659d7f70b44814e87e3081702352e891d9191f7
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2824668
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
abb244025f nvmap: Fix coherency issues while creating subhandle
Make sure that all handles, from which sub-buffer handle needs to be
created, have same cache coherency, are of type RW, not created from VA.
Set the cache coherency of the sub-buffer handle same as the cache
coherency of the main handles, so that explicit cache flush is not
needed during vma fault.

Bug 3494980

Change-Id: I878568e4cdc4529fb3d1a6682e38798769dad9c0
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2819129
Reviewed-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-by: Krishna Reddy <vdumpa@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_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
ec9ee786c4 nvmap: Add traces for big pages in page pool
There are no traces present for allocating big pages from page pool,
this is limiting the debug ability for some of the memory leak bugs.
Hence add traces for such operations.

Change-Id: I6cece3fd796c5c3e37f87647a1635274a654d727
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2820607
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
ad02c6afa5 nvmap: Use same nvmap client for namespaces in a process
Some of the libraries may be linked into different namespaces, but they
belong to same process. So each namespace can open the /dev/nvmap node
and call nvmap ioctls, instead of reusing the already opened /dev/nvmap
FD. Because of this, memory handles created by one namespace can't be
used by other namespaces, even though they belong to same process.

Fix this issue by following:
- When /dev/nvmap node is opened, check if there is already any nvmap
client with same pid, if yes use that client; otherwise, create new
nvmap client.
- Track the number of namespaces via count field.
- When /dev/nvmap node is closed, destroy the nvmap client only when
count reaches to 0.

Bug 3689604

Change-Id: I4c91db36b88e78b7526dd63b006e562c8f66c7ae
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2819915
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-by: Ivan Raul Guadarrama <iguadarrama@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ashish Mhetre
ac3205e61e video: tegra: nvmap: Make NvMap load based on DT
Add MODULE_DEVICE_TABLE() for NvMap match table so that depmod
automatically loads the driver based upon the NvMap compatible
string.

Bug 3851361

Change-Id: I04fabae9787f5cc0f85239ae40f42cd5a5fec88e
Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2809441
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Ketan Patil <ketanp@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_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
d5be3dd31c nvmap: Fix type casting issue
CERT-C is reporting following issue:
- Casting entry->sci_ipc_id from unsigned long long to unsigned int
without checking its value may result in lost or misinterpreted data.
Fix this by changing the data type of sid to u64.

CID 587909
Bug 3745813

Change-Id: I899db1feff8b6f9b175f4a93cab068a3d7a0c88f
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2816557
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_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
4c2cec49e9 nvmap: Fix type casting issue
CERT-C is reporting following issue:
- Casting nvmap_dev->pool.count + nvmap_dev->pool.to_zero from unsigned
int to int without checking its value may result in lost or
misinterpreted data.
Fix this by changing the data type of total to unsigned long.

CID 456842
Bug 3745813

Change-Id: Idf949ae4cb8691b8ec701a35d478bcb7b517582c
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2816556
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_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
eeae4f63b9 nvmap: Fix type casting issue
CERT-C is reporting following issue:
- Casting dev->nr_carveouts from int to unsigned int without checking
its value may result in lost or misinterpreted data.
Fix this by changing data type of i to int.

CID 490652
Bug 3745813

Change-Id: I35a6837e7356c6b4f3dcd369bed2eac061f44e2e
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2816554
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-11 05:54:22 +00:00
Puneet Saxena
c4a88d6515 tegra: nvmap: dmabuf fd for range from list of handles
It returns dmabuf fd from list of nvmap handles
for a range between offset and size.

The range should fall under total size of all of the handles.
Range may lie between sub set of handles.

Bug 3494980

Change-Id: I5c688f832a7a3bb0b6e3713ec6462224bb6fbfc5
Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2789431
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-11 05:54:22 +00:00
Jon Hunter
f1e2cd8dea video: tegra: nvmap: Remove unused code
The function __nvmap_kmap() is only supported for Linux kernels prior to
v5.4 and so we can remove the code in the function for kernel greater or
equal to Linux v6.0.

Bug 3767126

Change-Id: Ice2384ce28f268ce453236db36fc82d6781eb716
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2809529
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
9045984efb nvmap: Remove use of __dma_flush_area
__dma_flush_area is defined in downstream, we need maintenance effort
when kernel version is upgraded. Instead, use arch_invalidate_pmem
function provided by the upstream.

Bug 3855165

Change-Id: Ie62935aba7f3c31e6e233816b3bff507197d3f86
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2804844
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
596156cc4b nvmap: Register nvmap device towards end of probe
On TOT, in nvmap probe function, platform_set_drvdata is called after
misc register. So nvmap node is created and clients can open it even
before platform driver data is set. Because of which, the call to
dev_get_drvdata returns NULL and BUG_ON condition is hit. Move misc
register call towards end of the nvmap probe, so that /dev/nvmap is
exposed once all initilization is completed.
As misc register being moved to end of probe, the functions which are
called before misc register and which make use of dev_user field from
nvmap_device for calling dev_err/dev_info function will see the dev
field as NULL. Hence replace such calls with pr_err/pr_info.

Bug 3853486

Change-Id: Ifdd8443812a621aceada7739cf9b02fcf00568b4
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2803672
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
92f34279ba nvmap: Keep cache flush at allocation time only
On TOT, in case of carveouts, nvmap performs cache flush operation
during carveout creation, buffer allocation and buffer release. Due to
cache flush for entire carveout at creation time, nvmap takes ~430 ms
for probe. This is affecting boot KPIs.
Fix this by performing cache flush only at buffer allocation time,
instead of carveout creation and buffer release. This is reducing nvmap
probe time to ~0.69 ms.

Bug 3821631

Change-Id: I54da7dd179f8d30b8b038daf3eceafb355b2e789
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2802353
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Ashish Mhetre <amhetre@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Puneet Saxena
d1c06c1dce tegra: nvmap: make sciipc_id as 64 bit
Make SciIpc_Id as 64 bit.

Bug 3715617

Change-Id: If0f6db9d42b527554b77c4768d0f42d276c6a97c
Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2783704
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Puneet Saxena
a3201ec3fe tegra: nvmap: add _dma_*area prototype
__dma_flush_area and  __dma_map_area
function's protype is removed from "cacheflush.h"
header file. Since these functions are defined locally
in NvMap, define prototype in nvmap_priv.h, private header.

Bug 3767126

Change-Id: Ibf21712fe9738e4b3d7c286ac6acfea550d9d8d7
Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2779048
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-11 05:54:22 +00:00
Puneet Saxena
a28927a2c2 tegra: nvmap: fix build for kernel 6.0
Fix build for kernel 6.0 onwards.
"register_shrinker" expects shrinker name,
hence pass the name string.

PAGE_KERNEL's Page Protection value needs to be set.

Bug 3767126

Change-Id: I71a54891999d0554eaccac6f37d0f1d9c2a65ace
Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2776872
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Ketan Patil
a2338fa761 video: tegra: nvmap: Fix type casting issue
CERT-C is reporting following issue:
- Casting (size + 4095UL & 0xfffffffffffff000UL) >> 12 from unsigned
long to unsigned int without checking its value may result in lost or
misinterpreted data.
Fix this by adding overflow condition.

CID 490676
Bug 3745813

Change-Id: I39b741b6150c12dcdd3de7c70bbcf89f8e692a23
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2778588
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: Pritesh Raithatha <praithatha@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Puneet Saxena
8ceb954814 tegra: nvmap: replace _dma_* and __iomap
__dma_flush_area, __dma_map_area and __iomap
functions are no more supported from kernel version
6.0 onwards.

Replace them by equivalent exported function in K-6.0 and
onwards.

Bug 3767126

Change-Id: I2b8d81271ed3696ae3d9306a311fe74622c2b611
Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2770928
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 05:54:22 +00:00
Laxman Dewangan
4cf8c80669 nvmap: Copy drivers and headers from kernel/nvidia
Copy the driver and header sources of the nvmap to
kernel/nvidia-oot from kernel/nvidia as part of
removing the dependency of kernel/nvidia for OOT drivers.

The latest (few) git history of the files copied are
	b7a355916 video: tegra: nvmap: Fix type casting issue
	2128c5433 video: tegra: nvmap: Fix type casting issues
	0cd082559 video: tegra: nvmap: Change peer vm id data type
	4bd7ece67 tegra: nvmap: mark ivm carveout pages occupied
	e86f3630a video: tegra: nvmap: Fix type casting issue
	c43a23e58 video: tegra: nvmap: Fix type casting issue
	ca1dda22e video: tegra: nvmap: Fix type casting issue
	1f567abfe video: tegra: nvmap: Fix wrap up condition
	29db4d31c video: tegra: nvmap: Remove unnecessary debugfs
	fe72f1413 video: tegra: nvmap: Remove get_drv_data() call
	3b0fc79e7 video: tegra: nvmap: Fix coverity defect
	3cc0ce41b video: tegra: nvmap: Fix coverity defect
	6da39e966 video: tegra: nvmap: Fix WARN_ON condition
	a16351ff1 video: tegra: nvmap: Remove dead code
	9993f2d2d video: tegra: nvmap: Update print level
	6066a2077 video: tegra: nvmap: Remove nvmap_debug_lru_allocations_show
	3cdf2b7ba video: tegra: nvmap: Add kernel version check
	716ded4fc video: tegra: nvmap: Initialize the return value
	9b6c1b4ab video: tegra: nvmap: Correct debugfs code
	33e70118b video: tegra: nvmap: Fix Cert-C error handling bug
	7b960ed79 video: tegra: nvmap: Fix Cert-C error handling bug
	945dc1471 video: tegra: nvmap: Fix Cert-C error handling bug
	31e572de2 video: tegra: nvmap: Fix Cert-C error handling bug
	1f25cbf68 video: tegra: nvmap: Fix Cert-C error handling bug
	fa5428107 video: tegra: nvmap: Remove nvmap_handle_get_from_fd
	df73f2208 video: tegra: nvmap: Protect kmap/kunmap code
	9842e7c6a video: tegra: nvmap: Remove t19x dma_buf map/unmap
	06dff1a8d video: tegra: nvmap: Remove unnecessary export symbols
	6f097f86b video: tegra: nvmap: Fix Cert-C error handling bug
	f14171608 video: tegra: nvmap: load nvmap for T23x compatible platforms
	266812814 video: tegra: nvmap: Get rid of NVMAP_CONFIG_KSTABLE_KERNEL
	1b38c0887 nvmap: Don't use NV_BUILD_KERNEL_OPTIONS
	0ab8dc032 video: tegra: nvmap: Reintroduce NVMAP_CONFIG_VPR_RESIZE
	cc8db9797 driver: platform: tegra: Separate out vpr code
	28955d95c video/tegra: nvmap: Enable build as OOT module
	876d1fbb8 video: tegra: nvmap: Remove IS_ENABLED check
	5ea30867a nvmap: Add support to build as module from OOT kernel
	a71ad020e video: tegra: nvmap: Protect tegra_vpr args under config
	e70061cc1 video: tegra: nvmap: Do not export cvnas_dev
	d2a26ff36 video: tegra: nvmap: Include missing header
	692e4f682 video: tegra: nvmap: Update page coloring algo
	2b9dbb911 video: tegra: nvmap: Check for return value
	de8de12b6 video: tegra: nvmap: Enable legacy init support
	65d478158 video: tegra: nvmap: Remove dependency of cvnas
	38bdd6f05 video: tegra: nvmap: Make nvmap as loadable module
	9668e410b video: tegra: nvmap: Enable handle as ID
	11c6cbd23 tegra: nvmap: Fix build for Linux v5.18
	fbd95c3ab linux: nvmap: change ivm_handle to u32
	eb1e2c302 video: tegra: nvmap: Fix NVSCIIPC support
	022689b29 tegra: nvmap: return error if handle as ID enabled but id is fd
	19e5106ed video: tegra: nvmap: Don't treat ivm as reserved mem carveouts

Bug 4038415

Change-Id: I7108aec3b8532fe79c9423c2835744b1213719e8
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-04-11 05:47:21 +00:00
Prafull Suryawanshi
819e83a8e3 video: bridge: max_gmsl: add superframe support
This change adds symmetric superframe support to maxim
gmsl dp serializer driver. This includes below -

1. Read device tree properties associated with superframe feature.
2. Calculate values for register from timings parameter.
3. Hardcode few values for 1080p mode as formula to calculate those
   not yet available.
4. Sanity check as only X-Y or Z-U dual view possible with current support.

Device tree settings which needs to enable

1. Superframe structure in display-timings structure like below

superframe-info {
    pipe_x_view: view-0 {
            x = <0>;
            y = <0>;
            width = <1920>;
            height = <1080>;
            hfront-porch = <24>;
            hback-porch = <40>;
            hsync-len = <16>;
            vfront-porch = <3>;
            vback-porch = <18>;
            vsync-len = <10>;
        };

    pipe_y_view: view-1 {
            x = <1920>;
            y = <0>;
            width = <1920>;
            height = <1080>;
            hfront-porch = <24>;
            hback-porch = <40>;
            hsync-len = <16>;
            vfront-porch = <3>;
            vback-porch = <18>;
            vsync-len = <10>;
        };
    };
};

2. Superframe video timings in maxim serializer node as below

superframe-video-timings {
	pipe-x {
		superframe-group = <0>;
		timings-phandle = <&pipe_x_view>;
	};

	pipe-y {
		superframe-group = <0>;
		timings-phandle = <&pipe_y_view>;
	};

	pipe-z {
		superframe-group = <1>;
		timings-phandle = <&pipe_z_view>;
	};

	pipe-u {
		superframe-group = <1>;
		timings-phandle = <&pipe_u_view>;
	};
};

Signed-off-by: Prafull Suryawanshi <prafulls@nvidia.com>
Change-Id: I80b345f093c21a6e68ee75014eb337ecb579c85b
2023-04-11 04:35:05 +00:00
prafulls
104ecb7e09 video: bridge: maxim: enable GMSL3 and FEC
This change reads device tree property and enables
GMSL3 and GMSL FEC mode only for that corresponding
link. Earlier change was enabling GMSL3 and FEC by
default to both links.

JIRA TDS-10659

Change-Id: I92a0cc757d3ded1c5aa13e14ffbdfaa22a2da89c
Signed-off-by: prafulls <prafulls@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2854454
Reviewed-by: Shu Zhong <shuz@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 04:35:05 +00:00
prafulls
1760079334 video: dc: bridge: max_ser: fix resume error
The resume functionality of maxim gmsl dp serializer
driver calls init routine. Function incorrectly treats
register value as return value and shows error message
in logs. Removing return value check from register read
during init fixes this issue.

bug 3955858

Change-Id: Ibe2058a49827bdd802ea4b5f24be986c911450e6
Signed-off-by: prafulls <prafulls@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2851087
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-11 04:35:05 +00:00
Prafull Suryawanshi
f466f3adb9 video: bridge: maxim: add GMSL3 and FEC support
This change adds GMSL3 support to maxim dp serializer
driver. The property is set in device tree which is if true,
then PAM4 mode is enabled and 12 Gbps link rate is set.

GMSL3 also needs to have FEC enabled. This change also
adds that support.

Device tree need to have "enable-gmsl3" property to be set
to get GMSL3 enabled.
When GMSL3 is enabled, it will enable GMSL-FEC by default.
GMSL-FEC can only be enabled by setting propery "enable-gmsl-fec".

JIRA TDS-10659

Signed-off-by: Prafull Suryawanshi <prafulls@nvidia.com>
Change-Id: I1757f71babbc5135f0ddf3d2a501de721e84da6d
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2831963
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Shu Zhong <shuz@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 04:35:05 +00:00
Jon Hunter
2332bac0d7 video: tegra: Fix TI serializer build for Linux v6.1
Upstream Linux commit ed5c2f5fd10d ("i2c: Make remove callback
return void") in Linux v6.1, updates the i2c remove callback to
prototype to return void instead of int. This is causes the TI FPDLink
DP Serializer driver build to fail for Linux v6.1. Update this driver to
fix the build for Linux v6.1.

Bug 3820317
Bug 3835208

Change-Id: I35c3ac90070b7324330c31dc69d06f53cecd5b67
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2831358
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 04:35:05 +00:00
Prafull Suryawanshi
f452a0d7c6 tegra: dc: max_ser: configure HPD_IRQ
This change enables HPD_IRQ event of maxim serializer only
for "Loss of Training" and "Register control" events. It masks
other events to avoid unexpected HPD_IRQ events.

JIRA TDS-10786

Change-Id: I1c52d99f476bcf5dd9f31d00ab32f8953aec0333
Signed-off-by: Prafull Suryawanshi <prafulls@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2829291
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_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Shu Zhong <shuz@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 04:35:05 +00:00
prafulls
b46348e227 nvidia: add driver for TI FPDLink DP Serializer
This change adds kernel driver for TI FPDlink DP Serializers.
The dp lane rate, dp link rate and viewport resolution
can be set from device tree.
Rest of registers are set using values given in reference
i2c script.

JIRA TDS-11129

Signed-off-by: prafulls <prafulls@nvidia.com>
Change-Id: I6dfc48794c9b2517fe6ed4e91552e46583f6288c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2822429
Reviewed-by: Shu Zhong <shuz@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 04:35:05 +00:00
Jon Hunter
98f2ffc37e video: tegra: bridge: Fix build for Linux v6.1
Upstream Linux commit ed5c2f5fd10d ("i2c: Make remove callback return
void") in Linux v6.1, updates the i2c remove callback to prototye to
return void instead of int. This is causes the Maxim DP Serialize driver
build to fail for Linux v6.1. Update this driver to fix the build for
Linux v6.1.

Bug 3820317
Bug 3835208

Change-Id: I61f4f68e67a4adf9f1744d32f7686ea962876c15
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2820718
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 04:35:05 +00:00
Mihir Pradeep Garude
1510420e8c nvidia: remove regulator header from maxim
Remove regulator header file from maxim display
port serializer driver.

JIRA TDS-11357

Change-Id: I31148a458a92adf31f00bec6386ade3b34b1b412
Signed-off-by: Mihir Pradeep Garude <mgarude@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2813426
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Shu Zhong <shuz@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 04:35:05 +00:00
Prafull Suryawanshi
36a425b6f7 dc: bridge: maxim: remove GMSL lock worker thread
This change removes worker thread from serializer driver
which waits on both links to lock. If both links are not set
via DTS entry then it does not proceed further which causes
no video output.

As it is possible that one link can be connected to deserializer,
this does not require the worker to wait on link locks. So removing
worker thread and enabling video immediately fixes this issue.

bug 3727875

Change-Id: Ie427103a7d455201a4f783d690c6250b38a9113c
Signed-off-by: Prafull Suryawanshi <prafulls@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2775207
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: Shu Zhong <shuz@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-11 04:35:05 +00:00
Yogish Kulkarni
9d71b422fc serializer: mask branch sink count change events
When ruining a few hundred loops of link training between the SOC
and the serializer, we are seeing unexpected HPD_IRQ being triggered
by the MAX96745/96851 serializers due to "Branch sink count change"
event. Till we figure out why this is happening, disable this
interrupt source.

Bug 3676822

Change-Id: Id56ff7d324b9a51f5468afb2d74df7856040056d
Signed-off-by: Yogish Kulkarni <yogishk@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2758859
Reviewed-by: Shu Zhong <shuz@nvidia.com>
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_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-11 04:35:05 +00:00
prafulls
90579e82d5 video: tegra: bridge: Enable CRC check for MAX Ser
This change enables external video CRC check for
Maxim DP Serializer.

This change -
1. Enable video line CRC functionality by setting specific register bit.
2. Add interrupt handler check for remote CRC check failure.
3. Reverse GPIO tunnel and remote error check is already set.
4. If there are CRC error across GMSL link then dmesg spew will indicate it.

Verification -
1. Play some GFX application and view on monitor.
2. At DES side, using GUI, For register INTR8, set bit ERR_TX_EN to 1.
3. Clear exiting dmesg using "dmesg --clear"
4. On SER, using i2ccmd tool, Set bit LINE_CRC_EN to 0 at register 0x100.
5. Confirm on dmesg for error message like - "Remote deserializer error detected"

bug 3463178

Signed-off-by: prafulls <prafulls@nvidia.com>
Change-Id: Ieba2b19b7ce1a71173f6d34e61b1607f237cb1a5
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2753202
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Shu Zhong <shuz@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-11 04:35:05 +00:00
prafulls
02a15c114a video: tegra: bridge: Enable CRC check for MAX Ser
This change enables internal video CRC check for
Maxim DP Serializer.

1. This sets the bit to enable CRC functionality
   and then add handlers for ERRB CRC errors.
2. Reading register clears the error.
3. Error can be injected using i2c tool to write
   error inject bit in register.

Below is flow to verify CRC functionality
1. Run GFX application like bubble
2. Read VTX41 register and confirm VID_ASIL_CRC_ERR bit is not set
3. Inject error by setting bit VID_ASIL_INJ_ERR.
4. Verify dmesg errors.

bug 3463178

Change-Id: I25c07413eb81bb4b40f35e15b53a4102ec68fa9e
Signed-off-by: prafulls <prafulls@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2751057
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Shu Zhong <shuz@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-11 04:35:05 +00:00
Prafull Suryawanshi
3cffc5689c dc: bridge: maxim: add suspend-resume support.
This change adds support of suspend and resume
functionality to Maxim DP Serializer driver.

bug 3685062
JIRA TDS-10310

Change-Id: Idb010948a2af1c7912a177eabb56441fa9d340f6
Signed-off-by: Prafull Suryawanshi <prafulls@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2741394
Reviewed-by: Shu Zhong <shuz@nvidia.com>
GVS: Gerrit_Virtual_Submit
(cherry picked from commit f1d3579fd695fb1b78e7a42447355d50906c7269)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2737003
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
2023-04-11 04:35:05 +00:00
Vishwaroop A
4088261539 dc: serializer: fix dt progamming in driver
Device tree has been updated to use
<0x0 0x0 0x1 0x1> instead of
/bits/ 8 <0x0 0x0 0x1 0x1>. Fix the
device tree parsing logic to fetch the
data correctly.

Bug 3645731

Change-Id: I51ce1194ffb4c71526d1d74a3a5dbbcfe2f18a51
Signed-off-by: Vishwaroop A <va@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2713103
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Shu Zhong <shuz@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-11 04:35:05 +00:00
Vishwaroop A
2ddc0b4649 dc: bridge: Add MST support of serializer
ADD MST support for serializer driver

Bug 3491734

Change-Id: Id616f58ba4f18bcb341c4ad48ba29562e09739ab
Signed-off-by: Vishwaroop A <va@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2655657
Reviewed-by: Shu Zhong <shuz@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-11 04:35:05 +00:00
Prateek Patel
dd4ada9c90 drivers: dc: fix Coverity defect
Initialize value dev before calling dev_info and initialized value
fake_panel_mode.

CID 10129386

Bug 3461002

Change-Id: I9d49bbbe39d23deb609005a091d7c1ebb9e7113f
Signed-off-by: Prateek Patel <prpatel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2660625
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_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-11 04:35:05 +00:00