Commit Graph

67 Commits

Author SHA1 Message Date
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
Mahesh Kumar
098e247960 tegra: platform: dce: Fix IPC race condition
Re-organize IPC channel reset and mailbox interrupt handling code to
fix race condition where KMD was receiving new msg from DCE while
processing previous msg and clearing mailbox interrupt as part of it.
which was causing wait_for_ipc to get stuck.

JIRA TDS-6381

Change-Id: Ibd6ab1758d9b5b2e3709a03dadbc84f2585653a4
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2460641
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-14 19:23:43 +00:00
Arun Swain
6f353f4c77 tegra: platform: dce: Pass msg length info to DCE
Convey DCE FW about the actual length of the IVC
payload. This is needed since dce clients like RM
can transfer a wide range of variable sized
messages.

JIRA TDS-6381

Change-Id: Idd3b8bfe2419095de27fdc050caf4ed75154a2c3
Signed-off-by: Arun Swain <arswain@nvidia.com>
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2422599
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
9764cf5370 tegra: dce: Add IPC event notification support
- This change adds support for new IPC type
DCE_IPC_TYPE_RM_NOTIFY wrt event notification from
DCE RM

JIRA TDS-6643

Change-Id: I54b22e3fa86a1dab552f78d609c374d14ce619ad
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2409904
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Santosh Galma <galmar@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
Santosh Reddy Galma
f452d16f44 tegra: dce: use wait queue instead of completions
- completions uses spin lock and disables irq
resulting in processor getting blocked to receive
mailbox interrupts during IPC synchronization.
- current change uses wait queues instead of
completions for IPC synchronization to overcome
above possibility of IPC blocked on DCE.

JIRA TDS-5691

Change-Id: I12e06ff4d31cf47d87e7a9d76d9915e5e2210de6
Signed-off-by: Santosh Reddy Galma <galmar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2428661
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-14 19:23:43 +00:00
Arun Swain
25954c13e6 drivers: platform: tegra: dce: Clean up ivc notify
Revisit ivc signaling during handshake and clean
it up to reduce spurious signals.

JIRA TDS-6381
Bug 200666838

Change-Id: I1698220b968d0aa8d1b6d1d36d551118be283c02
Signed-off-by: Arun Swain <arswain@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2417049
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: Santosh Galma <galmar@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Arun Swain
ea84c95dbf tegra: platform: dce: Fix race condition on fgpa
Resolve race condition where DCE Firmware could
potentially send an IVC signal before even CPU
driver starts listening for it.

This fix makes sure that the driver need not wait
if it has been signalled already by Firmware.

Jira TDS-6381

Change-Id: I3d6dd1f93ce36f9e44b7157f70c0aad099f2d561
Signed-off-by: Arun Swain <arswain@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2394468
Tested-by: Santosh Galma <galmar@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
ef3f18c398 tegra: dce: suppress unnecessary info logs
This patch removes unnecessary dce_info prints to avoid flooding of uart
logs.

JIRA TDS-5691

Change-Id: I9c9a32815e685504b443f24483502fe019ac0eaf
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2375553
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-14 19:23:43 +00:00
Mahesh Kumar
dc3e980731 tegra: dce: Add debugfs node to show boot status
This patch adds a debugfs node to show DCE boot status.

It also adds following dce boot marker in logs
  - DCE_BOOT_DONE
  - DCE_BOOT_FAILED

JIRA TDS-5691

Change-Id: Iada5c1234e5e5f1a5e7afd88dcb94c2da6a3fe1c
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2361287
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: Santosh Galma <galmar@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-14 19:23:43 +00:00
Mahesh Kumar
91c35f09be dce: avoid kmsg flooding with info print.
If dce is not initialized dce-driver prints a print every second.
This patch removes the print as we already have debug node
to check the dce-boot status.

Change-Id: I25a8830dce6a61eef122b58fc211b53c2bb04cd4
Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2352003
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Reviewed-by: Mitch Luban <mluban@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
Arun Swain
606f03fbf2 platform: tegra: dce: add dce kernel driver
For T23x, we have a separate R5 based cluster
named as Display Controller Engine(DCE) to run
our Display RM code. This driver will run on CPU
with the following functionality:

Via debugfs for test and bring-up purposes:
1. Reads the DCE firmware image into DRAM.
2. Sets up DCE AST to cover the DCE firmware image.
3. Sets up R5 reset vector to point to DCE firmware
entry point
4. Brings DCE out of reset
5. Dumps various regsiters for debug

In production env:
1. Manages interrupts to CPU from DCE
2. Uses bootstrap command interface to define Admin
IPC
3. Locks down bootstrap command interface
4. Uses Admin IPC to define message IPC
5. Uses Admin IPC to define message IPC payload area
6. Uses Admin IPC to set IPC channels
6. Uses Admin IPC to define crashdump area
(optional)
7. Provides IPC interfaces for any DCE Client running
on CCPLEX including Display RM.
8. Uses Admin IPC to set logging level (optional)

This patch puts a framework in place with the
following features :
1. Firmware Loading
2. AST Configuration
3. DCE Reset with EVP Programming
4. Logging Infra
5. Debugfs Support
6. Interrupt Handling
7. Mailbox Programming
8. IPC Programming
9. DCE Client Interface
10. Ftrace Support for debug purposes

Change-Id: Idd28cd9254706c7313f531fcadaa7024a5b344e7
Signed-off-by: Arun Swain <arswain@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2289865
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Mitch Luban <mluban@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Mahesh Kumar <mahkumar@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-14 19:23:43 +00:00