Commit Graph

2635 Commits

Author SHA1 Message Date
Ankur Pawar
2ceba857fd media: add imx390 sensor driver
Add imx390 camera sensor driver code,
mode tables and makefile changes.

Bug 3583587
Bug 4058151

Change-Id: I2b67d355d2684ccb6ab12881ac0d0d5b30447cc4
Signed-off-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2879227
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-14 20:00:58 -07:00
JC Kuo
d7d941e745 drivers: tegra: Add Tegra USS io-proxy driver
This commit adds the Tegra USS io-proxy driver which allows userspace
to control clock and GPIO signals to the Ultrasonic sensor subsystem
found on Tegra platform.

Bug 3360749

Change-Id: I0b765e8b9e14b7de87f0f9205237d4dbfdd9f8f5
Signed-off-by: JC Kuo <jckuo@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2886017
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 15:46:35 -07:00
Ankur Pawar
c9858e1282 media: add ar0234 sensor driver
Add ar0234 camera sensor driver code,
max96712 GMSL serializer code, mode tables
and makefile changes. These drivers are copied
from K5.10 camera driver repo. Changes include
svcacv warning fix and eeprom read status is
ignored due to bug 4064490.

Bug 3583587
Bug 4064490

Change-Id: I7ea0ecf959caccafd283c8db5fb7c3be912cf8bb
Signed-off-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2868422
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 15:45:38 -07:00
Laxman Dewangan
68992c3856 nvdla: Merge nvdla sources from kernel/nvidia to kernel/nvidia-oot
Merge the nvdla driver and header sources with change history from
       'origin/dev/ldewangan/nvidia-nvdla-dev-main'
   into
	nvidia-oot-dla-dev-main

Bug 4038415

Change-Id: I2fa6256af1c3d39a17fbb6b00ec97da5113e30cd
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-04-14 12:46:10 -07:00
Laxman Dewangan
fc65c721b3 dce-kmd: Merge the dce-kmd driver from kernel/nvidia to kernel/nvidia-oot
Merge all the history of dce-kmd driver from kernel/nvidia to
kernel/nvidia-oot to get rid of kernel/nvidia for OOT drivers.

Merge remote-tracking branch
	'origin/dev/ldewangan/nvidia-dce-kmd-dev-main'
   into
	nvidia-oot-dce-kmd-dev-main

	423a08008 platform: dce: fix compilation error with GCC 11
	c042cceca platform: dce: Fix typecast issue
	fab8399c0 platform: dce: fix missing static declarations
	3120c1b93 platform: dce: fix wait race condition
	cfa9f9447 platform: dce: add wait in ipc registration
	2cda11540 platform: dce: Add suspend resume hooks
	6dc865fdf platform: dce: add device_link b/w display and dce
	62d5a814c platform: dce: Fix build for Linux v6.2
	f94fc6a6c platform:dce: notify dce after state ack
	3fd0884d0 platform: tegra: dce: change license to MIT for errors header
	c63ddeada platform: dce: Add license and copyright to Makefile
	04317ad83 platform: dce: set MIT license for dce headers
	777f20477 platform: dce: fix async msg read prints
	b2b1943a4 platform: dce: Fix automatic loading with DT
	71ec8ed89 platform: DCE: Add OOT support for ipc
	f4c024e6a platform: dce: Coverity Fix
	10f192c95 platform: tegra: dce: Add debugfs for external tests
	4e14b0c5f platform: tegra: dce: Proper error codes for admin cmds
	901e8cd42 platform: dce: FSM incremental fixes
	892514267 platform: dce: remove use of of_irq_xxx
	699997fdf platform: dce: add support for multiple HSP
	5ee0a5d61 platform: dce: reworked dce FSM design
	5c9cec276 platform: dce: remove debugfs on deinit
	848f9554d platform: dce: change DCE firmware name
	624471e68 platform: dce: remove unused rpc_sync macro
	ebcd3626d platform: dce: Add support for debug level logs
	60f8aaf3b drivers: dce: fix cert_c defect
	076e7f507 platform: tegra: dce: fix async events handling
	7da65fd7a platform: dce: functionality fixes
	fb138a499 platform: dce: Fix admin cmd ids
	b4cef4627 platform: DCE: fix notify event IPC buffer region
	859338234 drivers: platform: dce: fix Coverity defect
	ea88e4a33 drivers: platform: dce: fix Coverity defects
	8e7845044 platform: dce: fix ss clear reg address
	b63ecbcb5 platform: tegra: dce: fix race condition
	5f223b330 tegra: platform: dce: fix for wrong mutex sequence
	d36abd464 platform: tegra: dce: retry interrupted rpc wait
	62fb673ff platform: tegra: dce: fix debugfs compilation error
	42539f106 platform: tegra: dce: fix worker deadlock
	885b82799 Merge branch 'linux-t23x' into 'linux-nvidia'
	05cac4791 platform: tegra: dce: Add debugfs for echo cmd
	16c6e9540 platform: tegra: dce: Admin rpc post boot support
	8ec573617 platform: tegra: dce: Add WQ to handle async IPC
	eb0b14aa8 tegra: platform: dce: use mutex_lock API properly
	e9f03e0d9 tegra: platform: dce: Update smmu stream id
	058f5017c tegra: platform: dce: Fix IPC race condition
	c8f368c92 tegra: platform: dce: Pass msg length info to DCE
	cc9fe6a08 tegra: dce: Add IPC event notification support
	f70bdcd12 tegra: dce: use wait queue instead of completions
	4a5540a1e drivers: platform: tegra: dce: Clean up ivc notify
	4bf0470aa tegra: platform: dce: Fix race condition on fgpa
	c82335a03 tegra: dce: suppress unnecessary info logs
	f3fde71e6 tegra: dce: Add debugfs node to show boot status
	c10071d03 dce: avoid kmsg flooding with info print.
	7fab8f573 platform: tegra: dce: add dce kernel driver

Bug 4038415

Change-Id: If39d7d68ec2b8f6d8bbd6942181755720d09e3a8
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-04-14 19:37:51 +00:00
Mahesh Kumar
873e421d95 platform: dce: Add Debugfs support for Perf
Add debugfs nodes
 - start/stop perf stats.
 - read perf stat stats
 - set the format type as csv or xml

Add debugfs to capture perf events
 - Can enable specific perf events
through debugfs node.

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I0a7833d7a8f04296ba3806f4f2a218175080d2e2
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2765513
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Tested-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:36:09 +00:00
Vince Hsu
b25786578c platform: dce: fix compilation error with GCC 11
GCC 11 reports the array-bounds issue when passing an 32-bit variable
to find_first_bit but referencing it as 64-bit.

drivers/platform/tegra/dce/dce-debug.c: In function ‘dbg_dce_boot_status_fops_read’:
./include/linux/find.h:119:37: error: array subscript ‘long unsigned int[0]’ is partly outside array bounds of ‘hsp_sema_t[1]’ {aka ‘unsigned int[1]’} [-Werror=array-bounds]
  119 |                 unsigned long val = *addr & GENMASK(size - 1, 0);
      |                                     ^~~~~
drivers/platform/tegra/dce/dce-debug.c:493:20: note: while referencing ‘ss’
  493 |         hsp_sema_t ss = dce_ss_get_state(d, DCE_BOOT_SEMA);
      |                    ^~
...
from drivers/platform/tegra/dce/dce-debug.c:15:
./include/linux/find.h:119:37: error: array subscript ‘long unsigned int[0]’ is partly outside array bounds of ‘u32[1]’ {aka ‘unsigned int[1]’} [-Werror=array-bounds]
  119 |                 unsigned long val = *addr & GENMASK(size - 1, 0);
      |                                     ^~~~~
drivers/platform/tegra/dce/dce-debug.c:492:13: note: while referencing ‘boot_status’
  492 |         u32 boot_status = d->boot_status;
      |             ^~~~~~~~~~~
cc1: all warnings being treated as errors

Fix it by passing a 64-bit variable to find_first_bit directly.

Bug 200730650

Change-Id: Ibfb68a2ee175aeb60eb9248496c220b35ff98906
Signed-off-by: Vince Hsu <vinceh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2856358
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: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
vinodg
47b8841a62 platform: dce: Fix typecast issue
Sparse shows error for using __iomem pointer for
void pointer as incorrect type in assignment.

No need to use __iomem pointer, as this address
is never meant for device memory.

Changed iosys_map_set_vaddr_iomem to
iosys_map_set_vaddr call.

Bug 3646321

Change-Id: I3ebe3db14a7953ab42cd1392b54c74e86dc1243d
Signed-off-by: vinodg <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2846522
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
vinodg
658865f51a platform: dce: fix missing static declarations
Fix sparse errors for static declaration.

Update functions and variables defined and used
in the same source files with static declaration.

Bug 3646321

Change-Id: I378b0f514aedf265420c2eb454691e85c378cd95
Signed-off-by: vinodg <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2846452
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@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: Ketan Patil <ketanp@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
1258e71941 platform: dce: fix wait race condition
It is possible that we received the ACK from DCE even before we
start waiting. But currently we are clearing the "complete" state
before start waiting, which may result in missed interrupt.

This patch removes the clearing of complete state before wait.
Also Adds few comments for better understanding.

Bug 3941557

Change-Id: I7d2efb1a64eb6f2d4df1876add07a8f019b449f5
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2845498
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
387a379024 platform: dce: add wait in ipc registration
If DCE bootstrapping is not complete, client registration may fail or
result in IPC failures.
Wait for bootstrapping to complete before registering any IPC-Client.
Use high priority work queue to schedule bootstrap work.

Bug 3583331
Bug 3826630

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I0facfe225e1550c795c2de7b42916416faa3bcaa
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2834857
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2824219
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
75bfcf326d platform: dce: Add suspend resume hooks
Add suspend resume hooks function and handling of sc7 events.

Bug 3583331
Bug 3826630

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I920b02ad46a76330febe666fe17e8d328f744b1d
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2834856
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2824218
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>
2023-04-14 19:23:43 +00:00
Santosh Reddy Galma
31b6d913ab platform: dce: add device_link b/w display and dce
- add the device link between display and DCE such that
DCE KMD module will enter suspend after display suspend is
complete and DCE KMD module resumes early before display
resumes as DCE bootstrap has to be complete for display
to proceed with initialization.

Bug 3685062
Bug 3826630

Signed-off-by: Santosh Reddy Galma <galmar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2780892
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Change-Id: I4d84d8b5723747d984f0883aba697a5a0a0a21bf
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2824217
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>
Tested-by: Mahesh Kumar <mahkumar@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Jon Hunter
12a8ee706f platform: dce: Fix build for Linux v6.2
Upstream Linux commit 4c1e0a97351a ("firmware: tegra: bpmp: Use
iosys-map helpers") updated the Tegra IVC driver to use the iosys-map
helpers for Linux v6.2. Update the DCE driver accordingly to work with
the latest Tegra IVC driver.

Bug 3936429

Change-Id: Id04fa3cbc078ed9657ae779b6a1bbd088008175c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2842560
(cherry picked from commit 545f887e90cffff1d79f6a4ff0af87ddfcbeb178)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2801234
Reviewed-by: Mahesh Kumar <mahkumar@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-14 19:23:43 +00:00
Mahesh Kumar
5d5463b60f platform:dce: notify dce after state ack
The current code doesn't notify DCE IPC after DCE IPC is in ACK state
Current Flow:

         CPU                      DCE
1: tegra_ivc_init               ---------
2: DCE_ADMIN_CMD_IPC_CREATE     tegra_ivc_init
3:     ---------                tegra_ivc_channel_reset
                                    dce:SIVC_STATE_SYNC
                                    cpu:ESTABLISHED
4: tegra_ivc_reset
       dce:SIVC_STATE_SYNC      ---------
       cpu:SYNC
5: Notify()                     tegra_ivc_channel_notified
                                    dce:SIVC_STATE_ACK
                                    cpu:SYNC
6: tegra_ivc_notified           ---------
       dce:SIVC_STATE_ACK
       cpu:ESTABLISHED

After Step 6 DCE state is in ACK state and CPU state is in ESTABLISHED
state. As there is no further cpu->dce notification in RM_NOTIFY
channel, dce state stays in the "ACK" state and any attempt to send msg
on RM_NOTIFY channel from dce->cpu fails.

This patch notifies dce after step-6, So dce channel is also in the
"ESTABLISHED" state.

If steps 3-6 get executed in CPU before Step 5 in DCE gets a chance
to execute (DCE is slow), the CPU IPC state will change to "established".
Now when step 5 will execute in DCE, it'll see the CPU state as
"established" so, It'll make the DCE state also "established".
That's how it's working today.

Bug 3861985

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: Ieb13f525d3f81b30aaae848d8d5adb1106856b65
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2840065
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Adeel Raza
424a1c66f0 platform: tegra: dce: change license to MIT for errors header
When dce-core-interface-errors.h was copied from DCE FW, the header
incorrectly retained its proprietary license. The license has been
changed to MIT.

Bug 3198239
JIRA TDS-6362

Signed-off-by: Adeel Raza <araza@nvidia.com>
Change-Id: I8fb1c525c11207444655af81f5b103f2908b98ef
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2834612
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Jon Hunter
9116ef8c3e platform: dce: Add license and copyright to Makefile
Add the GPL v2.0 license and NVIDIA copyright to the DCE Makefile.

Bug 3912236

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: I75044962d68a556c8b6b5ae7d09d44f8ff61b515
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2828593
(cherry picked from commit 15f8adb73788f0073f3f6e960fdadb04246c869a)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2829455
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
3c473c60eb platform: dce: set MIT license for dce headers
Change NV license for dce headers to MIT license as those
can be distributed with other linux sources but they are also
used in DCE firmware.

Bug 3871403

Change-Id: I363d252a1155e3e0119d46b35b073bd6ad10fc57
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2820110
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Ujwal Patel <ujwalp@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
bb8fc06951 platform: dce: fix async msg read prints
While MST is used, We get two async msgs from DCE and schedule 2 worker
threads, But during processing (dce_client_process_event_ipc) of these
messages, We are processing all the pending messages in one go. So,
while the second worker thread is scheduled, there is no new message
to read.

This Patch fixes the loop to try reading only when there is a new msg to
read. Also convert info print to debug, to avoid print noise.

Bug 3801736

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: Iddf9ea8f0194539baa8c52616e2f836527400176
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2810440
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: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Jon Hunter
6379e130a8 platform: dce: Fix automatic loading with DT
The Tegra DCE module is not automatically loaded on boot with
device-tree and this is because the MODULE_DEVICE_TABLE is not populated
in the driver. Add the MODULE_DEVICE_TABLE for the DCE driver to fix
automatic loading with device-tree.

Bug 3583600

Change-Id: I487d4de8b8e9e71a7c3ad961845c346e886e632e
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2805837
Tested-by: Mahesh Kumar <mahkumar@nvidia.com>
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: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
fde8d45bbe platform: DCE: Add OOT support for ipc
Reorg DCE-KMD IPC code to use only upstream IVC APIs
This will simplify integrating the code for OOT.

Bug 3583600
Bug 3713048

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: Ia124f7bc77a788b94b0bf60634ed740c77228725
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2790847
Reviewed-by: Arun Swain <arswain@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-14 19:23:43 +00:00
Mahesh Kumar
a42af2d0ad platform: dce: Coverity Fix
Fix Coverity issue CID 10138164
Create new macro to avoid non-reachable code.

Bug 3461002

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: Ie5ff50678e30ae0ddd712ceda212f4b572ce624e
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2765168
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: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 19:23:43 +00:00
Adeel Raza
c032aa992e platform: tegra: dce: Add debugfs for external tests
External clients such as MODS require the ability to run tests. Add
support for this feature. Currently only the following 2 external client
tests are supported:
  - MODS ALU test
  - MODS DMA test

Bug 3198239
JIRA TDS-6362

Change-Id: I18c20a9fa5d2606056d65b76fbaae9b0c81746d4
Signed-off-by: Adeel Raza <araza@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2606595
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-14 19:23:43 +00:00
Adeel Raza
d05457f954 platform: tegra: dce: Proper error codes for admin cmds
Currently admin channel commands return error codes which can't be
understood by KMD. Standardize on DCE_ERR_CORE_* errors (defined in
dce-core-interface-errors.h) for admin commands.

Bug 3198239
JIRA TDS-6362

Change-Id: I42a9ae44c0999aa5133c36ba4c6fb4fee2b25767
Signed-off-by: Adeel Raza <araza@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2736608
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
8ef1f2db87 platform: dce: FSM incremental fixes
This patch addresses design review comments for FSM
 - Add comment to update design doc on FSM update
 - Create wrapper function to check bootcmd complete status
 - move bootstrapping functions to dce_bootstrap.c file
 - Fix sw resource init/deinit function name

Bug 3583331

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I77f05135f7ec1882922907f8acef50def639d26d
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2758902
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
5aa80075ad platform: dce: remove use of of_irq_xxx
of_irq_xxx faimly of functions are not exported by Kernel.
use platform_irq_count and platform_get_irq APIs instead.

This patch also moves dce_platform_data elements to dce_device
struct to keep dce_platform_data constant.

Bug 3581824

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I5ea13ea039ef1464e678f0604a045a6ab67bc16f
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2755141
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
df0f2d1a74 platform: dce: add support for multiple HSP
Change-Id: Ia6d3278b89f5ba34bd6bbbd80820279e4e06fc0b
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2727625
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
28a1cfd1c1 platform: dce: reworked dce FSM design
Redesign DCE KMD drive state machine to handle new PM events.

Bug 3583331

Change-Id: I89adcfa2f311a9a1e86b70e14821468203365266
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2673665
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
a6cc70f8d5 platform: dce: remove debugfs on deinit
Current code does not remove debugfs node on deinit.
This patch fixes the same.

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I9ceb78b73d71aca0a2363df0408bf6a85ca91834
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2743215
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: Arun Swain <arswain@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Wei Ni
4904a11978 platform: dce: change DCE firmware name
Change the DCE firmware name from dce.bin to display-t234-dce.bin

Bug 3593058

Signed-off-by: Wei Ni <wni@nvidia.com>
Change-Id: I0a6e4243a6d3cc45688303ccd6a28a65a6edbb31
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2695059
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
eab8003c4c platform: dce: remove unused rpc_sync macro
DCE_IPC_WAIT_TYPE_SYNC is not used anymore for RPC. This patch get rid
of DCE_IPC_WAIT_TYPE_SYNC define from the code.

Bug 3472984

Change-Id: Iae0237e39f12f6cb170297f95fa6a39bc64e694a
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2699028
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: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
4b609b3dd4 platform: dce: Add support for debug level logs
Add support to print debug level dce logs.
This is to reduce the number of prints spew by dce in kernel logs.

Bug 3472984

Change-Id: Idaf0dbb3511ee92a632bb0be8c445212e228f8d5
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2692698
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: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Prateek Patel
183b03657c drivers: dce: fix cert_c defect
Dereferencing match, which could be NULL. Add a sanity check before
using it.

CID 451824

Bug 3512545

Change-Id: I367274508d331f602763a38ad7b1d26c2e876179
Signed-off-by: Prateek Patel <prpatel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2702272
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
2023-04-14 19:23:43 +00:00
Santosh Reddy Galma
631f4aafe9 platform: tegra: dce: fix async events handling
- when there are multiple async events back to back from DCE with very
short time gap between 2 events(for example, in case of DP MST,
2 heads could be sending flip event notification back to back at
almost same time), there is a possibility of 2nd async event getting
processed very late when shared mailbox register is set to zero as part
of processing 1st async event and before processing of 2nd async event.
- current change fixes it by processing all pending IVC frames for IPC
channel when processing an async event.
- change few error logs to info logs as these are not actually errors.

Bug 3582863
Bug 3429668

Change-Id: I29b1813bed50c4583e37f02bf656802081ccf9d3
Signed-off-by: Santosh Reddy Galma <galmar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2698560
(cherry picked from commit dd1abfa6eaab6e4f599d8c97bdccc7cbb67e1341)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2700438
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: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
716c1f3cdb platform: dce: functionality fixes
This patch make changes to

declare of_device_id __weak so that other declarations
can take precedence.
validate return value from find_first_bit function to avoid overflow
when No bits are set.
%s/dce_stream_id/stream_id/

Jira TDS-9583

Change-Id: I85c681b904c7a4f9df76ec8387231a17de2e6d77
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2645913
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: Arun Swain <arswain@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
246fcd3d2d platform: dce: Fix admin cmd ids
Reorganize duplicate Admin commands to make All
admin command ids unique.

Bug 3583331

Change-Id: Ib46d7ab7d1546ec0e9963c15c5ea36cd9b5b7cfe
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2685983
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
de5c7b0b06 platform: DCE: fix notify event IPC buffer region
Current code does not include IPC buffer region for Notification
channel. This patch adds Notification IPC buffer size into total
allocated buffer for IPC.
This CL also increases Async IPC buffer frames from 1 to 4

Bug 3500242

Change-Id: I4ae07fdf9cf7c20fb70626698233f74a8b9fc8de
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2661833
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-14 19:23:43 +00:00
Prateek Patel
2f69b0b61c drivers: platform: dce: fix Coverity defect
Update the if conditions to prevent Out-of-bound read/write access
on arrays.

CID 10127916
CID 10127864
CID 10127923

Bug

Change-Id: I01141ed46b7c372ddf1c5031d60b88ac28e786ca
Signed-off-by: Prateek Patel <prpatel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2664104
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: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Prateek Patel
9b5416fd50 drivers: platform: dce: fix Coverity defects
Dereference after null check for pointers cl and handlep. Add a null
check before referencing cl and handlep.

Check return value of request_firmware for error.

Using uninitialized value event when calling dce_worker_thread_wait.
Add EVENT_ID_DCE_INVALID_EVENT and have a check before using the
value event.

CID 10127898
CID 10127999
CID 10127954
CID 10127811

Bug 3461002

Change-Id: If00ece28fd52e495b3a8d3eec7bdb4825d3c7892
Signed-off-by: Prateek Patel <prpatel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2661588
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: svcacv <svcacv@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
b2d304096e platform: dce: fix ss clear reg address
This patch fixes a typo in ss_clear_regs.

Bug 3500242

Change-Id: If6d08219abc8a0c233c91e769077d793db5bbe3d
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2654239
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
David Yu
d260cc9026 platform: tegra: dce: fix race condition
There is race condition in driver when in_use variable
is accessed in both interrupt context and process context
to schedule a workitem in workqueue. When it is reproduced,
following error message is printed in kernel log.

dce: dce_client_schedule_event_work:359  Failed to schedule Async event
Queue Full!

- This change make sure to check for in_use variable in
interrupt context before scheduling a workitem in workqueue and also
uses atomic operations for usage of in_use variable.
- This also removes unreachable code in driver.

Bug 3454371

Change-Id: I68ce3cd17769ec837a895a4147ae042e2730ae58
Signed-off-by: David Yu <davyu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2636749
(cherry picked from commit b8935cf34edb52b9803dae3ace767b116b8adbef)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2637714
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Santosh Galma <galmar@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-14 19:23:43 +00:00
Sumit Gupta
70e595afca tegra: platform: dce: fix for wrong mutex sequence
Fix wrong sequence of mutex destroy and unlock for Invalid Channel State.
Also, removed a redundant return statement.

 tegra-dce d800000.dce: Adding to iommu group 5
 dce: dce_ipc_channel_init:312  Invalid Channel State [0x0] for ch_type [2]
 ------------[ cut here ]------------
 DEBUG_LOCKS_WARN_ON(mutex_is_locked(lock))
 WARNING: CPU: 10 PID: 1 at kernel/locking/mutex-debug.c:103 mutex_destroy+0x60/0x70
 Modules linked in:
 CPU: 10 PID: 1 Comm: swapper/0 Not tainted 5.10.65-tegra #21
 Hardware name: NVIDIA Orin Jetson-Small Developer Kit (DT)
 pstate: 60c00009 (nZCv daif +PAN +UAO -TCO BTYPE=--)
 pc : mutex_destroy+0x60/0x70
 lr : mutex_destroy+0x60/0x70
 ....
 Call trace:
  mutex_destroy+0x60/0x70
  dce_ipc_channel_init+0x234/0x4a0
  dce_admin_init+0x48/0x180
  dce_driver_init+0x30/0x130
  tegra_dce_probe+0x154/0x300

Bug 200778010

Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
Change-Id: Ia8a98d3af82a8fc1b77400dfbeff497ff3123921
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2615918
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
b982595c51 platform: tegra: dce: retry interrupted rpc wait
currently dce_client_ipc_wait_rpc function waits with
"wait_event_interruptible". And if process is interrupted, it leads
to RPC failure as "dce_ipc_send_message_sync" will try to read RPC msg
when there is no msg to read yet.

This CL make change to restart/retry wait if condition variable is not
signaled by "dce_client_ipc_wakeup"

Bug 200771402

Change-Id: I8f1c7781bab8b6c20b05251cc2862ad2db22cc1f
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2600849
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Sahil Mukund Patki
e384d775a5 platform: tegra: dce: fix debugfs compilation error
The file dce-debug.c is only used when CONFIG_DEBUG_FS is enabled.
Compilation errors occur when CONFIG_DEBUG_FS is disabled.
Moreover the function "dce_init_debug" is defined in dce-debug.c.
Since compilation of this file only occurs when debugfs is enabled,
the declaration of the function should only be done when debugfs is
enabled.

This patch fixes the compilation errors by compiling the above
mentioned file only when debugfs is enabled. Also the declaration of
"dce_init_debug" is guarded by CONFIG_DEBUG_FS since it is only used
when debugfs is enabled.

Bug 200755555

Change-Id: I0077e0c7a722ed515b0bcdfdd82c94a371f5aae3
Signed-off-by: Sahil Mukund Patki <spatki@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2583640
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Adeel Raza
048b473d86 platform: tegra: dce: fix worker deadlock
For the BOOT_COMPLETE event the worker thread was immediately returning
in an error case without releasing the worker lock. This causes a
deadlock for the next worker event that has to be processed because the
worker lock can't be acquired. Fix this bug by not returning immediately
in the error case. Instead break out of the switch case block and
release the lock at the end of the function.

JIRA TDS-6380

Change-Id: I468098a37ac8f5f6f7459b84d590b989585075e3
Signed-off-by: Adeel Raza <araza@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2552228
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
4730a3c30c platform: tegra: dce: Add debugfs for echo cmd
This patch adds a debug node to send ADMIN_ECHO commands to the DCE.
node takes number of echo commands to be sent as input.

JIRA TDS-5692

Change-Id: If3cfcef3b0ac703754ee9a4146ab417978cdbe46
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2487659
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
4653b0d74e platform: tegra: dce: Admin rpc post boot support
Current code assumes no RPC message on Admin-channel post boot. So
 - Admin RPC reply post-boot are not passed to the process issuing the
RPC instead expect dce_worker to handle the reply.
 - dce_worker doesn't wait for > 1 RPC reply from DCE-Core post boot.

This patch Adds support to send RPC over Admin channel post boot and
also adds support to wake-up the process issued RPC and waiting for
reply.

JIRA TDS-6381

Change-Id: Ifa85f8686c4aee86eb8efc69f85e552ca6f605c5
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2500788
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
35242999ff platform: tegra: dce: Add WQ to handle async IPC
In current code RPC ack events are handled by thread issuing RPC but
Async-IPC events are handled in the bottom-half with interrupt disabled.
This may delay delivery of RPC ack if async-IPC handling is hogging the
CPU. It can also lead to a race condition where the RPC caller takes
the lock, issues a RPC and waits for a reply. And in-between KMD receives
an Async IPC and wants to take the same lock.
As IPC code is running with interrupt disabled, RPC-reply interrupt will
not be notified and will result in a deadlock.

This patch creates a Workqueue to handle Async IPC events.

JIRA TDS-6381

Change-Id: If7d69ef50298ad9364e9e494a32cf483ecfb744e
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2485764
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Manish Bhardwaj
42e6775484 tegra: platform: dce: use mutex_lock API properly
Improper use of mutex_lock API is leading to below crash with
rt kernel, this patch fixes the below crash.

dce: dce_req_boot_irq_sync:70   Waiting on dce fw to boot...
------------[ cut here ]------------
DEBUG_LOCKS_WARN_ON(rt_mutex_owner(lock) != current)
WARNING: CPU: 0 PID: 126 at /dvs/git/dirty/git-master_modular/out/
aarch64-arm64-tegra_defconfig-rt_patches-debug-extmod_ubuntu18.04_aarch64
-extmod_linux_x86_64/kernel/src-rt/kernel-5.10/kernel/locking/
rtmutex-debug.c:47 debug_rt_mutex_unlock+0x5c/0x68
 Modules linked in:
 CPU: 0 PID: 126 Comm: dce_worker_thre Not tainted 5.10.17-rt32-tegra #2
 Hardware name: t234pre_si (DT)
 pstate: 00800089 (nzcv daIf -PAN +UAO -TCO BTYPE=--)
 pc : debug_rt_mutex_unlock+0x5c/0x68
 lr : debug_rt_mutex_unlock+0x5c/0x68
 sp : ffff8000137fbc90
 x29: ffff8000137fbc90 x28: 0000000000000000
 x27: 0000000000000000 x26: ffff800012241180
 x25: ffff000082b7e090 x24: ffff800010e781d0
 x23: 0000000000000000 x22: ffff8000137fbd18
 x21: ffff8000137fbd08 x20: 0000000000000000
 x19: ffff000082b7e0b8 x18: ffffffffffffffff
 x17: 00000000000000c0 x16: fffffe0001eadf40
 x15: ffff800011e6f988 x14: ffff8000937fb817
 x13: ffff8000137fb825 x12: 2065756c61562020
 x11: 0000000005f5e0ff x10: ffff8000137fb770
 x9 : ffff8000137fbc90 x8 : 4e5241575f534b43
 x7 : 000000000000001f x6 : ffff80001224a65c
 x5 : 00000000ffffe163 x4 : 00000000ffffe163
 x3 : ffff800011f3ba50 x2 : 0000000100000001
 x1 : 0e62cf1b356d1e00 x0 : 0000000000000000
 Call trace:
  debug_rt_mutex_unlock+0x5c/0x68
  rt_mutex_slowunlock+0x38/0x98
  rt_mutex_unlock+0x5c/0x98
  __rt_mutex_unlock+0x20/0x30
  _mutex_unlock+0x20/0x30
  dce_worker_thread_wait+0x88/0x300
  dce_wait_boot_complete+0x74/0x118
  dce_worker+0x24/0x1c8
  dce_thread_proxy+0x20/0x30
  kthread+0x194/0x1a0
  ret_from_fork+0x10/0x18
 ---[ end trace 0000000000000001 ]---

JIRA ESLC-5710

Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Change-Id: I0a67b4792515ca8212dc4a3b34ead5bde9f94f49
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2499983
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Arun Swain
a1eeff5716 tegra: platform: dce: Update smmu stream id
Use the new stream id for memory requests
originating from DCE.

Bug 200692073

Change-Id: Ied2abc20a7aefd49e5bbb8845692ec0adfc74b40
Signed-off-by: Arun Swain <arswain@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2476823
Tested-by: Pritesh Raithatha <praithatha@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-14 19:23:43 +00:00